mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-01 02:12:58 +08:00
fix HtmlNotFoundTest so that it passes when file not found is handled correctly
This Closes #256
This commit is contained in:
parent
088140aca4
commit
2ac191fbb8
@ -30,11 +30,17 @@ public class HtmlNotFoundTest extends BaseCordovaIntegrationTest {
|
|||||||
}
|
}
|
||||||
public void testUrl() throws Throwable
|
public void testUrl() throws Throwable
|
||||||
{
|
{
|
||||||
assertEquals(START_URL, testActivity.onPageFinishedUrl.take());
|
|
||||||
runTestOnUiThread(new Runnable() {
|
runTestOnUiThread(new Runnable() {
|
||||||
public void run() {
|
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"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -47,4 +47,10 @@ public class BaseTestCordovaActivity extends CordovaActivity {
|
|||||||
return appView;
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user