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

Side by Side Diff: chrome/test/data/extensions/api_test/executescript/frame_after_load/test.html

Issue 8758008: Move another block of extension tests to manifest_version 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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 <script> 1 <!--
2 2 * Copyright (c) 2011 The Chromium Authors. All rights reserved. Use of this
3 var baseUrl = 'http://a.com:PORT/files/extensions/api_test/executescript/' + 3 * source code is governed by a BSD-style license that can be found in the
4 'frame_after_load/'; 4 * LICENSE file.
5 5 -->
6 chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) { 6 <script src="test.js"></script>
7 if (changeInfo.status != 'complete')
8 return;
9
10 chrome.test.runTests([
11 function() {
12 // Tests that we can still execute scripts after a frame has loaded after
13 // the main document has completed.
14 var injectFrameCode = 'var frame = document.createElement("iframe");' +
15 'frame.src = "' + baseUrl + 'inner.html";' +
16 'frame.onload = function() {chrome.extension.connect().postMessage("lo aded")};' +
17 'document.body.appendChild(frame)';
18 var postFrameCode = 'chrome.extension.connect().postMessage("done");';
19
20 chrome.self.onConnect.addListener(function(port) {
21 port.onMessage.addListener(function(data) {
22 if (data == 'loaded') {
23 chrome.tabs.executeScript(tabId, {code: postFrameCode});
24 } else if (data == 'done') {
25 chrome.test.succeed();
26 }
27 });
28 });
29 chrome.tabs.executeScript(tabId, {code: injectFrameCode});
30 }
31 ]);
32 });
33
34 chrome.test.getConfig(function(config) {
35 baseUrl = baseUrl.replace(/PORT/, config.testServer.port);
36 chrome.tabs.create({ url: baseUrl + 'outer.html' });
37 });
38
39 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698