| Index: chrome/test/data/webui/webview_execute_script_test.js
|
| diff --git a/chrome/test/data/webui/webview_execute_script_test.js b/chrome/test/data/webui/webview_execute_script_test.js
|
| index b59666e6444d37230d3aeb6f7ca375ebd9907379..39c5aa4ba5e816a8634b47ecded17cc5d058f77d 100644
|
| --- a/chrome/test/data/webui/webview_execute_script_test.js
|
| +++ b/chrome/test/data/webui/webview_execute_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*"],
|
| + "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);
|
| +}
|
|
|