Skip to content

Commit

Permalink
Add some debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
HeikoKlare committed Dec 10, 2024
1 parent a92c14b commit 4c829a9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,7 @@ void setupBrowser(int hr, long pv) {
error(SWT.ERROR_THREAD_INVALID_ACCESS, hr);
break;
default:
System.err.println("WebView instantiation failed with result: " + hr);
containingEnvironment.instances().remove(this);
error(SWT.ERROR_NO_HANDLES, hr);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -735,14 +735,16 @@ public void changed(LocationEvent event) {

@Test
public void test_LocationListener_LocationListener_ordered_changing () {
List<String> locations = new ArrayList<>();
browser.addLocationListener(changingAdapter(event -> locations.add(event.location)));
List<String> locations = Collections.synchronizedList(new ArrayList<>());
browser.addLocationListener(changingAdapter(event -> {
locations.add(event.location);
}));
shell.open();
browser.setText("You should not see this message.");
String url = getValidUrl();
browser.setUrl(url);
waitForPassCondition(() -> locations.size() == 2);
assertTrue("Change of locations do not fire in order.", locations.get(0).equals("about:blank") && locations.get(1).contains("testWebsiteWithTitle.html"));
assertTrue("Change of locations do not fire in order: " + locations.toString(), waitForPassCondition(() -> locations.size() == 2));
assertTrue("Change of locations do not fire in order", locations.get(0).equals("about:blank") && locations.get(1).contains("testWebsiteWithTitle.html"));
}

private String getValidUrl() {
Expand Down Expand Up @@ -1942,6 +1944,7 @@ public void test_evaluate_null() {
// Boolen only used as dummy placeholder so the object is not null.
final AtomicReference<Object> returnValue = new AtomicReference<>(true);
browser.addProgressListener(completedAdapter(event -> {
returnValue.set(false);
Object evalResult = browser.evaluate("return null");
returnValue.set(evalResult);
if (debug_verbose_output)
Expand All @@ -1951,7 +1954,7 @@ public void test_evaluate_null() {
browser.setText("<html><body>HelloWorld</body></html>");
shell.open();
boolean passed = waitForPassCondition(() -> returnValue.get() == null);
assertTrue("Evaluate did not return a null. Timed out.", passed);
assertTrue("Evaluate did not return a null (current value: " + returnValue.get() + "). Timed out.", passed);
}

/**
Expand Down

0 comments on commit 4c829a9

Please sign in to comment.