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

Side by Side Diff: chrome/test/data/extensions/api_test/window_open/spanning/background.js

Issue 8775046: Convert another batch of extension tests to manifest_version 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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 var nextTest = null;
6 openFromNormalShouldOpenInNormal();
7
8 function openFromNormalShouldOpenInNormal() {
9 nextTest = openFromExtensionHostInIncognitoBrowserShouldOpenInNormalBrowser;
10 chrome.windows.getAll({populate: true}, function(windows) {
11 chrome.test.assertEq(1, windows.length);
12 chrome.test.assertFalse(windows[0].incognito);
13 chrome.test.assertEq(1, windows[0].tabs.length);
14 chrome.test.assertFalse(windows[0].tabs[0].incognito);
15
16 // The rest of the test continues in infobar.html.
17 chrome.experimental.infobars.show({tabId: windows[0].tabs[0].id,
18 path: "infobar.html"});
19 });
20 }
21
22 function openFromExtensionHostInIncognitoBrowserShouldOpenInNormalBrowser() {
23 nextTest = null;
24 chrome.windows.getCurrent(function(normalWin) {
25 chrome.test.assertFalse(normalWin.incognito);
26 // Create an incognito window.
27 chrome.windows.create({ incognito: true }, function(incognitoWin) {
28 // Remove the normal window. We keep running because of the incognito
29 // window.
30 chrome.windows.remove(normalWin.id, function() {
31 chrome.tabs.getAllInWindow(incognitoWin.id, function(tabs) {
32 chrome.test.assertEq(1, tabs.length);
33 // The rest of the test continues in infobar.html.
34 chrome.experimental.infobars.show({tabId: tabs[0].id,
35 path: "infobar.html"});
36 });
37 });
38 });
39 });
40 }
41
42 function verifyCreatedTab(tab) {
43 // The new tab should be a normal tab, and it should be in a normal
44 // window.
45 chrome.test.assertFalse(tab.incognito);
46 chrome.windows.get(tab.windowId, function(win) {
47 chrome.test.assertFalse(win.incognito);
48 if (nextTest) {
49 nextTest();
50 } else {
51 chrome.test.notifyPass();
52 }
53 });
54 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698