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

Side by Side Diff: chrome/test/data/extensions/api_test/tabs/basics/crud.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 firstWindowId;
6
7 chrome.test.runTests([
8 function getSelected() {
9 chrome.tabs.getSelected(null, pass(function(tab) {
10 assertEq(location.href, tab.url);
11 assertEq(location.href, tab.title);
12 firstWindowId = tab.windowId;
13 }));
14 },
15
16 function create() {
17 chrome.tabs.create({"windowId" : firstWindowId, "active" : false},
18 pass(function(tab){
19 assertEq(1, tab.index);
20 assertEq(firstWindowId, tab.windowId);
21 assertEq(false, tab.selected);
22 assertEq("chrome://newtab/", tab.url);
23 assertEq(false, tab.pinned);
24 }));
25 },
26
27 function createInOtherWindow() {
28 chrome.windows.create({}, pass(function(win) {
29 // Create a tab in the older window.
30 chrome.tabs.create({"windowId" : firstWindowId, "active" : false},
31 pass(function(tab) {
32 assertEq(firstWindowId, tab.windowId);
33 }));
34 // Create a tab in this new window.
35 chrome.tabs.create({"windowId" : win.id}, pass(function(tab) {
36 assertEq(win.id, tab.windowId);
37 }));
38 }));
39 },
40
41 function createAtIndex() {
42 chrome.tabs.create({"windowId" : firstWindowId, "index" : 1},
43 pass(function(tab) {
44 assertEq(1, tab.index);
45 }));
46 },
47
48 function createSelected() {
49 chrome.tabs.create({"windowId" : firstWindowId, "active" : true},
50 pass(function(tab) {
51 assertTrue(tab.active && tab.selected);
52 chrome.tabs.getSelected(firstWindowId, pass(function(selectedTab) {
53 assertEq(tab.id, selectedTab.id);
54 }));
55 }));
56 },
57
58 function createWindowWithDefaultTab() {
59 var verify_default = function() {
60 return pass(function(win) {
61 assertEq(1, win.tabs.length);
62 assertEq("chrome://newtab/", win.tabs[0].url);
63 });
64 };
65
66 // Make sure the window always has the NTP when no URL is supplied.
67 chrome.windows.create({}, verify_default());
68 chrome.windows.create({url:[]}, verify_default());
69 },
70
71 function createWindowWithExistingTab() {
72 // Create a tab in the old window
73 chrome.tabs.create({"windowId" : firstWindowId, "url": pageUrl('a'),
74 "active" : false},
75 pass(function(tab) {
76 assertEq(firstWindowId, tab.windowId);
77 assertEq(pageUrl('a'), tab.url);
78
79 // Create a new window with this tab
80 chrome.windows.create({"tabId": tab.id}, pass(function(win) {
81 assertEq(1, win.tabs.length);
82 assertEq(tab.id, win.tabs[0].id);
83 assertEq(win.id, win.tabs[0].windowId);
84 assertEq(pageUrl('a'), win.tabs[0].url);
85 }));
86 }));
87 },
88
89 function getAllInWindowNullArg() {
90 chrome.tabs.getAllInWindow(null, pass(function(tabs) {
91 assertEq(5, tabs.length);
92 assertEq(firstWindowId, tabs[0].windowId);
93 }));
94 },
95
96 function detectLanguage() {
97 chrome.tabs.getAllInWindow(firstWindowId, pass(function(tabs) {
98 chrome.tabs.detectLanguage(tabs[0].id, pass(function(lang) {
99 assertEq("und", lang);
100 }));
101 }));
102 },
103
104 function windowCreate() {
105 chrome.windows.create({type: "popup"}, pass(function(window) {
106 assertEq("popup", window.type);
107 assertTrue(!window.incognito);
108 }));
109 chrome.windows.create({incognito: true}, pass(function(window) {
110 // This extension is not incognito-enabled, so it shouldn't be able to
111 // see the incognito window.
112 assertEq(null, window);
113 }));
114 },
115
116 /* Disabled -- see http://bugs.chromium.org/58229.
117 function windowSetFocused() {
118 chrome.windows.getCurrent(function(oldWin) {
119 chrome.windows.create({}, function(newWin) {
120 assertTrue(newWin.focused);
121 chrome.windows.update(oldWin.id, {focused:true});
122 chrome.windows.get(oldWin.id, pass(function(oldWin2) {
123 assertTrue(oldWin2.focused);
124 }));
125 });
126 });
127 },
128 */
129 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698