fix HtmlNotFoundTest so that it passes when file not found is handled correctly

This Closes #256
This commit is contained in:
Tony Homer 2016-01-29 21:28:07 -05:00 committed by Carlos Santana
parent 088140aca4
commit 2ac191fbb8
2 changed files with 14 additions and 2 deletions

View File

@ -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"));
}
}

View File

@ -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);
}
}