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

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 95%
rename from chrome/test/data/webui/webview_execute_script_test.js
rename to chrome/test/data/webui/webview_content_script_test.js
index 277c12ff565bf9fabc6549bb41f80abdd9e46306..398252aafaf69b37dedf5faf4ea55e803d12f0ac 100644
--- a/chrome/test/data/webui/webview_execute_script_test.js
+++ b/chrome/test/data/webui/webview_content_script_test.js
@@ -444,3 +444,24 @@ function testContentScriptExistsAsLongAsWebViewTagExists(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*'],
+ '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