mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 15:12:51 +08:00
Add back a test that url (and errorUrl) are not settable via Intent extras
This commit is contained in:
parent
c3267def97
commit
9baa27508a
@ -37,14 +37,11 @@ public class BaseCordovaIntegrationTest extends ActivityInstrumentationTestCase2
|
|||||||
super(MainTestActivity.class);
|
super(MainTestActivity.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setUpWithStartUrl(String url) {
|
protected void setUpWithStartUrl(String url, String... prefsAndValues) {
|
||||||
setUpWithStartUrl(url, null, null);
|
|
||||||
}
|
|
||||||
protected void setUpWithStartUrl(String url, String prefKey, String prefValue) {
|
|
||||||
Intent intent = new Intent(getInstrumentation().getContext(), MainTestActivity.class);
|
Intent intent = new Intent(getInstrumentation().getContext(), MainTestActivity.class);
|
||||||
intent.putExtra("testStartUrl", url);
|
intent.putExtra("testStartUrl", url);
|
||||||
if (prefKey != null) {
|
for (int i = 0; i < prefsAndValues.length; i += 2) {
|
||||||
intent.putExtra(prefKey, prefValue);
|
intent.putExtra(prefsAndValues[i], prefsAndValues[i + 1]);
|
||||||
}
|
}
|
||||||
setActivityIntent(intent);
|
setActivityIntent(intent);
|
||||||
testActivity = getActivity();
|
testActivity = getActivity();
|
||||||
|
@ -24,10 +24,12 @@ package org.apache.cordova.test;
|
|||||||
public class ErrorUrlTest extends BaseCordovaIntegrationTest {
|
public class ErrorUrlTest extends BaseCordovaIntegrationTest {
|
||||||
private static final String START_URL = "file:///android_asset/www/htmlnotfound/index.html";
|
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 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 {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
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 {
|
public void testUrl() throws Throwable {
|
||||||
|
Loading…
Reference in New Issue
Block a user