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

Side by Side Diff: chrome/test/data/extensions/platform_apps/web_view/main.js

Issue 11968054: <webview>: Implement ExecuteScript (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Renamed misnamed variable Created 7 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var util = {}; 5 var util = {};
6 6
7 // Creates a <webview> tag in document.body and returns the reference to it. 7 // Creates a <webview> tag in document.body and returns the reference to it.
8 // It also sets a dummy src. The dummy src is significant because this makes 8 // It also sets a dummy src. The dummy src is significant because this makes
9 // sure that the <object> shim is created (asynchronously at this point) for the 9 // sure that the <object> shim is created (asynchronously at this point) for the
10 // <webview> tag. This makes the <webview> tag ready for add/removeEventListener 10 // <webview> tag. This makes the <webview> tag ready for add/removeEventListener
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 webview.setAttribute('src', 'data:text/html,trigger navigation'); 198 webview.setAttribute('src', 'data:text/html,trigger navigation');
199 document.body.appendChild(webview); 199 document.body.appendChild(webview);
200 setTimeout(function() { 200 setTimeout(function() {
201 try { 201 try {
202 webview.partition = 'illegal'; 202 webview.partition = 'illegal';
203 chrome.test.fail(); 203 chrome.test.fail();
204 } catch (e) { 204 } catch (e) {
205 chrome.test.succeed(); 205 chrome.test.succeed();
206 } 206 }
207 }, 0); 207 }, 0);
208 },
209
210 function webViewExecuteScript() {
211 var webview = document.createElement('webview');
212 webview.addEventListener('loadstop', function() {
213 webview.executeScript(
214 {code:'document.body.style.backgroundColor = "red";'},
215 function(results) {
216 chrome.test.assertEq(1, results.length);
217 chrome.test.assertEq('red', results[0]);
218 chrome.test.succeed();
219 });
220 });
221 webview.setAttribute('src', 'data:text/html,trigger navigation');
222 document.body.appendChild(webview);
208 } 223 }
209 ]); 224 ]);
210 }; 225 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698