Index: chrome/test/data/extensions/platform_apps/web_view/shim/main.js |
diff --git a/chrome/test/data/extensions/platform_apps/web_view/shim/main.js b/chrome/test/data/extensions/platform_apps/web_view/shim/main.js |
index 4778664caca6ef91b607e19702baebf3d8fd0f18..b9d4bf6e59e7ed1c798c13d846adba2860f53085 100644 |
--- a/chrome/test/data/extensions/platform_apps/web_view/shim/main.js |
+++ b/chrome/test/data/extensions/platform_apps/web_view/shim/main.js |
@@ -545,6 +545,38 @@ function testWebRequestAPIExistence() { |
document.body.appendChild(webview); |
} |
+function testDeclarativeContentAPIExistence() { |
+ var apiPropertiesToCheck = [ |
+ // Declarative Content API. |
+ 'onPageChanged' |
+ ]; |
+ var webview = document.createElement('webview'); |
+ webview.setAttribute('partition', arguments.callee.name); |
+ webview.addEventListener('loadstop', function(e) { |
+ for (var i = 0; i < apiPropertiesToCheck.length; ++i) { |
+ embedder.test.assertEq('object', |
+ typeof webview.request[apiPropertiesToCheck[i]]); |
+ embedder.test.assertEq( |
+ 'function', |
+ typeof webview.request[apiPropertiesToCheck[i]].addRules); |
+ embedder.test.assertEq( |
+ 'function', |
+ typeof webview.request[apiPropertiesToCheck[i]].getRules); |
+ embedder.test.assertEq( |
+ 'function', |
+ typeof webview.request[apiPropertiesToCheck[i]].removeRules); |
+ } |
+ |
+ // Try to overwrite webview.request, shall not succeed. |
+ webview.request = '123'; |
+ embedder.test.assertTrue(typeof webview.request !== 'string'); |
+ |
+ embedder.test.succeed(); |
+ }); |
+ webview.setAttribute('src', 'data:text/html,webview check api'); |
+ document.body.appendChild(webview); |
+} |
+ |
// This test verifies that the loadstart, loadstop, and exit events fire as |
// expected. |
function testEventName() { |
@@ -2016,6 +2048,7 @@ embedder.test.testList = { |
testInlineScriptFromAccessibleResources, |
'testInvalidChromeExtensionURL': testInvalidChromeExtensionURL, |
'testWebRequestAPIExistence': testWebRequestAPIExistence, |
+ 'testDeclarativeContentAPIExistence': testDeclarativeContentAPIExistence, |
'testEventName': testEventName, |
'testOnEventProperties': testOnEventProperties, |
'testLoadProgressEvent': testLoadProgressEvent, |