Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6199)

Unified Diff: chrome/test/data/extensions/platform_apps/web_view/shim/main.js

Issue 718203005: Implement declarative content script API for <webview> [js part]. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Introduce DeclarativeContentEvent. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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,

Powered by Google App Engine
This is Rietveld 408576698