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

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

Issue 8762014: Move another set 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 var secondWindowId;
6 var thirdWindowId;
7 var testTabId;
8
9 chrome.test.runTests([
10
11 function setupTwoWindows() {
12 createWindow(["about:blank", "chrome://newtab/", pageUrl("a")], {},
13 pass(function(winId, tabIds) {
14 secondWindowId = winId;
15 testTabId = tabIds[2];
16
17 createWindow(["chrome://newtab/", pageUrl("b")], {},
18 pass(function(winId, tabIds) {
19 thirdWindowId = winId;
20 }));
21 }));
22 },
23
24 function getAllInWindow() {
25 chrome.tabs.getAllInWindow(secondWindowId,
26 pass(function(tabs) {
27 assertEq(3, tabs.length);
28 for (var i = 0; i < tabs.length; i++) {
29 assertEq(secondWindowId, tabs[i].windowId);
30 assertEq(i, tabs[i].index);
31
32 // The first tab should be active
33 assertEq((i == 0), tabs[i].active && tabs[i].selected);
34 }
35 assertEq("about:blank", tabs[0].url);
36 assertEq("chrome://newtab/", tabs[1].url);
37 assertEq(pageUrl("a"), tabs[2].url);
38 }));
39
40 chrome.tabs.getAllInWindow(thirdWindowId,
41 pass(function(tabs) {
42 assertEq(2, tabs.length);
43 for (var i = 0; i < tabs.length; i++) {
44 assertEq(thirdWindowId, tabs[i].windowId);
45 assertEq(i, tabs[i].index);
46 }
47 assertEq("chrome://newtab/", tabs[0].url);
48 assertEq(pageUrl("b"), tabs[1].url);
49 }));
50 },
51
52 function updateSelect() {
53 chrome.tabs.getAllInWindow(secondWindowId, pass(function(tabs) {
54 assertEq(true, tabs[0].active && tabs[0].selected);
55 assertEq(false, tabs[1].active || tabs[1].selected);
56 assertEq(false, tabs[2].active || tabs[2].selected);
57
58 // Select tab[1].
59 chrome.tabs.update(tabs[1].id, {active: true},
60 pass(function(tab1){
61 // Check update of tab[1].
62 chrome.test.assertEq(true, tab1.active);
63 chrome.tabs.getAllInWindow(secondWindowId, pass(function(tabs) {
64 assertEq(true, tabs[1].active && tabs[1].selected);
65 assertEq(false, tabs[2].active || tabs[2].selected);
66 // Select tab[2].
67 chrome.tabs.update(tabs[2].id,
68 {active: true},
69 pass(function(tab2){
70 // Check update of tab[2].
71 chrome.test.assertEq(true, tab2.active);
72 chrome.tabs.getAllInWindow(secondWindowId, pass(function(tabs) {
73 assertEq(false, tabs[1].active || tabs[1].selected);
74 assertEq(true, tabs[2].active && tabs[2].selected);
75 }));
76 }));
77 }));
78 }));
79 }));
80 },
81
82 function update() {
83 chrome.tabs.get(testTabId, pass(function(tab) {
84 assertEq(pageUrl("a"), tab.url);
85 // Update url.
86 chrome.tabs.update(testTabId, {"url": pageUrl("c")},
87 pass(function(tab){
88 chrome.test.assertEq(pageUrl("c"), tab.url);
89 // Check url.
90 chrome.tabs.get(testTabId, pass(function(tab) {
91 assertEq(pageUrl("c"), tab.url);
92 }));
93 }));
94 }));
95 },
96
97 ]);
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/tabs/basics/crud2.html ('k') | chrome/test/data/extensions/api_test/tabs/basics/d.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698