OLD | NEW |
(Empty) | |
| 1 <script> |
| 2 // We load a page that has one iframe |
| 3 // So we should receive two "all_frames" messages, and one "top_frame_only" |
| 4 // messages. |
| 5 |
| 6 var num_all_frames_messages = 0; |
| 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.log("Creating tab..."); |
| 31 chrome.tabs.create({ |
| 32 url: "http://localhost:1337/files/extensions/test_file_with_iframe.html" |
| 33 }); |
| 34 </script> |
OLD | NEW |