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

Side by Side Diff: chrome/test/data/extensions/api_test/tabs/basics/crud2.js

Issue 24733003: Update defaults for InstantExtended. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 7 years, 2 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var secondWindowId; 5 var secondWindowId;
6 var thirdWindowId; 6 var thirdWindowId;
7 var testTabId; 7 var testTabId;
8 var kChromeUINewTabURL = "chrome-search://local-ntp/local-ntp.html";
8 9
9 function clickLink(id) { 10 function clickLink(id) {
10 var clickEvent = document.createEvent('MouseEvents'); 11 var clickEvent = document.createEvent('MouseEvents');
11 clickEvent.initMouseEvent('click', true, true, window); 12 clickEvent.initMouseEvent('click', true, true, window);
12 document.querySelector('#' + id).dispatchEvent(clickEvent); 13 document.querySelector('#' + id).dispatchEvent(clickEvent);
13 } 14 }
14 15
15 chrome.test.runTests([ 16 chrome.test.runTests([
16 17
17 function setupTwoWindows() { 18 function setupTwoWindows() {
18 createWindow(["about:blank", "chrome://newtab/", pageUrl("a")], {}, 19 createWindow(["about:blank", kChromeUINewTabURL, pageUrl("a")], {},
19 pass(function(winId, tabIds) { 20 pass(function(winId, tabIds) {
20 secondWindowId = winId; 21 secondWindowId = winId;
21 testTabId = tabIds[2]; 22 testTabId = tabIds[2];
22 23
23 createWindow(["chrome://newtab/", pageUrl("b")], {}, 24 createWindow([kChromeUINewTabURL, pageUrl("b")], {},
24 pass(function(winId, tabIds) { 25 pass(function(winId, tabIds) {
25 thirdWindowId = winId; 26 thirdWindowId = winId;
26 })); 27 }));
27 })); 28 }));
28 }, 29 },
29 30
30 function getAllInWindow() { 31 function getAllInWindow() {
31 chrome.tabs.getAllInWindow(secondWindowId, 32 chrome.tabs.getAllInWindow(secondWindowId,
32 pass(function(tabs) { 33 pass(function(tabs) {
33 assertEq(3, tabs.length); 34 assertEq(3, tabs.length);
34 for (var i = 0; i < tabs.length; i++) { 35 for (var i = 0; i < tabs.length; i++) {
35 assertEq(secondWindowId, tabs[i].windowId); 36 assertEq(secondWindowId, tabs[i].windowId);
36 assertEq(i, tabs[i].index); 37 assertEq(i, tabs[i].index);
37 38
38 // The first tab should be active 39 // The first tab should be active
39 assertEq((i == 0), tabs[i].active && tabs[i].selected); 40 assertEq((i == 0), tabs[i].active && tabs[i].selected);
40 } 41 }
41 assertEq("about:blank", tabs[0].url); 42 assertEq("about:blank", tabs[0].url);
42 assertEq("chrome://newtab/", tabs[1].url); 43 assertEq(kChromeUINewTabURL, tabs[1].url);
43 assertEq(pageUrl("a"), tabs[2].url); 44 assertEq(pageUrl("a"), tabs[2].url);
44 })); 45 }));
45 46
46 chrome.tabs.getAllInWindow(thirdWindowId, 47 chrome.tabs.getAllInWindow(thirdWindowId,
47 pass(function(tabs) { 48 pass(function(tabs) {
48 assertEq(2, tabs.length); 49 assertEq(2, tabs.length);
49 for (var i = 0; i < tabs.length; i++) { 50 for (var i = 0; i < tabs.length; i++) {
50 assertEq(thirdWindowId, tabs[i].windowId); 51 assertEq(thirdWindowId, tabs[i].windowId);
51 assertEq(i, tabs[i].index); 52 assertEq(i, tabs[i].index);
52 } 53 }
53 assertEq("chrome://newtab/", tabs[0].url); 54 assertEq(kChromeUINewTabURL, tabs[0].url);
54 assertEq(pageUrl("b"), tabs[1].url); 55 assertEq(pageUrl("b"), tabs[1].url);
55 })); 56 }));
56 }, 57 },
57 58
58 function updateSelect() { 59 function updateSelect() {
59 chrome.tabs.getAllInWindow(secondWindowId, pass(function(tabs) { 60 chrome.tabs.getAllInWindow(secondWindowId, pass(function(tabs) {
60 assertEq(true, tabs[0].active && tabs[0].selected); 61 assertEq(true, tabs[0].active && tabs[0].selected);
61 assertEq(false, tabs[1].active || tabs[1].selected); 62 assertEq(false, tabs[1].active || tabs[1].selected);
62 assertEq(false, tabs[2].active || tabs[2].selected); 63 assertEq(false, tabs[2].active || tabs[2].selected);
63 64
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 assertEq(window.tabs.length, 1); 172 assertEq(window.tabs.length, 1);
172 chrome.tabs.get(tab.id, pass(function(updatedTabInfo) { 173 chrome.tabs.get(tab.id, pass(function(updatedTabInfo) {
173 assertEq(tab.windowId, updatedTabInfo.windowId); 174 assertEq(tab.windowId, updatedTabInfo.windowId);
174 assertTrue(window.id != updatedTabInfo.windowId); 175 assertTrue(window.id != updatedTabInfo.windowId);
175 })); 176 }));
176 })); 177 }));
177 })); 178 }));
178 }, 179 },
179 180
180 ]); 181 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698