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

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

Issue 1004253002: Enable <webview>.executeScript outside of Apps and Extensions [2] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 5 years, 9 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
« no previous file with comments | « chrome/test/data/webui/webview_execute_script.js ('k') | extensions/browser/api/execute_code_function.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 e0a4c80c9486970e04e6afeb9fa1d8caf9d07597..5485904dbba3086dfedfc3daab2b81433c21dd04 100644
--- a/chrome/test/data/webui/webview_execute_script_test.js
+++ b/chrome/test/data/webui/webview_execute_script_test.js
@@ -8,13 +8,32 @@ function createWebview() {
return webview;
}
+function onGetBackgroundExecuted(results) {
+ chrome.send('testResult', [results.length == 1 && results[0] == 'red']);
+};
+
function testExecuteScriptCode(url) {
var webview = createWebview();
- var onGetBackgroundExecuted = function(results) {
- chrome.send('testResult', [results.length == 1 && results[0] == 'red']);
+ var onSetBackgroundExecuted = function() {
+ webview.executeScript({
+ code: 'document.body.style.backgroundColor;'
+ }, onGetBackgroundExecuted);
+ };
+
+ var onLoadStop = function() {
+ webview.executeScript({
+ code: 'document.body.style.backgroundColor = \'red\';'
+ }, onSetBackgroundExecuted);
};
+ webview.addEventListener('loadstop', onLoadStop);
+ webview.src = url;
+}
+
+function testExecuteScriptCodeFromFile(url) {
+ var webview = createWebview();
+
var onSetBackgroundExecuted = function() {
webview.executeScript({
code: 'document.body.style.backgroundColor;'
@@ -23,7 +42,7 @@ function testExecuteScriptCode(url) {
var onLoadStop = function() {
webview.executeScript({
- code: 'document.body.style.backgroundColor = \'red\';'
+ file: 'test/webview_execute_script.js'
}, onSetBackgroundExecuted);
};
« no previous file with comments | « chrome/test/data/webui/webview_execute_script.js ('k') | extensions/browser/api/execute_code_function.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698