OLD | NEW |
1 <!-- | 1 <!-- |
2 Copyright (c) 2009 The Chromium Authors. All rights reserved. | 2 * Copyright (c) 2011 The Chromium Authors. All rights reserved. Use of this |
3 Use of this source code is governed by a BSD-style license that can be | 3 * source code is governed by a BSD-style license that can be found in the |
4 found in the LICENSE file. | 4 * LICENSE file. |
5 --> | 5 --> |
6 | |
7 <!-- | 6 <!-- |
8 Two common ways that we can end up with web pages running in an extension | 7 Two common ways that we can end up with web pages running in an extension |
9 process are iframes and popup windows. | 8 process are iframes and popup windows. |
10 --> | 9 --> |
11 <script> | 10 <script src="background.js"></script> |
12 var numPings = 0; | |
13 chrome.extension.onRequest.addListener(function(data) { | |
14 if (data != "ping") | |
15 chrome.test.fail("Unexpected request: " + JSON.stringify(data)); | |
16 | |
17 if (++numPings == 2) | |
18 chrome.test.notifyPass(); | |
19 }); | |
20 | |
21 chrome.test.getConfig(function(config) { | |
22 var test_file_url = "http://localhost:PORT/files/extensions/test_file.html" | |
23 .replace(/PORT/, config.testServer.port); | |
24 | |
25 // Add a window. | |
26 var w = window.open(test_file_url); | |
27 | |
28 // Add an iframe. | |
29 var iframe = document.createElement("iframe"); | |
30 iframe.src = test_file_url; | |
31 document.getElementById("iframeContainer").appendChild(iframe); | |
32 }); | |
33 | |
34 </script> | |
35 | |
36 <div id="iframeContainer"> </div> | 11 <div id="iframeContainer"> </div> |
OLD | NEW |