Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRoland Grunberg2017-12-15 19:08:04 +0000
committerAlexander Kurtakov2018-01-17 20:13:08 +0000
commite381d207cb461db072e6cc75b35c048984347aa6 (patch)
tree4edf7a1dec493a66506054b1faff1ce3b17e22a4 /tests
parentd88da66379385cdf0365a99e2990a60daf96864e (diff)
downloadeclipse.platform.swt-e381d207cb461db072e6cc75b35c048984347aa6.tar.gz
eclipse.platform.swt-e381d207cb461db072e6cc75b35c048984347aa6.tar.xz
eclipse.platform.swt-e381d207cb461db072e6cc75b35c048984347aa6.zip
Bug 527738 [Webkit2] Add test case for calling setUrl with POST data.
Simply call bugs.eclipse.org and pass some x-www-form-urlencoded data in the POST message body. Change-Id: I9148ee19468c910044b5f2b93b4a7e96f3730edb Signed-off-by: Roland Grunberg <rgrunber@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_Browser.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_Browser.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_Browser.java
index cd98aa5e21..eee4c627de 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_Browser.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_Browser.java
@@ -882,6 +882,34 @@ public void test_setUrl_remote() {
validateTitleChanged(expectedTitle, browserSetFunc);
}
+/** This test requires working Internet connection */
+@Test
+public void test_setUrl_remote_with_post() {
+ assumeFalse(webkit1SkipMsg(), isWebkit1); // Fails on webkit1 but likely not going to try to support it.
+
+ // This test sometimes times out if build server has a bad connection. Thus for this test we have a longer timeout.
+ secondsToWaitTillFail = 35;
+
+ String url = "https://bugs.eclipse.org/bugs/buglist.cgi";
+
+ // Skip this test if we don't have a working Internet connection.
+ assumeTrue("Skipping test due to bad internet connection", checkInternet(url));
+ testLog.append("checkInternet() passed");
+
+ String expectedTitle = "Bug List";
+ Runnable browserSetFunc = () -> {
+ testLog.append("Setting Browser url to:" + url);
+ boolean opSuccess = browser.setUrl(
+ url, "bug_severity=enhancement&bug_status=NEW&email1=rgrunber&emailassigned_to1=1&emailtype1=substring",
+ null);
+ assertTrue("Expecting setUrl() to return true", opSuccess);
+ };
+ validateTitleChanged(expectedTitle, browserSetFunc);
+ // Even a successfull empty query returns about 10000 chars of HTML
+ int numChars = browser.getText().length();
+ assertTrue("Response data contained " + numChars + " chars.", numChars > 10000);
+}
+
private void validateTitleChanged(String expectedTitle, Runnable browserSetFunc) {
final AtomicReference<String> actualTitle = new AtomicReference<>("");
browser.addTitleListener(event -> {

Back to the top