updating existing test code

This commit is contained in:
Joe Bowser 2015-05-13 11:55:44 -07:00
parent 44aa7464e1
commit b5a58e6ca0
4 changed files with 3 additions and 11 deletions

View File

@ -61,13 +61,6 @@ public class CordovaPreferences {
String value = prefs.get(name); String value = prefs.get(name);
if (value != null) { if (value != null) {
return Boolean.parseBoolean(value); 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; return defaultValue;
} }

View File

@ -24,7 +24,7 @@ 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/index.html"; private static final String INVALID_URL = "file:///android_asset/www/invalid.html";
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp(); super.setUp();

View File

@ -31,10 +31,9 @@ public class HtmlNotFoundTest extends BaseCordovaIntegrationTest {
public void testUrl() throws Throwable public void testUrl() throws Throwable
{ {
assertEquals(START_URL, testActivity.onPageFinishedUrl.take()); 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() { runTestOnUiThread(new Runnable() {
public void run() { public void run() {
assertEquals(START_URL, testActivity.getCordovaWebView().getUrl()); assertFalse(START_URL.equals(testActivity.getCordovaWebView().getUrl()));
} }
}); });
} }

View File

@ -36,7 +36,7 @@ public class MainTestActivity extends BaseTestCordovaActivity {
@Override protected void loadConfig() { @Override protected void loadConfig() {
super.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"); String errorUrl = getIntent().getStringExtra("testErrorUrl");
if (errorUrl != null) { if (errorUrl != null) {
preferences.set("errorUrl", errorUrl); preferences.set("errorUrl", errorUrl);