mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-20 23:56:20 +08:00
updating existing test code
This commit is contained in:
parent
44aa7464e1
commit
b5a58e6ca0
@ -61,13 +61,6 @@ public class CordovaPreferences {
|
||||
String value = prefs.get(name);
|
||||
if (value != null) {
|
||||
return Boolean.parseBoolean(value);
|
||||
} else if (preferencesBundleExtras != null) {
|
||||
Object bundleValue = preferencesBundleExtras.get(name);
|
||||
if (bundleValue instanceof String) {
|
||||
return "true".equals(bundleValue);
|
||||
}
|
||||
// Gives a nice warning if type is wrong.
|
||||
return preferencesBundleExtras.getBoolean(name, defaultValue);
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ 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/index.html";
|
||||
private static final String INVALID_URL = "file:///android_asset/www/invalid.html";
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
@ -31,10 +31,9 @@ public class HtmlNotFoundTest extends BaseCordovaIntegrationTest {
|
||||
public void testUrl() throws Throwable
|
||||
{
|
||||
assertEquals(START_URL, testActivity.onPageFinishedUrl.take());
|
||||
// TODO: Should this be null? Or some other way to indicate it didn't actually load?
|
||||
runTestOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
assertEquals(START_URL, testActivity.getCordovaWebView().getUrl());
|
||||
assertFalse(START_URL.equals(testActivity.getCordovaWebView().getUrl()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public class MainTestActivity extends BaseTestCordovaActivity {
|
||||
|
||||
@Override protected void loadConfig() {
|
||||
super.loadConfig();
|
||||
// Need to set this explicitly in prefs since it's not settable via bundle extras (for security reasons).
|
||||
// Need to set this explicitly in prefs since it's not settable via bundle extras.
|
||||
String errorUrl = getIntent().getStringExtra("testErrorUrl");
|
||||
if (errorUrl != null) {
|
||||
preferences.set("errorUrl", errorUrl);
|
||||
|
Loading…
Reference in New Issue
Block a user