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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/api_test/window_open/spanning/background.js
===================================================================
--- chrome/test/data/extensions/api_test/window_open/spanning/background.js (revision 0)
+++ chrome/test/data/extensions/api_test/window_open/spanning/background.js (revision 0)
@@ -0,0 +1,54 @@
+// Copyright (c) 2011 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.
+
+var nextTest = null;
+openFromNormalShouldOpenInNormal();
+
+function openFromNormalShouldOpenInNormal() {
+ nextTest = openFromExtensionHostInIncognitoBrowserShouldOpenInNormalBrowser;
+ chrome.windows.getAll({populate: true}, function(windows) {
+ chrome.test.assertEq(1, windows.length);
+ chrome.test.assertFalse(windows[0].incognito);
+ chrome.test.assertEq(1, windows[0].tabs.length);
+ chrome.test.assertFalse(windows[0].tabs[0].incognito);
+
+ // The rest of the test continues in infobar.html.
+ chrome.experimental.infobars.show({tabId: windows[0].tabs[0].id,
+ path: "infobar.html"});
+ });
+}
+
+function openFromExtensionHostInIncognitoBrowserShouldOpenInNormalBrowser() {
+ nextTest = null;
+ chrome.windows.getCurrent(function(normalWin) {
+ chrome.test.assertFalse(normalWin.incognito);
+ // Create an incognito window.
+ chrome.windows.create({ incognito: true }, function(incognitoWin) {
+ // Remove the normal window. We keep running because of the incognito
+ // window.
+ chrome.windows.remove(normalWin.id, function() {
+ chrome.tabs.getAllInWindow(incognitoWin.id, function(tabs) {
+ chrome.test.assertEq(1, tabs.length);
+ // The rest of the test continues in infobar.html.
+ chrome.experimental.infobars.show({tabId: tabs[0].id,
+ path: "infobar.html"});
+ });
+ });
+ });
+ });
+}
+
+function verifyCreatedTab(tab) {
+ // The new tab should be a normal tab, and it should be in a normal
+ // window.
+ chrome.test.assertFalse(tab.incognito);
+ chrome.windows.get(tab.windowId, function(win) {
+ chrome.test.assertFalse(win.incognito);
+ if (nextTest) {
+ nextTest();
+ } else {
+ chrome.test.notifyPass();
+ }
+ });
+}

Powered by Google App Engine
This is Rietveld 408576698