diff --git a/test/androidTest/src/org/apache/cordova/test/HtmlNotFoundTest.java b/test/androidTest/src/org/apache/cordova/test/HtmlNotFoundTest.java index 235e0afa..3f92919f 100644 --- a/test/androidTest/src/org/apache/cordova/test/HtmlNotFoundTest.java +++ b/test/androidTest/src/org/apache/cordova/test/HtmlNotFoundTest.java @@ -30,11 +30,17 @@ public class HtmlNotFoundTest extends BaseCordovaIntegrationTest { } public void testUrl() throws Throwable { - assertEquals(START_URL, testActivity.onPageFinishedUrl.take()); runTestOnUiThread(new Runnable() { public void run() { - assertFalse(START_URL.equals(testActivity.getCordovaWebView().getUrl())); + assertTrue(START_URL.equals(testActivity.getCordovaWebView().getUrl())); } }); + + //loading a not-found file causes an application error and displayError is called + //the test activity overrides displayError to add message to onPageFinishedUrl + String message = testActivity.onPageFinishedUrl.take(); + assertTrue(message.contains(START_URL)); + assertTrue(message.contains("ERR_FILE_NOT_FOUND")); } + } diff --git a/test/src/org/apache/cordova/test/BaseTestCordovaActivity.java b/test/src/org/apache/cordova/test/BaseTestCordovaActivity.java index 0a280362..0c50569b 100644 --- a/test/src/org/apache/cordova/test/BaseTestCordovaActivity.java +++ b/test/src/org/apache/cordova/test/BaseTestCordovaActivity.java @@ -47,4 +47,10 @@ public class BaseTestCordovaActivity extends CordovaActivity { return appView; } + // By default, displayError shows a dialog, but for tests we just add the message to the queue + @Override + public void displayError(String title, String message, String button, boolean exit) { + onPageFinishedUrl.add(message); + } + }