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