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

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

Issue 545044: Add the ability to focus a window to chrome.window.update(). (Closed)
Patch Set: tabs Created 10 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
« no previous file with comments | « chrome/common/extensions/api/extension_api.json ('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 // tabs api test 1 // tabs api test
2 // browser_tests.exe --gtest_filter=ExtensionApiTest.Tabs 2 // browser_tests.exe --gtest_filter=ExtensionApiTest.Tabs
3 3
4 // We have a bunch of places where we need to remember some state from one 4 // We have a bunch of places where we need to remember some state from one
5 // test (or setup code) to subsequent tests. 5 // test (or setup code) to subsequent tests.
6 var firstWindowId = null; 6 var firstWindowId = null;
7 var secondWindowId = null; 7 var secondWindowId = null;
8 var firstTabIndex = null; 8 var firstTabIndex = null;
9 var testTabId = null; 9 var testTabId = null;
10 10
(...skipping 17 matching lines...) Expand all
28 firstTabIndex = tab.index; 28 firstTabIndex = tab.index;
29 })); 29 }));
30 }, 30 },
31 31
32 function create() { 32 function create() {
33 chrome.tabs.create({"windowId" : firstWindowId, "selected" : false}, 33 chrome.tabs.create({"windowId" : firstWindowId, "selected" : false},
34 pass(function(tab){ 34 pass(function(tab){
35 assertTrue(tab.index > firstTabIndex); 35 assertTrue(tab.index > firstTabIndex);
36 assertEq(firstWindowId, tab.windowId); 36 assertEq(firstWindowId, tab.windowId);
37 assertEq(false, tab.selected); 37 assertEq(false, tab.selected);
38 assertEq("chrome://newtab/", tab.url);
39 })); 38 }));
40 }, 39 },
41 40
42 function createInOtherWindow() { 41 function createInOtherWindow() {
43 chrome.windows.create({}, pass(function(win) { 42 chrome.windows.create({}, pass(function(win) {
44 // The newly created window is now the currentWindow. 43 // The newly created window is now the currentWindow.
45 // Create a tab in the older window. 44 // Create a tab in the older window.
46 chrome.tabs.create({"windowId" : firstWindowId, "selected" : false}, 45 chrome.tabs.create({"windowId" : firstWindowId, "selected" : false},
47 pass(function(tab) { 46 pass(function(tab) {
48 assertEq(firstWindowId, tab.windowId); 47 assertEq(firstWindowId, tab.windowId);
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 chrome.tabs.remove(moveTabIds["d"], pass(function() { 233 chrome.tabs.remove(moveTabIds["d"], pass(function() {
235 chrome.tabs.getAllInWindow(secondWindowId, 234 chrome.tabs.getAllInWindow(secondWindowId,
236 pass(function(tabs) { 235 pass(function(tabs) {
237 assertEq(2, tabs.length); 236 assertEq(2, tabs.length);
238 assertEq(pageUrl("b"), tabs[0].url); 237 assertEq(pageUrl("b"), tabs[0].url);
239 assertEq("chrome://newtab/", tabs[1].url); 238 assertEq("chrome://newtab/", tabs[1].url);
240 })); 239 }));
241 })); 240 }));
242 }, 241 },
243 242
243 function focus() {
244 chrome.test.listenOnce(chrome.windows.onFocusChanged, function(winId) {
245 assertEq(firstWindowId, winId);
246 });
247
248 chrome.windows.update(firstWindowId, {focused: true}, pass());
249 },
250
244 /* 251 /*
245 // TODO(jcampan): http://crbug.com/30662 the detection language library 252 // TODO(jcampan): http://crbug.com/30662 the detection language library
246 // crashes on some sites and has been temporarily disabled. 253 // crashes on some sites and has been temporarily disabled.
247 function detectLanguage() { 254 function detectLanguage() {
248 chrome.tabs.getAllInWindow(firstWindowId, pass(function(tabs) { 255 chrome.tabs.getAllInWindow(firstWindowId, pass(function(tabs) {
249 chrome.tabs.detectLanguage(tabs[0].id, pass(function(lang) { 256 chrome.tabs.detectLanguage(tabs[0].id, pass(function(lang) {
250 assertEq("en", lang); 257 assertEq("en", lang);
251 })); 258 }));
252 })); 259 }));
253 }, 260 },
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 var request = "test"; 577 var request = "test";
571 chrome.tabs.sendRequest(testTabId, request, pass(function(response) { 578 chrome.tabs.sendRequest(testTabId, request, pass(function(response) {
572 assertEq(request, response); 579 assertEq(request, response);
573 })); 580 }));
574 }, 581 },
575 582
576 // TODO(asargent) 583 // TODO(asargent)
577 // It would be an improvement to check the captureVisibleTab results 584 // It would be an improvement to check the captureVisibleTab results
578 // against a known-good result. 585 // against a known-good result.
579 ]); 586 ]);
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/extension_api.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698