summaryrefslogtreecommitdiffstats
path: root/android_webview
diff options
context:
space:
mode:
authortimvolodine <timvolodine@chromium.org>2015-07-31 11:21:21 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-31 18:22:03 +0000
commit12261bfeed735d1da74b45209b02b2b9fd444d4b (patch)
tree18d8dd8a172bf27ff14d3bf34ef5956378efab53 /android_webview
parent63636c0e0e1bde0027aaca9cf80dffc25fddef1e (diff)
downloadchromium_src-12261bfeed735d1da74b45209b02b2b9fd444d4b.zip
chromium_src-12261bfeed735d1da74b45209b02b2b9fd444d4b.tar.gz
chromium_src-12261bfeed735d1da74b45209b02b2b9fd444d4b.tar.bz2
[Android WebViewShell] Add inclusion test for webview exposed stable interfaces.
This patch adds a test to make sure the exposed stable interfaces in blink match with the exposed interfaces in webview. All interfaces listed in virtual/stable/webexposed/global-interface-listing-expected.txt are checked except the excluded interfaces which are listed in not-webview-exposed.txt. BUG=514217 Review URL: https://codereview.chromium.org/1261953004 Cr-Commit-Position: refs/heads/master@{#341370}
Diffstat (limited to 'android_webview')
-rw-r--r--android_webview/android_webview_shell_test_apk.isolate1
-rw-r--r--android_webview/tools/WebViewShell/src/org/chromium/webview_shell/WebViewLayoutTest.java36
-rw-r--r--android_webview/tools/WebViewShell/test/webexposed/not-webview-exposed.txt4
3 files changed, 41 insertions, 0 deletions
diff --git a/android_webview/android_webview_shell_test_apk.isolate b/android_webview/android_webview_shell_test_apk.isolate
index 09b7b70..85e85d3 100644
--- a/android_webview/android_webview_shell_test_apk.isolate
+++ b/android_webview/android_webview_shell_test_apk.isolate
@@ -8,6 +8,7 @@
'variables': {
'files': [
'<(DEPTH)/android_webview/tools/WebViewShell/test/',
+ '<(DEPTH)/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-expected.txt',
'<(DEPTH)/third_party/WebKit/LayoutTests/webexposed/global-interface-listing.html',
'<(DEPTH)/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt',
'<(DEPTH)/third_party/WebKit/LayoutTests/webexposed/resources/global-interface-listing.js',
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 d78dd60..4d6414a 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
@@ -33,8 +33,12 @@ public class WebViewLayoutTest
Environment.getExternalStorageDirectory().getAbsolutePath() + "/";
private static final String BASE_WEBVIEW_TEST_PATH = "android_webview/tools/WebViewShell/test/";
private static final String BASE_BLINK_TEST_PATH = "third_party/WebKit/LayoutTests/";
+ private static final String BASE_BLINK_STABLE_TEST_PATH =
+ BASE_BLINK_TEST_PATH + "virtual/stable/";
private static final String PATH_WEBVIEW_PREFIX = EXTERNAL_PREFIX + BASE_WEBVIEW_TEST_PATH;
private static final String PATH_BLINK_PREFIX = EXTERNAL_PREFIX + BASE_BLINK_TEST_PATH;
+ private static final String PATH_BLINK_STABLE_PREFIX =
+ EXTERNAL_PREFIX + BASE_BLINK_STABLE_TEST_PATH;
private static final long TIMEOUT_SECONDS = 20;
@@ -100,6 +104,38 @@ public class WebViewLayoutTest
assertEquals("Unexpected webview interfaces found", "", unexpected.toString());
}
+ public void testWebViewIncludedStableInterfaces() throws Exception {
+ ensureJsTestCopied();
+ loadUrlWebViewAsync("file://" + PATH_BLINK_PREFIX
+ + "webexposed/global-interface-listing.html", mTestActivity);
+ String blinkStableExpected = readFile(PATH_BLINK_STABLE_PREFIX
+ + "webexposed/global-interface-listing-expected.txt");
+ String webviewExcluded = readFile(PATH_WEBVIEW_PREFIX
+ + "webexposed/not-webview-exposed.txt");
+ mTestActivity.waitForFinish(TIMEOUT_SECONDS, TimeUnit.SECONDS);
+ String result = mTestActivity.getTestResult();
+
+ HashMap<String, HashSet<String>> webviewExcludedInterfacesMap =
+ buildHashMap(webviewExcluded);
+ HashMap<String, HashSet<String>> webviewInterfacesMap = buildHashMap(result);
+ HashMap<String, HashSet<String>> blinkStableInterfacesMap =
+ buildHashMap(blinkStableExpected);
+ StringBuilder missing = new StringBuilder();
+
+ // Check that each stable blink interface is present in webview except the excluded
+ // interfaces.
+ for (String interfaceS : blinkStableInterfacesMap.keySet()) {
+ // TODO(timvolodine): consider implementing matching of subsets as well.
+ HashSet<String> subsetExcluded = webviewExcludedInterfacesMap.get(interfaceS);
+ if (subsetExcluded != null && subsetExcluded.isEmpty()) continue;
+
+ if (webviewInterfacesMap.get(interfaceS) == null) {
+ missing.append(interfaceS + "\n");
+ }
+ }
+ assertEquals("Missing webview interfaces found", "", missing.toString());
+ }
+
// test helper methods
private void runWebViewLayoutTest(final String fileName, final String fileNameExpected)
diff --git a/android_webview/tools/WebViewShell/test/webexposed/not-webview-exposed.txt b/android_webview/tools/WebViewShell/test/webexposed/not-webview-exposed.txt
index d0c323e..1d1c169 100644
--- a/android_webview/tools/WebViewShell/test/webexposed/not-webview-exposed.txt
+++ b/android_webview/tools/WebViewShell/test/webexposed/not-webview-exposed.txt
@@ -17,6 +17,10 @@ interface Notification
# not yet supported in webview.
interface SharedWorker
+# push API not supported in webview
+interface PushManager
+interface PushSubscription
+
# TODO(timvolodine): check screen orientation lock api
# TODO(timvolodine): check notifications in service workers
# TODO(timvolodine): add Presentation API