| OLD | NEW |
| 1 <script> | 1 <!-- |
| 2 // We load a page that has one iframe | 2 * Copyright (c) 2011 The Chromium Authors. All rights reserved. Use of this |
| 3 // So we should receive two "all_frames" messages, and one "top_frame_only" | 3 * source code is governed by a BSD-style license that can be found in the |
| 4 // messages. | 4 * LICENSE file. |
| 5 | 5 --> |
| 6 var num_all_frames_messages = 0; | 6 <script src="test.js"></script> |
| 7 var num_top_frame_only_messages = 0; | |
| 8 | |
| 9 chrome.test.runTests([ | |
| 10 // Tests receiving a request from a content script and responding. | |
| 11 function onRequest() { | |
| 12 chrome.extension.onRequest.addListener( | |
| 13 function(request, sender, sendResponse) { | |
| 14 if (request == "all_frames") { | |
| 15 num_all_frames_messages++; | |
| 16 } else if (request == "top_frame_only") { | |
| 17 num_top_frame_only_messages++; | |
| 18 } else { | |
| 19 chrome.test.fail("Unexpected request: " + JSON.stringify(request)); | |
| 20 } | |
| 21 | |
| 22 if (num_all_frames_messages == 2 && num_top_frame_only_messages == 1) { | |
| 23 chrome.test.succeed(); | |
| 24 } | |
| 25 } | |
| 26 ); | |
| 27 } | |
| 28 ]); | |
| 29 | |
| 30 chrome.test.getConfig(function(config) { | |
| 31 chrome.test.log("Creating tab..."); | |
| 32 | |
| 33 var test_url = | |
| 34 "http://localhost:PORT/files/extensions/test_file_with_iframe.html" | |
| 35 .replace(/PORT/, config.testServer.port); | |
| 36 | |
| 37 chrome.tabs.create({ url: test_url }); | |
| 38 }); | |
| 39 | |
| 40 </script> | |
| OLD | NEW |