diff options
author | timvolodine <timvolodine@chromium.org> | 2016-02-26 09:06:32 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-26 17:08:15 +0000 |
commit | a953edbbe1eef2e0441c7248b03c1dfafc48aad7 (patch) | |
tree | d8aa97e9ce7baaed1865fe3ef0dca239534bff81 /android_webview/tools | |
parent | 8a228fc5f6113ce237ebe6e687a7a5bf4bf31d3f (diff) | |
download | chromium_src-a953edbbe1eef2e0441c7248b03c1dfafc48aad7.zip chromium_src-a953edbbe1eef2e0441c7248b03c1dfafc48aad7.tar.gz chromium_src-a953edbbe1eef2e0441c7248b03c1dfafc48aad7.tar.bz2 |
[WebViewShellTest] Add interface property subset matching in inclusion/exclusion tests.
Currently only interface names (and not their porperties) are checked
in exclusion/inclusion tests. This patch adds so-called subset matching
which allows more fine grained checks to ensure that the interface
properties are also matching/missing etc..
This patch also includes an updated exclusion file. The property
checks make it possible to capture differences within interfaces,
exposing previously unrecorded issues and exclusions.
BUG=514217
Review URL: https://codereview.chromium.org/1728393002
Cr-Commit-Position: refs/heads/master@{#377904}
Diffstat (limited to 'android_webview/tools')
-rw-r--r-- | android_webview/tools/WebViewShell/test/webexposed/not-webview-exposed.txt | 40 | ||||
-rw-r--r-- | android_webview/tools/WebViewShellTest/src/org/chromium/webview_shell/test/WebViewLayoutTest.java | 65 |
2 files changed, 88 insertions, 17 deletions
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 b1b6e41..7dd704e 100644 --- a/android_webview/tools/WebViewShell/test/webexposed/not-webview-exposed.txt +++ b/android_webview/tools/WebViewShell/test/webexposed/not-webview-exposed.txt @@ -29,7 +29,45 @@ interface PresentationConnectionAvailableEvent : Event interface PresentationConnectionCloseEvent : Event interface PresentationRequest : EventTarget +# crbug.com/589500 +interface HTMLMediaElement : HTMLElement + getter sinkId + method setSinkId + +interface Navigator + getter permissions # crbug.com/490120 + method registerProtocolHandler # crbug.com/589502 + getter presentation # crbug.com/521319 + method unregisterProtocolHandler # crbug.com/589502 + +# notifications not yet supported in webview, crbug.com/551446 +interface ServiceWorkerRegistration : EventTarget + getter pushManager + method getNotifications + method showNotification + +# crbug.com/589504 +interface HTMLInputElement : HTMLElement + getter webkitEntries + +# TODO(timvolodine): investigate in more detail +[GLOBAL OBJECT] + method openDatabase + attribute layoutTestController + attribute eventSender + method webkitRequestFileSystem + attribute testRunner + attribute internals + attribute accessibilityController + attribute textInputController + attribute mojo + attribute gamepadController + attribute GCController + attribute speechSynthesis + method gc + method webkitResolveLocalFileSystemURL + method onerror + # TODO(timvolodine): check screen orientation lock api # TODO(timvolodine): check notifications in service workers # TODO(timvolodine): add File System API - diff --git a/android_webview/tools/WebViewShellTest/src/org/chromium/webview_shell/test/WebViewLayoutTest.java b/android_webview/tools/WebViewShellTest/src/org/chromium/webview_shell/test/WebViewLayoutTest.java index 59ebd81..fe076c3 100644 --- a/android_webview/tools/WebViewShellTest/src/org/chromium/webview_shell/test/WebViewLayoutTest.java +++ b/android_webview/tools/WebViewShellTest/src/org/chromium/webview_shell/test/WebViewLayoutTest.java @@ -129,13 +129,27 @@ public class WebViewLayoutTest HashMap<String, HashSet<String>> blinkInterfacesMap = buildHashMap(blinkExpected); StringBuilder unexpected = new StringBuilder(); - // Check that each excluded interface is present in blinkInterfacesMap but not - // in webviewInterfacesMap. - for (String interfaceS : webviewExcludedInterfacesMap.keySet()) { - assertNotNull("Interface " + interfaceS + " not exposed in blink", - blinkInterfacesMap.get(interfaceS)); - if (webviewInterfacesMap.get(interfaceS) != null) { + // Check that each excluded interface and its properties are present in blinkInterfaceMap + // but not in webviewInterfacesMap. + for (HashMap.Entry<String, HashSet<String>> entry : + webviewExcludedInterfacesMap.entrySet()) { + String interfaceS = entry.getKey(); + HashSet<String> subsetBlink = blinkInterfacesMap.get(interfaceS); + assertNotNull("Interface " + interfaceS + " not exposed in blink", subsetBlink); + + HashSet<String> subsetWebView = webviewInterfacesMap.get(interfaceS); + HashSet<String> subsetExcluded = entry.getValue(); + if (subsetExcluded.isEmpty() && subsetWebView != null) { unexpected.append(interfaceS + "\n"); + continue; + } + + for (String property : subsetExcluded) { + assertTrue("Interface " + interfaceS + "." + property + " not exposed in blink", + subsetBlink.contains(property)); + if (subsetWebView != null && subsetWebView.contains(property)) { + unexpected.append(interfaceS + "." + property + "\n"); + } } } assertEquals("Unexpected webview interfaces found", "", unexpected.toString()); @@ -160,15 +174,27 @@ public class WebViewLayoutTest 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. + // Check that each stable blink interface and its properties are present in webview + // except the excluded interfaces/properties. + for (HashMap.Entry<String, HashSet<String>> entry : blinkStableInterfacesMap.entrySet()) { + String interfaceS = entry.getKey(); HashSet<String> subsetExcluded = webviewExcludedInterfacesMap.get(interfaceS); if (subsetExcluded != null && subsetExcluded.isEmpty()) continue; - if (webviewInterfacesMap.get(interfaceS) == null) { + HashSet<String> subsetBlink = entry.getValue(); + HashSet<String> subsetWebView = webviewInterfacesMap.get(interfaceS); + + if (subsetWebView == null) { + // interface is missing completely missing.append(interfaceS + "\n"); + continue; + } + + for (String propertyBlink : subsetBlink) { + if (subsetExcluded != null && subsetExcluded.contains(propertyBlink)) continue; + if (!subsetWebView.contains(propertyBlink)) { + missing.append(interfaceS + "." + propertyBlink + "\n"); + } } } assertEquals("Missing webview interfaces found", "", missing.toString()); @@ -315,10 +341,13 @@ public class WebViewLayoutTest HashMap<String, HashSet<String>> interfaces = new HashMap<String, HashSet<String>>(); for (String line : lineByLine) { String s = trimAndRemoveComments(line); - if (s.startsWith("interface")) { - subset = new HashSet(); - interfaces.put(s, subset); - } else if (interfaceProperty(s) && subset != null) { + if (isInterfaceOrGlobalObject(s)) { + subset = interfaces.get(s); + if (subset == null) { + subset = new HashSet(); + interfaces.put(s, subset); + } + } else if (isInterfaceProperty(s) && subset != null) { subset.add(s); } } @@ -331,7 +360,11 @@ public class WebViewLayoutTest return (commentIndex >= 0) ? s.substring(0, commentIndex).trim() : s; } - private boolean interfaceProperty(String s) { + private boolean isInterfaceOrGlobalObject(String s) { + return s.startsWith("interface") || s.startsWith("[GLOBAL OBJECT]"); + } + + private boolean isInterfaceProperty(String s) { return s.startsWith("getter") || s.startsWith("setter") || s.startsWith("method") || s.startsWith("attribute"); } |