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

Unified Diff: chrome/test/data/webui/webview_content_script_test.js

Issue 1058113002: Implement <webview>.addContentScript/removeContentScript API [3] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webui_api_1
Patch Set: nits Created 5 years, 8 months 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/webui/webview_content_script_test.js
diff --git a/chrome/test/data/webui/webview_execute_script_test.js b/chrome/test/data/webui/webview_content_script_test.js
similarity index 94%
rename from chrome/test/data/webui/webview_execute_script_test.js
rename to chrome/test/data/webui/webview_content_script_test.js
index b59666e6444d37230d3aeb6f7ca375ebd9907379..74a7440be36f33c42af30f33836b1ac27c3d1875 100644
--- a/chrome/test/data/webui/webview_execute_script_test.js
+++ b/chrome/test/data/webui/webview_content_script_test.js
@@ -379,3 +379,24 @@ function testContentScriptIsInjectedAfterTerminateAndReloadWebView(url) {
webview.src = url;
document.body.appendChild(webview);
}
+
+function testAddContentScriptWithCode(url) {
+ var webview = document.createElement('webview');
+
+ console.log("Step 1: call <webview>.addContentScripts.");
+ webview.addContentScripts(
+ [{"name": 'myrule',
+ "matches": ["http://*/empty*"],
xiyuan 2015/04/08 15:54:02 nit: double quote -> single quote in all places.
+ "code": 'document.body.style.backgroundColor = \"red\";',
+ "run_at": 'document_end'}]);
+
+ webview.addEventListener('loadstop', function() {
+ console.log('Step 2: call webview.executeScript() to check result.')
+ webview.executeScript({
+ code: "document.body.style.backgroundColor;"
+ }, onGetBackgroundExecuted);
+ });
+
+ webview.src = url;
+ document.body.appendChild(webview);
+}
« no previous file with comments | « chrome/test/data/extensions/platform_apps/web_view/shim/main.js ('k') | chrome/test/data/webui/webview_execute_script_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698