Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRoland Grunberg2018-03-27 16:04:32 +0000
committerRoland Grunberg2018-03-27 17:45:09 +0000
commit5ef2d9520a5705bf1ba0faeb74ef5cffb1b9bcc7 (patch)
tree86a96972b10fa382034010bd76975498b57fe72d /tests
parentb72ec4ee4a25b3b62b1cea617c5fcc5fd2549359 (diff)
downloadeclipse.platform.swt-5ef2d9520a5705bf1ba0faeb74ef5cffb1b9bcc7.tar.gz
eclipse.platform.swt-5ef2d9520a5705bf1ba0faeb74ef5cffb1b9bcc7.tar.xz
eclipse.platform.swt-5ef2d9520a5705bf1ba0faeb74ef5cffb1b9bcc7.zip
Bug 527738: Fix test_setUrl_remote_with_post test.
Use ProgressListener to determine when POST request has completed. Change-Id: I6c2d0cfaffb22a69f93a681451b54fc1b1ee4f2e 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.java16
1 files changed, 13 insertions, 3 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 eee4c627de..5b90ad4a22 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
@@ -896,7 +896,6 @@ public void test_setUrl_remote_with_post() {
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(
@@ -904,8 +903,19 @@ public void test_setUrl_remote_with_post() {
null);
assertTrue("Expecting setUrl() to return true", opSuccess);
};
- validateTitleChanged(expectedTitle, browserSetFunc);
- // Even a successfull empty query returns about 10000 chars of HTML
+
+ final AtomicReference<Boolean> completed = new AtomicReference<>(new Boolean(false));
+ browser.addProgressListener(completedAdapter(event -> {
+ testLog.append("ProgressListener fired");
+ completed.set(true);
+ }));
+ browserSetFunc.run();
+ shell.open();
+
+ boolean hasFinished = waitForPassCondition(() -> completed.get().booleanValue());
+ assertTrue("Test timed out. ProgressListener not fired " + testLog.toString(), hasFinished);
+
+ // Even a successful empty query returns about 10000 chars of HTML
int numChars = browser.getText().length();
assertTrue("Response data contained " + numChars + " chars.", numChars > 10000);
}

Back to the top