summaryrefslogtreecommitdiffstats
path: root/android_webview
diff options
context:
space:
mode:
authormikecase <mikecase@chromium.org>2015-09-30 07:06:22 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-30 14:07:41 +0000
commit5614f7ed50272ec16037898f7e701427d4e11f4a (patch)
tree03382cfc355a627bd782b0875f728b19f282d7c1 /android_webview
parentf1b5f5306d2698ebc96012b26e25325347e6e63d (diff)
downloadchromium_src-5614f7ed50272ec16037898f7e701427d4e11f4a.zip
chromium_src-5614f7ed50272ec16037898f7e701427d4e11f4a.tar.gz
chromium_src-5614f7ed50272ec16037898f7e701427d4e11f4a.tar.bz2
Add support to run AndroidWebViewShell with OnDeviceInstrumentationDriver.
To run instrumentation tests on appurify, our test runner needs to use the OnDeviceInstrumentationDriver. If we want to run the AndroidWebViewShell.apk on appurify, we will need to make these changes. I ran AndroidWebViewShell on appurify (they set up a special device pool where we can overwrite SystemWebView.apk) with these changes and the tests were able to run. Additionally, adding @MediumTest to the tests because the new test runner code path (the one we use for appurify) requires size annotations on tests (previously, tests without size annotation were treated as @SmallTest by default). BUG= Review URL: https://codereview.chromium.org/1358303002 Cr-Commit-Position: refs/heads/master@{#351546}
Diffstat (limited to 'android_webview')
-rw-r--r--android_webview/android_webview_shell.gyp2
-rw-r--r--android_webview/tools/WebViewShell/AndroidManifest.xml2
-rw-r--r--android_webview/tools/WebViewShell/src/org/chromium/webview_shell/WebViewLayoutTest.java9
-rw-r--r--android_webview/tools/WebViewShell/src/org/chromium/webview_shell/WebViewLayoutTestRunner.java10
4 files changed, 23 insertions, 0 deletions
diff --git a/android_webview/android_webview_shell.gyp b/android_webview/android_webview_shell.gyp
index a5d898f..8704b92 100644
--- a/android_webview/android_webview_shell.gyp
+++ b/android_webview/android_webview_shell.gyp
@@ -8,6 +8,8 @@
'type': 'none',
'dependencies': [
'../base/base.gyp:base_java_test_support',
+ '../testing/android/on_device_instrumentation.gyp:broker_java',
+ '../testing/android/on_device_instrumentation.gyp:require_driver_apk',
],
'variables': {
'apk_name': 'AndroidWebViewShell',
diff --git a/android_webview/tools/WebViewShell/AndroidManifest.xml b/android_webview/tools/WebViewShell/AndroidManifest.xml
index a7a79e5..6223d82 100644
--- a/android_webview/tools/WebViewShell/AndroidManifest.xml
+++ b/android_webview/tools/WebViewShell/AndroidManifest.xml
@@ -84,6 +84,8 @@
android:label="@string/title_activity_layout_test"
android:exported="true">
</activity>
+ <activity android:name="org.chromium.test.broker.OnDeviceInstrumentationBroker"
+ android:exported="true"/>
<uses-library android:name="android.test.runner" />
</application>
diff --git a/android_webview/tools/WebViewShell/src/org/chromium/webview_shell/WebViewLayoutTest.java b/android_webview/tools/WebViewShell/src/org/chromium/webview_shell/WebViewLayoutTest.java
index f94a9b9..4d84446 100644
--- a/android_webview/tools/WebViewShell/src/org/chromium/webview_shell/WebViewLayoutTest.java
+++ b/android_webview/tools/WebViewShell/src/org/chromium/webview_shell/WebViewLayoutTest.java
@@ -6,6 +6,7 @@ package org.chromium.webview_shell;
import android.os.Environment;
import android.test.ActivityInstrumentationTestCase2;
+import android.test.suitebuilder.annotation.MediumTest;
import junit.framework.ComparisonFailure;
@@ -67,17 +68,20 @@ public class WebViewLayoutTest
return (WebViewLayoutTestRunner) super.getInstrumentation();
}
+ @MediumTest
public void testSimple() throws Exception {
runWebViewLayoutTest("experimental/basic-logging.html",
"experimental/basic-logging-expected.txt");
}
// This is a non-failing test because it tends to require frequent rebaselines.
+ @MediumTest
public void testGlobalInterfaceNoFail() throws Exception {
runBlinkLayoutTest("webexposed/global-interface-listing.html",
"webexposed/global-interface-listing-expected.txt", true);
}
+ @MediumTest
public void testNoUnexpectedInterfaces() throws Exception {
ensureJsTestCopied();
loadUrlWebViewAsync("file://" + PATH_BLINK_PREFIX
@@ -101,6 +105,7 @@ public class WebViewLayoutTest
assertEquals("Unexpected new webview interfaces found", "", newInterfaces.toString());
}
+ @MediumTest
public void testWebViewExcludedInterfaces() throws Exception {
ensureJsTestCopied();
loadUrlWebViewAsync("file://" + PATH_BLINK_PREFIX
@@ -130,6 +135,7 @@ public class WebViewLayoutTest
assertEquals("Unexpected webview interfaces found", "", unexpected.toString());
}
+ @MediumTest
public void testWebViewIncludedStableInterfaces() throws Exception {
ensureJsTestCopied();
loadUrlWebViewAsync("file://" + PATH_BLINK_PREFIX
@@ -164,16 +170,19 @@ public class WebViewLayoutTest
// Blink platform API tests
+ @MediumTest
public void testGeolocationCallbacks() throws Exception {
runWebViewLayoutTest("blink-apis/geolocation/geolocation-permission-callbacks.html",
"blink-apis/geolocation/geolocation-permission-callbacks-expected.txt");
}
+ @MediumTest
public void testMediaStreamApiDenyPermission() throws Exception {
runWebViewLayoutTest("blink-apis/webrtc/mediastream-permission-denied-callbacks.html",
"blink-apis/webrtc/mediastream-permission-denied-callbacks-expected.txt");
}
+ @MediumTest
public void testMediaStreamApi() throws Exception {
mTestActivity.setGrantPermission(true);
runWebViewLayoutTest("blink-apis/webrtc/mediastream-callbacks.html",
diff --git a/android_webview/tools/WebViewShell/src/org/chromium/webview_shell/WebViewLayoutTestRunner.java b/android_webview/tools/WebViewShell/src/org/chromium/webview_shell/WebViewLayoutTestRunner.java
index 4356e3b..147c3e5 100644
--- a/android_webview/tools/WebViewShell/src/org/chromium/webview_shell/WebViewLayoutTestRunner.java
+++ b/android_webview/tools/WebViewShell/src/org/chromium/webview_shell/WebViewLayoutTestRunner.java
@@ -5,8 +5,11 @@
package org.chromium.webview_shell;
import android.os.Bundle;
+import android.test.AndroidTestRunner;
import android.test.InstrumentationTestRunner;
+import org.chromium.test.reporter.TestStatusListener;
+
/**
* Customized test runner for running instrumentation tests in WebViewBrowserTests.
*/
@@ -25,4 +28,11 @@ public class WebViewLayoutTestRunner extends InstrumentationTestRunner {
public boolean isRebaseline() {
return mModeArgument != null ? mModeArgument.equals(MODE_REBASELINE) : false;
}
+
+ @Override
+ protected AndroidTestRunner getAndroidTestRunner() {
+ AndroidTestRunner runner = super.getAndroidTestRunner();
+ runner.addTestListener(new TestStatusListener(getContext()));
+ return runner;
+ }
} \ No newline at end of file