Add back a test that url (and errorUrl) are not settable via Intent extras

This commit is contained in:
Andrew Grieve 2015-02-12 15:03:44 -05:00
parent c3267def97
commit 9baa27508a
2 changed files with 6 additions and 7 deletions

View File

@ -37,14 +37,11 @@ public class BaseCordovaIntegrationTest extends ActivityInstrumentationTestCase2
super(MainTestActivity.class);
}
protected void setUpWithStartUrl(String url) {
setUpWithStartUrl(url, null, null);
}
protected void setUpWithStartUrl(String url, String prefKey, String prefValue) {
protected void setUpWithStartUrl(String url, String... prefsAndValues) {
Intent intent = new Intent(getInstrumentation().getContext(), MainTestActivity.class);
intent.putExtra("testStartUrl", url);
if (prefKey != null) {
intent.putExtra(prefKey, prefValue);
for (int i = 0; i < prefsAndValues.length; i += 2) {
intent.putExtra(prefsAndValues[i], prefsAndValues[i + 1]);
}
setActivityIntent(intent);
testActivity = getActivity();

View File

@ -24,10 +24,12 @@ package org.apache.cordova.test;
public class ErrorUrlTest extends BaseCordovaIntegrationTest {
private static final String START_URL = "file:///android_asset/www/htmlnotfound/index.html";
private static final String ERROR_URL = "file:///android_asset/www/htmlnotfound/error.html";
private static final String INVALID_URL = "file:///android_asset/www/htmlnotfound/invalid.html";
protected void setUp() throws Exception {
super.setUp();
setUpWithStartUrl(START_URL, "testErrorUrl", ERROR_URL);
// INVALID_URL tests that errorUrl and url are *not* settable via the intent.
setUpWithStartUrl(START_URL, "testErrorUrl", ERROR_URL, "errorurl", INVALID_URL, "url", INVALID_URL);
}
public void testUrl() throws Throwable {