Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2234)

Unified Diff: chrome/test/data/extensions/api_test/app_background_page/basic_open/test.js

Issue 10298002: No longer start BG mode until a BackgroundContents is loaded (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Prospective fix for cros test failures. Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/api_test/app_background_page/basic_open/test.js
diff --git a/chrome/test/data/extensions/api_test/app_background_page/basic_open/test.js b/chrome/test/data/extensions/api_test/app_background_page/basic_open/test.js
new file mode 100644
index 0000000000000000000000000000000000000000..25363fd988aa54dc753a37c302619f425d9300d6
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/app_background_page/basic_open/test.js
@@ -0,0 +1,38 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This test opens a single background page opened by a.html.
+
+var pagePrefix =
+ 'http://a.com:PORT/files/extensions/api_test/app_background_page/common';
+
+// Dispatch "tunneled" functions from the live web pages to this testing page.
+chrome.extension.onRequest.addListener(function(request) {
+ window[request.name](request.args);
+});
+
+// At no point should a window be created that contains the background page
+// (bg.html).
+chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
+ if (tab.url.match("bg\.html$")) {
+ chrome.test.notifyFail("popup opened instead of background page");
+ }
+});
+
+// Start the test by opening the first page in the app.
+window.onload = function() {
+ // We wait for window.onload before getting the test config. If the
+ // config is requested before onload, then sometimes onload has already
+ // fired by the time chrome.test.getConfig()'s callback runs.
+ chrome.test.getConfig(function(config) {
+ var closeUrl =
+ pagePrefix.replace(/PORT/, config.testServer.port) + '/a.html';
+ chrome.tabs.create({ 'url': closeUrl }, function(tab) {});
+ });
+};
+
+// Background page is open now.
+function onBackgroundPageLoaded() {
+ chrome.test.notifyPass();
+};

Powered by Google App Engine
This is Rietveld 408576698