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

Side by Side Diff: chrome/test/data/extensions/api_test/app_background_page/basic_close/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: Fixed tests. Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 // This test runs through an expected use of a live background page:
6 // - A live (web-extent) web page is loaded (a.html), which opens the background
7 // page.
8 // - The first page is closed and a second live web page is loaded (b.html),
9 // which attempts to get still-running running background page. This second
10 // page also checks a counter which should have a value consistent with being
11 // called once from each of the first and second pages.
12 // - The background page closes itself.
13
14 var pageCloser;
Mihai Parparita -not on Chrome 2012/05/03 00:54:11 This seems unused (it's set, but never read).
Andrew T Wilson (Slow) 2012/05/03 07:42:56 Done.
15
16 var pagePrefix =
17 'http://a.com:PORT/files/extensions/api_test/app_background_page/common';
18
19 // Dispatch "tunneled" functions from the live web pages to this testing page.
20 chrome.extension.onRequest.addListener(function(request) {
21 window[request.name](request.args);
22 });
23
24 // At no point should a window be created that contains the background page
25 // (bg.html).
26 chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
27 if (tab.url.match("bg\.html$")) {
28 chrome.test.notifyFail("popup opened instead of background page");
29 }
30 });
31
32 // Start the test by opening the first page in the app.
33 window.onload = function() {
34 // We wait for window.onload before getting the test config. If the
35 // config is requested before onload, then sometimes onload has already
36 // fired by the time chrome.test.getConfig()'s callback runs.
37 chrome.test.getConfig(function(config) {
38 var close_url =
Mihai Parparita -not on Chrome 2012/05/03 00:54:11 Nit: this should be called closeUrl.
Andrew T Wilson (Slow) 2012/05/03 07:42:56 Done.
39 pagePrefix.replace(/PORT/, config.testServer.port) + '/close.html';
40 chrome.tabs.create({ 'url': close_url }, function(tab) {
41 pageCloser = tab;
42 });
43 });
44 };
45
46 // Background page is closed now.
47 function onBackgroundPageClosed() {
48 chrome.test.notifyPass();
49 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698