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

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

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

Powered by Google App Engine
This is Rietveld 408576698