1 // Copyright (c) 2012 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 // This test opens a single background page opened by a.html.
8 'http://a.com:PORT/extensions/api_test/app_background_page/common';
10 // Dispatch "tunneled" functions from the live web pages to this testing page.
11 chrome.extension.onRequest.addListener(function(request) {
12 window[request.name](request.args);
15 // At no point should a window be created that contains the background page
17 chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
18 if (tab.url.match("bg\.html$")) {
19 chrome.test.notifyFail("popup opened instead of background page");
23 // Start the test by opening the first page in the app.
24 window.onload = function() {
25 // We wait for window.onload before getting the test config. If the
26 // config is requested before onload, then sometimes onload has already
27 // fired by the time chrome.test.getConfig()'s callback runs.
28 chrome.test.getConfig(function(config) {
30 pagePrefix.replace(/PORT/, config.testServer.port) + '/a.html';
31 chrome.tabs.create({ 'url': closeUrl }, function(tab) {});
35 // Background page is open now.
36 function onBackgroundPageLoaded() {
37 chrome.test.notifyPass();