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.
9 function setupWindow() {
10 createWindow([pageUrl("a")], {},
11 pass(function(winId, tabIds) {
12 firstWindowId = winId;
13 firstTabId = tabIds[0];
17 function duplicateTab() {
18 chrome.tabs.duplicate(firstTabId, pass(function(tab) {
19 assertEq(pageUrl("a"), tab.url);
20 assertEq(1, tab.index);
25 chrome.tabs.getAllInWindow(firstWindowId,
27 assertEq(tabs.length, 2);
28 assertEq(tabs[0].url, tabs[1].url);
29 assertEq(tabs[0].index + 1, tabs[1].index);
33 function duplicateTabFromNewPopupWindow() {
34 chrome.windows.create({
35 "url": "http://google.com",
39 var firstTab = wnd.tabs[0];
40 chrome.tabs.duplicate(firstTab.id, pass(function(tab) {
41 // Because the parent window is a popup, the duplicated tab will open
43 assertTrue(wnd.id != tab.windowId);