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

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

Issue 9162002: Query the current window with chrome.tabs.query using -1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 8 years, 11 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
« no previous file with comments | « chrome/renderer/resources/extensions/schema_generated_bindings.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 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 testWindowId; 5 var testWindowId;
6 var active_tabs = []; 6 var active_tabs = [];
7 var highlighted_tabs = []; 7 var highlighted_tabs = [];
8 var window_tabs = []; 8 var window_tabs = [];
9 var pinned_tabs = []; 9 var pinned_tabs = [];
10 var active_and_window_tabs = []; 10 var active_and_window_tabs = [];
11 11
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 }, 72 },
73 73
74 function queryWindowID() { 74 function queryWindowID() {
75 chrome.tabs.query({windowId: testWindowId}, pass(function(tabs) { 75 chrome.tabs.query({windowId: testWindowId}, pass(function(tabs) {
76 assertEq(window_tabs.length, tabs.length); 76 assertEq(window_tabs.length, tabs.length);
77 for (var x = 0; x < tabs.length; x++) 77 for (var x = 0; x < tabs.length; x++)
78 assertEq(testWindowId, tabs[x].windowId); 78 assertEq(testWindowId, tabs[x].windowId);
79 })); 79 }));
80 }, 80 },
81 81
82 function queryCurrentWindow() {
83 chrome.windows.getCurrent(function(win) {
84 chrome.tabs.query({windowId: chrome.windows.WINDOW_ID_CURRENT},
85 pass(function(tabs) {
86 // The current window should only contain this test page.
87 assertEq(1, tabs.length);
88 assertEq(win.id, tabs[0].windowId);
89 assertEq(location.href, tabs[0].url);
90 assertEq(location.href, tabs[0].title);
91 }));
92 });
93 },
94
82 function queryPinned() { 95 function queryPinned() {
83 chrome.tabs.query({pinned: true}, pass(function(tabs) { 96 chrome.tabs.query({pinned: true}, pass(function(tabs) {
84 assertEq(pinned_tabs.length, tabs.length); 97 assertEq(pinned_tabs.length, tabs.length);
85 for (var x = 0; x < tabs.length; x++) 98 for (var x = 0; x < tabs.length; x++)
86 assertTrue(tabs[x].pinned); 99 assertTrue(tabs[x].pinned);
87 })); 100 }));
88 chrome.tabs.query({pinned: false}, pass(function(tabs) { 101 chrome.tabs.query({pinned: false}, pass(function(tabs) {
89 assertEq(4-pinned_tabs.length, tabs.length); 102 assertEq(4-pinned_tabs.length, tabs.length);
90 for (var x = 0; x < tabs.length; x++) 103 for (var x = 0; x < tabs.length; x++)
91 assertFalse(tabs[x].pinned); 104 assertFalse(tabs[x].pinned);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 windowType: 'popup', 169 windowType: 'popup',
157 url: 'about:*' 170 url: 'about:*'
158 }, pass(function(tabs) { 171 }, pass(function(tabs) {
159 assertEq(2, tabs.length); 172 assertEq(2, tabs.length);
160 })); 173 }));
161 })); 174 }));
162 })); 175 }));
163 } 176 }
164 ]); 177 ]);
165 178
OLDNEW
« no previous file with comments | « chrome/renderer/resources/extensions/schema_generated_bindings.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698