summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkosiba@chromium.org <mkosiba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-25 15:37:45 +0000
committermkosiba@chromium.org <mkosiba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-25 15:37:45 +0000
commit8c56afd1dc94d4877110ab7adc136ab69d466467 (patch)
tree898eeaaa1f62884011cd6208a7a0257fdb19e1ef
parent4acc18b555e36d72ac556f5b96735059b23a2650 (diff)
downloadchromium_src-8c56afd1dc94d4877110ab7adc136ab69d466467.zip
chromium_src-8c56afd1dc94d4877110ab7adc136ab69d466467.tar.gz
chromium_src-8c56afd1dc94d4877110ab7adc136ab69d466467.tar.bz2
[android_webview] Build test code against the shell APK.
This change is to fix resource-related issues with the current approach. We can't include resources in the test_java target to share them between the shell and test apks, so we need one apk to contain the shell and run tests against. To achieve this we apply the same trick as testshell does and build the test code against the .jar created as a side-effect of building the shell apk target. This change completely removes the test_apk target. BUG=None TEST=AndroidWebViewTests TBR=bulach@chromium.org Review URL: https://chromiumcodereview.appspot.com/12609013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@190404 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--android_webview/android_webview.gyp24
-rw-r--r--android_webview/android_webview_tests.gypi80
-rw-r--r--android_webview/java/AndroidManifest.xml27
-rw-r--r--android_webview/javatests/AndroidManifest.xml (renamed from android_webview/test_apk/AndroidManifest.xml)2
-rw-r--r--android_webview/javatests/res/drawable/resource_icon.pngbin12887 -> 0 bytes
-rw-r--r--android_webview/javatests/res/raw/resource_icon.pngbin12887 -> 0 bytes
-rw-r--r--android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFullScreenVideoTest.java3
-rw-r--r--android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientGetVideoLoadingProgressViewTest.java5
-rw-r--r--android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldInterceptRequestTest.java43
-rw-r--r--android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java76
-rw-r--r--android_webview/javatests/src/org/chromium/android_webview/test/ClientOnReceivedErrorTest.java59
-rw-r--r--android_webview/javatests/src/org/chromium/android_webview/test/LoadDataWithBaseUrlTest.java2
-rw-r--r--android_webview/shell_apk/AndroidManifest.xml27
-rw-r--r--android_webview/test/shell/AndroidManifest.xml35
-rw-r--r--android_webview/test/shell/DEPS (renamed from android_webview/shell_apk/DEPS)0
-rw-r--r--android_webview/test/shell/assets/asset_file.html (renamed from android_webview/test_apk/assets/asset_file.html)0
-rw-r--r--android_webview/test/shell/assets/full_screen_video_test.html (renamed from android_webview/test_apk/assets/full_screen_video_test.html)0
-rw-r--r--android_webview/test/shell/res/layout/testshell_activity.xml (renamed from android_webview/shell_apk/res/layout/testshell_activity.xml)0
-rw-r--r--android_webview/test/shell/res/raw/blank_html.html (renamed from android_webview/javatests/res/raw/blank_html.html)0
-rw-r--r--android_webview/test/shell/res/raw/resource_file.html (renamed from android_webview/javatests/res/raw/resource_file.html)0
-rw-r--r--android_webview/test/shell/res/values/strings.xml (renamed from android_webview/javatests/res/values/strings.xml)0
-rw-r--r--android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java (renamed from android_webview/shell_apk/src/org/chromium/android_webview/shell/AndroidWebViewTestShellActivity.java)4
-rw-r--r--android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellApplication.java (renamed from android_webview/shell_apk/src/org/chromium/android_webview/shell/AndroidWebViewTestShellApplication.java)5
-rw-r--r--android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellResourceProvider.java (renamed from android_webview/javatests/src/org/chromium/android_webview/test/AwTestResourceProvider.java)4
-rw-r--r--android_webview/test/shell/src/org/chromium/android_webview/test/AndroidWebViewTestRunnerActivity.java (renamed from android_webview/javatests/src/org/chromium/android_webview/test/AndroidWebViewTestRunnerActivity.java)0
-rw-r--r--android_webview/test/shell/src/org/chromium/android_webview/test/AwTestContainerView.java (renamed from android_webview/javatests/src/org/chromium/android_webview/test/AwTestContainerView.java)0
-rw-r--r--android_webview/test/shell/src/org/chromium/android_webview/test/NullContentsClient.java (renamed from android_webview/javatests/src/org/chromium/android_webview/test/NullContentsClient.java)0
-rw-r--r--android_webview/test/shell/src/org/chromium/android_webview/test/TestContentProvider.java (renamed from android_webview/javatests/src/org/chromium/android_webview/test/TestContentProvider.java)0
-rw-r--r--android_webview/test_apk/DEPS3
-rw-r--r--android_webview/test_apk/assets/asset_icon.pngbin12887 -> 0 bytes
-rw-r--r--android_webview/test_apk/src/org/chromium/android_webview/test/AndroidWebViewTestRunnerApplication.java33
-rwxr-xr-xbuild/android/buildbot/bb_device_steps.py2
-rwxr-xr-xbuild/landmines.py1
33 files changed, 134 insertions, 301 deletions
diff --git a/android_webview/android_webview.gyp b/android_webview/android_webview.gyp
index edc6c05..41f9898 100644
--- a/android_webview/android_webview.gyp
+++ b/android_webview/android_webview.gyp
@@ -193,29 +193,5 @@
},
'includes': [ '../build/java.gypi' ],
},
- {
- 'target_name': 'android_webview_apk',
- 'type': 'none',
- 'dependencies': [
- '../base/base.gyp:base_java',
- '../components/components.gyp:navigation_interception_java',
- '../components/components.gyp:web_contents_delegate_android_java',
- '../content/content.gyp:content_java',
- '../media/media.gyp:media_java',
- '../net/net.gyp:net_java',
- '../ui/ui.gyp:ui_java',
- 'libwebviewchromium',
- ],
- 'variables': {
- 'apk_name': 'AndroidWebView',
- 'manifest_package_name': 'org.chromium.android_webview',
- 'java_in_dir': '../android_webview/java',
- 'native_libs_paths': ['<(SHARED_LIB_DIR)/libwebviewchromium.so'],
- 'additional_input_paths': [
- '<(PRODUCT_DIR)/android_webview_apk/assets/webviewchromium.pak',
- ],
- },
- 'includes': [ '../build/java_apk.gypi' ],
- },
],
}
diff --git a/android_webview/android_webview_tests.gypi b/android_webview/android_webview_tests.gypi
index 998aba3..1a9be7f 100644
--- a/android_webview/android_webview_tests.gypi
+++ b/android_webview/android_webview_tests.gypi
@@ -4,42 +4,28 @@
{
'targets': [
{
- 'target_name': 'android_webview_test_java',
+ 'target_name': 'android_webview_apk',
'type': 'none',
'dependencies': [
- '../base/base.gyp:base_java_test_support',
- '../content/content.gyp:content_java_test_support',
- '../net/net.gyp:net_java_test_support',
- 'android_webview_java',
'libwebviewchromium',
+ 'android_webview_java',
+ 'android_webview_pak',
],
'variables': {
- 'java_in_dir': '../android_webview/javatests',
- 'has_java_resources': 1,
- 'R_package': 'org.chromium.android_webview.test',
- 'R_package_relpath': 'org/chromium/android_webview/test',
- },
- 'includes': [ '../build/java.gypi' ],
- },
- {
- 'target_name': 'android_webview_test_apk',
- 'type': 'none',
- 'dependencies': [
- 'android_webview_test_java',
- ],
- 'variables': {
- 'apk_name': 'AndroidWebViewTest',
- 'java_in_dir': '../android_webview/test_apk',
- 'is_test_apk': 0, # We want resources from android_webview_test_java.
+ 'apk_name': 'AndroidWebView',
+ 'java_in_dir': '../android_webview/test/shell',
+ 'native_libs_paths': ['<(SHARED_LIB_DIR)/libwebviewchromium.so'],
+ 'resource_dir': 'res',
'additional_input_paths': [
- '<(PRODUCT_DIR)/android_webview_test_apk/assets/asset_file.html',
- '<(PRODUCT_DIR)/android_webview_test_apk/assets/asset_icon.png',
- '<(PRODUCT_DIR)/android_webview_test_apk/assets/full_screen_video_test.html',
+ '<(PRODUCT_DIR)/android_webview_apk/assets/webviewchromium.pak',
+ '<(PRODUCT_DIR)/android_webview_apk/assets/asset_file.html',
+ '<(PRODUCT_DIR)/android_webview_apk/assets/asset_icon.png',
+ '<(PRODUCT_DIR)/android_webview_apk/assets/full_screen_video_test.html',
],
},
'copies': [
{
- 'destination': '<(PRODUCT_DIR)/android_webview_test_apk/assets',
+ 'destination': '<(PRODUCT_DIR)/android_webview_apk/assets',
'files': [
'<(java_in_dir)/assets/asset_file.html',
'<(java_in_dir)/assets/asset_icon.png',
@@ -50,21 +36,41 @@
'includes': [ '../build/java_apk.gypi' ],
},
{
- 'target_name': 'android_webview_shell_apk',
+ # android_webview_apk creates a .jar as a side effect. Any java
+ # targets that need that .jar in their classpath should depend on this
+ # target. For more details see the chromium_testshell_java target.
+ 'target_name': 'android_webview_apk_java',
'type': 'none',
'dependencies': [
- 'android_webview_test_java',
- 'android_webview_pak',
+ 'android_webview_apk',
+ ],
+ 'all_dependent_settings': {
+ 'variables': {
+ 'input_jars_paths': ['>(apk_output_jar_path)'],
+ },
+ },
+ 'actions': [
+ {
+ 'action_name': 'fake_generate_jar',
+ 'inputs': [],
+ 'outputs': ['>(apk_output_jar_path)'],
+ 'action': [],
+ },
+ ],
+ },
+ {
+ 'target_name': 'android_webview_test_apk',
+ 'type': 'none',
+ 'dependencies': [
+ '../base/base.gyp:base_java_test_support',
+ '../content/content.gyp:content_java_test_support',
+ '../net/net.gyp:net_java_test_support',
+ 'android_webview_apk_java',
],
'variables': {
- 'apk_name': 'AndroidWebViewShell',
- 'java_in_dir': '../android_webview/shell_apk',
- 'native_libs_paths': ['<(SHARED_LIB_DIR)/libwebviewchromium.so'],
- 'resource_dir': 'res',
- 'asset_location': '<(ant_build_out)/android_webview_apk/assets',
- 'additional_input_paths': [
- '<(PRODUCT_DIR)/android_webview_apk/assets/webviewchromium.pak',
- ],
+ 'apk_name': 'AndroidWebViewTest',
+ 'java_in_dir': '../android_webview/javatests',
+ 'is_test_apk': 1,
},
'includes': [ '../build/java_apk.gypi' ],
},
diff --git a/android_webview/java/AndroidManifest.xml b/android_webview/java/AndroidManifest.xml
deleted file mode 100644
index c5190ee..0000000
--- a/android_webview/java/AndroidManifest.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!-- Copyright (c) 2012 The Chromium Authors. All rights reserved.
-
- Use of this source code is governed by a BSD-style license that can be
- found in the LICENSE file.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="org.chromium.android_webview">
-
-<application android:name="org.chromium.android_webview.test.AndroidWebViewTestRunnerApplication"
- android:label="AndroidWebViewTestRunnerApplication">
- <activity android:name="org.chromium.android_webview.test.AndroidWebViewTestRunnerActivity"
- android:label="AndroidWebViewTestRunnerActivity">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
- </intent-filter>
- </activity>
-</application>
-
- <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="17" />
- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
- <uses-permission android:name="android.permission.INTERNET"/>
- <uses-permission android:name="android.permission.WAKE_LOCK"/>
-</manifest>
diff --git a/android_webview/test_apk/AndroidManifest.xml b/android_webview/javatests/AndroidManifest.xml
index 3062283..e7d3eff 100644
--- a/android_webview/test_apk/AndroidManifest.xml
+++ b/android_webview/javatests/AndroidManifest.xml
@@ -15,7 +15,7 @@
<!-- TODO(joth): Change minSdkVersion to 16 when crbug/161864 lands. -->
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="17" />
<instrumentation android:name="android.test.InstrumentationTestRunner"
- android:targetPackage="org.chromium.android_webview"
+ android:targetPackage="org.chromium.android_webview.shell"
android:label="Tests for org.chromium.android_webview"/>
<uses-permission android:name="android.permission.RUN_INSTRUMENTATION" />
<uses-permission android:name="android.permission.INJECT_EVENTS" />
diff --git a/android_webview/javatests/res/drawable/resource_icon.png b/android_webview/javatests/res/drawable/resource_icon.png
deleted file mode 100644
index f381f86..0000000
--- a/android_webview/javatests/res/drawable/resource_icon.png
+++ /dev/null
Binary files differ
diff --git a/android_webview/javatests/res/raw/resource_icon.png b/android_webview/javatests/res/raw/resource_icon.png
deleted file mode 100644
index f381f86..0000000
--- a/android_webview/javatests/res/raw/resource_icon.png
+++ /dev/null
Binary files differ
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFullScreenVideoTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFullScreenVideoTest.java
index 3e5d629..c9da806 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFullScreenVideoTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFullScreenVideoTest.java
@@ -29,7 +29,8 @@ public class AwContentsClientFullScreenVideoTest extends AndroidWebViewTestBase
AwTestContainerView testContainerView =
createAwTestContainerViewOnMainSync(contentsClient);
enableJavaScriptOnUiThread(testContainerView.getAwContents());
- VideoTestWebServer webServer = new VideoTestWebServer(getInstrumentation().getContext());
+ VideoTestWebServer webServer = new VideoTestWebServer(
+ getInstrumentation().getTargetContext());
try {
loadUrlSync(testContainerView.getAwContents(),
contentsClient.getOnPageFinishedHelper(),
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientGetVideoLoadingProgressViewTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientGetVideoLoadingProgressViewTest.java
index 35d5ddd..18b7a2e 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientGetVideoLoadingProgressViewTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientGetVideoLoadingProgressViewTest.java
@@ -56,7 +56,7 @@ public class AwContentsClientGetVideoLoadingProgressViewTest extends AndroidWebV
new FullScreenVideoTestAwContentsClient(getActivity()) {
@Override
protected View getVideoLoadingProgressView() {
- View view = new View(getInstrumentation().getContext());
+ View view = new View(getInstrumentation().getTargetContext());
view.addOnAttachStateChangeListener(
AwContentsClientGetVideoLoadingProgressViewTest.this);
return view;
@@ -66,7 +66,8 @@ public class AwContentsClientGetVideoLoadingProgressViewTest extends AndroidWebV
createAwTestContainerViewOnMainSync(contentsClient);
final AwContents awContents = testContainerView.getAwContents();
enableJavaScriptOnUiThread(awContents);
- VideoTestWebServer webServer = new VideoTestWebServer(getInstrumentation().getContext());
+ VideoTestWebServer webServer = new VideoTestWebServer(
+ getInstrumentation().getTargetContext());
try {
loadUrlSync(awContents, contentsClient.getOnPageFinishedHelper(),
webServer.getFullScreenVideoTestURL());
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldInterceptRequestTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldInterceptRequestTest.java
index 4252adf..0c3990a 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldInterceptRequestTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldInterceptRequestTest.java
@@ -417,63 +417,28 @@ public class AwContentsClientShouldInterceptRequestTest extends AndroidWebViewTe
mContentsClient.getOnPageFinishedHelper().getCallCount());
}
- /**
- * Configure the browser to load resources from the test harness instead of the browser
- * application.
- */
- private void useTestResourceContext() {
- AndroidProtocolHandler.setResourceContextForTesting(getInstrumentation().getContext());
- }
-
- /**
- * Configure the browser to load resources from the browser application.
- */
- private void resetResourceContext() {
- AndroidProtocolHandler.setResourceContextForTesting(null);
- }
-
@SmallTest
@Feature({"AndroidWebView"})
public void testNotCalledForExistingResource() throws Throwable {
- try {
- useTestResourceContext();
- notCalledForUrlTemplate("file:///android_res/raw/resource_file.html");
- } finally {
- resetResourceContext();
- }
+ notCalledForUrlTemplate("file:///android_res/raw/resource_file.html");
}
@SmallTest
@Feature({"AndroidWebView"})
public void testCalledForNonexistentResource() throws Throwable {
- try {
- useTestResourceContext();
- calledForUrlTemplate("file:///android_res/raw/no_file.html");
- } finally {
- resetResourceContext();
- }
+ calledForUrlTemplate("file:///android_res/raw/no_file.html");
}
@SmallTest
@Feature({"AndroidWebView"})
public void testNotCalledForExistingAsset() throws Throwable {
- try {
- useTestResourceContext();
- notCalledForUrlTemplate("file:///android_asset/asset_file.html");
- } finally {
- resetResourceContext();
- }
+ notCalledForUrlTemplate("file:///android_asset/asset_file.html");
}
@SmallTest
@Feature({"AndroidWebView"})
public void testCalledForNonexistentAsset() throws Throwable {
- try {
- useTestResourceContext();
- calledForUrlTemplate("file:///android_res/raw/no_file.html");
- } finally {
- resetResourceContext();
- }
+ calledForUrlTemplate("file:///android_res/raw/no_file.html");
}
@SmallTest
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java
index c868d2d..a9f4cdd 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java
@@ -1946,15 +1946,10 @@ public class AwSettingsTest extends AndroidWebViewTestBase {
final AwTestContainerView testContainerView =
createAwTestContainerViewOnMainSync(contentClient);
final AwContents awContents = testContainerView.getAwContents();
- try {
- useTestResourceContext();
- loadUrlSync(awContents,
- contentClient.getOnPageFinishedHelper(),
- "file:///android_asset/asset_file.html");
- assertEquals(expectedTitle, getTitleOnUiThread(awContents));
- } finally {
- resetResourceContext();
- }
+ loadUrlSync(awContents,
+ contentClient.getOnPageFinishedHelper(),
+ "file:///android_asset/asset_file.html");
+ assertEquals(expectedTitle, getTitleOnUiThread(awContents));
}
// Test a resource URL (file:///android_res/).
@@ -1968,15 +1963,10 @@ public class AwSettingsTest extends AndroidWebViewTestBase {
final AwTestContainerView testContainerView =
createAwTestContainerViewOnMainSync(contentClient);
final AwContents awContents = testContainerView.getAwContents();
- try {
- useTestResourceContext();
- loadUrlSync(awContents,
- contentClient.getOnPageFinishedHelper(),
- "file:///android_res/raw/resource_file.html");
- assertEquals(expectedTitle, getTitleOnUiThread(awContents));
- } finally {
- resetResourceContext();
- }
+ loadUrlSync(awContents,
+ contentClient.getOnPageFinishedHelper(),
+ "file:///android_res/raw/resource_file.html");
+ assertEquals(expectedTitle, getTitleOnUiThread(awContents));
}
// Test that the file URL access toggle does not affect asset URLs.
@@ -1991,16 +1981,11 @@ public class AwSettingsTest extends AndroidWebViewTestBase {
createAwTestContainerViewOnMainSync(contentClient);
final AwContents awContents = testContainerView.getAwContents();
final AwSettings settings = getAwSettingsOnUiThread(awContents);
- try {
- useTestResourceContext();
- settings.setAllowFileAccess(false);
- loadUrlSync(awContents,
- contentClient.getOnPageFinishedHelper(),
- "file:///android_asset/asset_file.html");
- assertEquals(expectedTitle, getTitleOnUiThread(awContents));
- } finally {
- resetResourceContext();
- }
+ settings.setAllowFileAccess(false);
+ loadUrlSync(awContents,
+ contentClient.getOnPageFinishedHelper(),
+ "file:///android_asset/asset_file.html");
+ assertEquals(expectedTitle, getTitleOnUiThread(awContents));
}
// Test that the file URL access toggle does not affect resource URLs.
@@ -2015,16 +2000,11 @@ public class AwSettingsTest extends AndroidWebViewTestBase {
createAwTestContainerViewOnMainSync(contentClient);
final AwContents awContents = testContainerView.getAwContents();
final AwSettings settings = getAwSettingsOnUiThread(awContents);
- try {
- useTestResourceContext();
- settings.setAllowFileAccess(false);
- loadUrlSync(awContents,
- contentClient.getOnPageFinishedHelper(),
- "file:///android_res/raw/resource_file.html");
- assertEquals(expectedTitle, getTitleOnUiThread(awContents));
- } finally {
- resetResourceContext();
- }
+ settings.setAllowFileAccess(false);
+ loadUrlSync(awContents,
+ contentClient.getOnPageFinishedHelper(),
+ "file:///android_res/raw/resource_file.html");
+ assertEquals(expectedTitle, getTitleOnUiThread(awContents));
}
@SmallTest
@@ -2557,7 +2537,7 @@ public class AwSettingsTest extends AndroidWebViewTestBase {
observer.register(awContents.getContentViewCore(), "javaObserver");
}
});
- VideoTestWebServer webServer = new VideoTestWebServer(getInstrumentation().getContext());
+ VideoTestWebServer webServer = new VideoTestWebServer(getActivity());
try {
String data = "<html><head><script>" +
"addEventListener('DOMContentLoaded', function() { " +
@@ -2618,7 +2598,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase {
contentSettings.setDefaultVideoPosterURL(DEFAULT_VIDEO_POSTER_URL);
}
});
- VideoTestWebServer webServer = new VideoTestWebServer(getInstrumentation().getContext());
+ VideoTestWebServer webServer = new VideoTestWebServer(
+ getInstrumentation().getTargetContext());
try {
String data = "<html><head><body>" +
"<video id='video' control src='" +
@@ -2742,21 +2723,6 @@ public class AwSettingsTest extends AndroidWebViewTestBase {
}
/**
- * Configure the browser to load resources from the test harness instead of the browser
- * application.
- */
- private void useTestResourceContext() {
- AndroidProtocolHandler.setResourceContextForTesting(getInstrumentation().getContext());
- }
-
- /**
- * Configure the browser to load resources from the browser application.
- */
- private void resetResourceContext() {
- AndroidProtocolHandler.setResourceContextForTesting(null);
- }
-
- /**
* Returns pure page scale.
*/
private float getScaleOnUiThread(final AwContents awContents) throws Throwable {
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnReceivedErrorTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnReceivedErrorTest.java
index bb10136..38b3275 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnReceivedErrorTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnReceivedErrorTest.java
@@ -92,20 +92,15 @@ public class ClientOnReceivedErrorTest extends AndroidWebViewTestBase {
public void testNonExistentAssetUrl() throws Throwable {
TestCallbackHelperContainer.OnReceivedErrorHelper onReceivedErrorHelper =
mContentsClient.getOnReceivedErrorHelper();
- try {
- final String url = "file:///android_asset/does_not_exist.html";
- int onReceivedErrorCallCount = onReceivedErrorHelper.getCallCount();
- useTestResourceContext();
- loadUrlAsync(mAwContents, url);
-
- onReceivedErrorHelper.waitForCallback(onReceivedErrorCallCount);
- assertEquals(ErrorCodeConversionHelper.ERROR_UNKNOWN,
- onReceivedErrorHelper.getErrorCode());
- assertEquals(url, onReceivedErrorHelper.getFailingUrl());
- assertNotNull(onReceivedErrorHelper.getDescription());
- } finally {
- resetResourceContext();
- }
+ final String url = "file:///android_asset/does_not_exist.html";
+ int onReceivedErrorCallCount = onReceivedErrorHelper.getCallCount();
+ loadUrlAsync(mAwContents, url);
+
+ onReceivedErrorHelper.waitForCallback(onReceivedErrorCallCount);
+ assertEquals(ErrorCodeConversionHelper.ERROR_UNKNOWN,
+ onReceivedErrorHelper.getErrorCode());
+ assertEquals(url, onReceivedErrorHelper.getFailingUrl());
+ assertNotNull(onReceivedErrorHelper.getDescription());
}
@MediumTest
@@ -113,34 +108,14 @@ public class ClientOnReceivedErrorTest extends AndroidWebViewTestBase {
public void testNonExistentResourceUrl() throws Throwable {
TestCallbackHelperContainer.OnReceivedErrorHelper onReceivedErrorHelper =
mContentsClient.getOnReceivedErrorHelper();
- try {
- final String url = "file:///android_res/raw/does_not_exist.html";
- int onReceivedErrorCallCount = onReceivedErrorHelper.getCallCount();
- useTestResourceContext();
- loadUrlAsync(mAwContents, url);
-
- onReceivedErrorHelper.waitForCallback(onReceivedErrorCallCount);
- assertEquals(ErrorCodeConversionHelper.ERROR_UNKNOWN,
- onReceivedErrorHelper.getErrorCode());
- assertEquals(url, onReceivedErrorHelper.getFailingUrl());
- assertNotNull(onReceivedErrorHelper.getDescription());
- } finally {
- resetResourceContext();
- }
- }
-
- /**
- * Configure the browser to load resources from the test harness instead of the browser
- * application.
- */
- private void useTestResourceContext() {
- AndroidProtocolHandler.setResourceContextForTesting(getInstrumentation().getContext());
- }
+ final String url = "file:///android_res/raw/does_not_exist.html";
+ int onReceivedErrorCallCount = onReceivedErrorHelper.getCallCount();
+ loadUrlAsync(mAwContents, url);
- /**
- * Configure the browser to load resources from the browser application.
- */
- private void resetResourceContext() {
- AndroidProtocolHandler.setResourceContextForTesting(null);
+ onReceivedErrorHelper.waitForCallback(onReceivedErrorCallCount);
+ assertEquals(ErrorCodeConversionHelper.ERROR_UNKNOWN,
+ onReceivedErrorHelper.getErrorCode());
+ assertEquals(url, onReceivedErrorHelper.getFailingUrl());
+ assertNotNull(onReceivedErrorHelper.getDescription());
}
}
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/LoadDataWithBaseUrlTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/LoadDataWithBaseUrlTest.java
index fd79a5d..d9263e4 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/LoadDataWithBaseUrlTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/LoadDataWithBaseUrlTest.java
@@ -302,7 +302,6 @@ public class LoadDataWithBaseUrlTest extends AndroidWebViewTestBase {
final String DATA_BASE_URL = "data:";
final String NON_DATA_BASE_URL = "http://example.com";
- AndroidProtocolHandler.setResourceContextForTesting(getInstrumentation().getContext());
mAwContents.getSettings().setAllowFileAccess(false);
String token = "" + System.currentTimeMillis();
// All access to file://, including android_asset and android_res is blocked
@@ -342,7 +341,6 @@ public class LoadDataWithBaseUrlTest extends AndroidWebViewTestBase {
"file://" + imagePath + "?" + token));
} finally {
if (!tempImage.delete()) throw new AssertionError();
- AndroidProtocolHandler.setResourceContextForTesting(null);
}
}
}
diff --git a/android_webview/shell_apk/AndroidManifest.xml b/android_webview/shell_apk/AndroidManifest.xml
deleted file mode 100644
index 61a3308..0000000
--- a/android_webview/shell_apk/AndroidManifest.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!-- Copyright 2013 The Chromium Authors. All rights reserved.
-
- Use of this source code is governed by a BSD-style license that can be
- found in the LICENSE file.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="org.chromium.android_webview.shell">
-
- <application android:name="org.chromium.android_webview.shell.AndroidWebViewTestShellApplication"
- android:label="AndroidWebViewTestShellApplication" android:hardwareAccelerated="false">
- <activity android:name="org.chromium.android_webview.shell.AndroidWebViewTestShellActivity"
- android:label="Android WebView Test Shell">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
-
- <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="17" />
- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
- <uses-permission android:name="android.permission.INTERNET"/>
- <uses-permission android:name="android.permission.WAKE_LOCK"/>
-</manifest>
diff --git a/android_webview/test/shell/AndroidManifest.xml b/android_webview/test/shell/AndroidManifest.xml
new file mode 100644
index 0000000..a8276cb
--- /dev/null
+++ b/android_webview/test/shell/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- Copyright 2013 The Chromium Authors. All rights reserved.
+
+ Use of this source code is governed by a BSD-style license that can be
+ found in the LICENSE file.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="org.chromium.android_webview.shell">
+
+ <application android:name="org.chromium.android_webview.shell.AwShellApplication"
+ android:label="AwShellApplication" android:hardwareAccelerated="false">
+ <activity android:name="org.chromium.android_webview.shell.AwShellActivity"
+ android:label="Android WebView Test Shell">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <activity android:name="org.chromium.android_webview.test.AndroidWebViewTestRunnerActivity"
+ android:label="AndroidWebViewTestRunnerActivity">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
+ </intent-filter>
+ </activity>
+ </application>
+
+ <!-- TODO(joth): Change minSdkVersion to 16 when crbug/161864 lands. -->
+ <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="17" />
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
+ <uses-permission android:name="android.permission.INTERNET"/>
+ <uses-permission android:name="android.permission.WAKE_LOCK"/>
+</manifest>
diff --git a/android_webview/shell_apk/DEPS b/android_webview/test/shell/DEPS
index 0d019e1..0d019e1 100644
--- a/android_webview/shell_apk/DEPS
+++ b/android_webview/test/shell/DEPS
diff --git a/android_webview/test_apk/assets/asset_file.html b/android_webview/test/shell/assets/asset_file.html
index 5008860..5008860 100644
--- a/android_webview/test_apk/assets/asset_file.html
+++ b/android_webview/test/shell/assets/asset_file.html
diff --git a/android_webview/test_apk/assets/full_screen_video_test.html b/android_webview/test/shell/assets/full_screen_video_test.html
index 466a8d4..466a8d4 100644
--- a/android_webview/test_apk/assets/full_screen_video_test.html
+++ b/android_webview/test/shell/assets/full_screen_video_test.html
diff --git a/android_webview/shell_apk/res/layout/testshell_activity.xml b/android_webview/test/shell/res/layout/testshell_activity.xml
index 0a997fa..0a997fa 100644
--- a/android_webview/shell_apk/res/layout/testshell_activity.xml
+++ b/android_webview/test/shell/res/layout/testshell_activity.xml
diff --git a/android_webview/javatests/res/raw/blank_html.html b/android_webview/test/shell/res/raw/blank_html.html
index 989fbfc..989fbfc 100644
--- a/android_webview/javatests/res/raw/blank_html.html
+++ b/android_webview/test/shell/res/raw/blank_html.html
diff --git a/android_webview/javatests/res/raw/resource_file.html b/android_webview/test/shell/res/raw/resource_file.html
index 0ef1c09..0ef1c09 100644
--- a/android_webview/javatests/res/raw/resource_file.html
+++ b/android_webview/test/shell/res/raw/resource_file.html
diff --git a/android_webview/javatests/res/values/strings.xml b/android_webview/test/shell/res/values/strings.xml
index 6b4e2ab..6b4e2ab 100644
--- a/android_webview/javatests/res/values/strings.xml
+++ b/android_webview/test/shell/res/values/strings.xml
diff --git a/android_webview/shell_apk/src/org/chromium/android_webview/shell/AndroidWebViewTestShellActivity.java b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java
index e1408e8..783ade5 100644
--- a/android_webview/shell_apk/src/org/chromium/android_webview/shell/AndroidWebViewTestShellActivity.java
+++ b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java
@@ -36,8 +36,8 @@ import org.chromium.content.browser.LoadUrlParams;
/*
* This is a lightweight activity for tests that only require WebView functionality.
*/
-public class AndroidWebViewTestShellActivity extends Activity {
- private final static String PREFERENCES_NAME = "AndroidWebViewTestShellPrefs";
+public class AwShellActivity extends Activity {
+ private final static String PREFERENCES_NAME = "AwShellPrefs";
private final static String INITIAL_URL = "about:blank";
private AwTestContainerView mAwTestContainerView;
private EditText mUrlTextView;
diff --git a/android_webview/shell_apk/src/org/chromium/android_webview/shell/AndroidWebViewTestShellApplication.java b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellApplication.java
index 44e64c2..585e9d9 100644
--- a/android_webview/shell_apk/src/org/chromium/android_webview/shell/AndroidWebViewTestShellApplication.java
+++ b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellApplication.java
@@ -8,11 +8,10 @@ import android.app.Application;
import android.content.Context;
import org.chromium.android_webview.AwBrowserProcess;
-import org.chromium.android_webview.test.AwTestResourceProvider;
import org.chromium.content.browser.ResourceExtractor;
import org.chromium.content.common.CommandLine;
-public class AndroidWebViewTestShellApplication extends Application {
+public class AwShellApplication extends Application {
/** The minimum set of .pak files the test runner needs. */
private static final String[] MANDATORY_PAKS = {
@@ -23,7 +22,7 @@ public class AndroidWebViewTestShellApplication extends Application {
public void onCreate() {
super.onCreate();
- AwTestResourceProvider.registerResources(this);
+ AwShellResourceProvider.registerResources(this);
CommandLine.initFromFile("/data/local/chrome-command-line");
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwTestResourceProvider.java b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellResourceProvider.java
index 0f515e5..704894d 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AwTestResourceProvider.java
+++ b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellResourceProvider.java
@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-package org.chromium.android_webview.test;
+package org.chromium.android_webview.shell;
import android.content.Context;
import org.chromium.android_webview.AwResource;
-public class AwTestResourceProvider {
+public class AwShellResourceProvider {
private static boolean sInitialized;
public static void registerResources(Context context) {
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AndroidWebViewTestRunnerActivity.java b/android_webview/test/shell/src/org/chromium/android_webview/test/AndroidWebViewTestRunnerActivity.java
index 5abf524..5abf524 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AndroidWebViewTestRunnerActivity.java
+++ b/android_webview/test/shell/src/org/chromium/android_webview/test/AndroidWebViewTestRunnerActivity.java
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwTestContainerView.java b/android_webview/test/shell/src/org/chromium/android_webview/test/AwTestContainerView.java
index bf36c9a..bf36c9a 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AwTestContainerView.java
+++ b/android_webview/test/shell/src/org/chromium/android_webview/test/AwTestContainerView.java
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/NullContentsClient.java b/android_webview/test/shell/src/org/chromium/android_webview/test/NullContentsClient.java
index c340073..c340073 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/NullContentsClient.java
+++ b/android_webview/test/shell/src/org/chromium/android_webview/test/NullContentsClient.java
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/TestContentProvider.java b/android_webview/test/shell/src/org/chromium/android_webview/test/TestContentProvider.java
index 87a08b7..87a08b7 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/TestContentProvider.java
+++ b/android_webview/test/shell/src/org/chromium/android_webview/test/TestContentProvider.java
diff --git a/android_webview/test_apk/DEPS b/android_webview/test_apk/DEPS
deleted file mode 100644
index 0d019e1..0000000
--- a/android_webview/test_apk/DEPS
+++ /dev/null
@@ -1,3 +0,0 @@
-include_rules = [
- "+content/public/android/java",
-]
diff --git a/android_webview/test_apk/assets/asset_icon.png b/android_webview/test_apk/assets/asset_icon.png
deleted file mode 100644
index f381f86..0000000
--- a/android_webview/test_apk/assets/asset_icon.png
+++ /dev/null
Binary files differ
diff --git a/android_webview/test_apk/src/org/chromium/android_webview/test/AndroidWebViewTestRunnerApplication.java b/android_webview/test_apk/src/org/chromium/android_webview/test/AndroidWebViewTestRunnerApplication.java
deleted file mode 100644
index e12feef..0000000
--- a/android_webview/test_apk/src/org/chromium/android_webview/test/AndroidWebViewTestRunnerApplication.java
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.android_webview.test;
-
-import android.app.Application;
-
-import org.chromium.android_webview.AwBrowserProcess;
-import org.chromium.content.browser.ResourceExtractor;
-import org.chromium.content.common.CommandLine;
-
-public class AndroidWebViewTestRunnerApplication extends Application {
-
- /** The minimum set of .pak files the test runner needs. */
- private static final String[] MANDATORY_PAKS = {
- "webviewchromium.pak", "en-US.pak"
- };
-
- @Override
- public void onCreate() {
- super.onCreate();
-
- AwTestResourceProvider.registerResources(this);
-
- CommandLine.initFromFile("/data/local/chrome-command-line");
-
- ResourceExtractor.setMandatoryPaksToExtract(MANDATORY_PAKS);
- ResourceExtractor.setExtractImplicitLocaleForTesting(false);
- AwBrowserProcess.loadLibrary();
- AwBrowserProcess.start(this);
- }
-}
diff --git a/build/android/buildbot/bb_device_steps.py b/build/android/buildbot/bb_device_steps.py
index 440c2eb..0f2afc6 100755
--- a/build/android/buildbot/bb_device_steps.py
+++ b/build/android/buildbot/bb_device_steps.py
@@ -53,7 +53,7 @@ INSTRUMENTATION_TESTS = dict((suite.name, suite) for suite in [
constants.CHROMIUM_TEST_SHELL_HOST_DRIVEN_DIR),
I_TEST('AndroidWebView',
'AndroidWebView.apk',
- 'org.chromium.android_webview',
+ 'org.chromium.android_webview.shell',
'AndroidWebViewTest',
'webview:android_webview/test/data/device_files',
None),
diff --git a/build/landmines.py b/build/landmines.py
index bc70f5d..fa2be1c 100755
--- a/build/landmines.py
+++ b/build/landmines.py
@@ -142,6 +142,7 @@ def get_landmines(target):
if platform() == 'android':
add('Fix findbugs errors on android trybots.')
add('Clobber: jar location moved in crrev.com/183639')
+ add('Clobber: resources moved around in crrev.com/12609013')
if platform() == 'win' and builder() == 'ninja':
add('Compile on cc_unittests fails due to symbols removed in r185063.')
if platform() == 'linux' and builder() == 'ninja':