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

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

Issue 7981040: Make chrome.tabs.update's tabId parameter optional. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Mihai's comments addressed. Created 9 years, 3 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/test/data/extensions/api_test/tabs/basics/update.html ('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
(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 tabIds = [];
6 var kFooUrl = "foo";
7 var kBarUrl = "bar";
8
9 chrome.test.runTests([
10 function setUp() {
11 chrome.tabs.create({"url": pageUrl("a")}, function(tab) {
12 tabIds.push(tab.id);
13 });
14 chrome.tabs.create({"url": pageUrl("b")}, function(tab) {
15 tabIds.push(tab.id);
16 });
17 chrome.tabs.create({"url": pageUrl("c")}, function(tab) {
18 tabIds.push(tab.id);
19 });
20 chrome.windows.create({"url": pageUrl("xxx")}, pass(function(tab) {}));
21 },
22
23 function testBasicSetup() {
24 chrome.tabs.get(tabIds[0], pass(function(tab) {
25 assertEq(pageUrl("a"), tab.url);
26 }));
27 chrome.tabs.get(tabIds[1], pass(function(tab) {
28 assertEq(pageUrl("b"), tab.url);
29 }));
30 chrome.tabs.get(tabIds[2], pass(function(tab) {
31 assertEq(pageUrl("c"), tab.url);
32 }));
33 },
34
35 function testUpdatingDefaultTabViaUndefined() {
36 chrome.tabs.update(
37 tabIds[1],
38 {"selected": true},
39 pass(function(tab) {
40 chrome.tabs.update(
41 undefined,
42 {"url": pageUrl(kFooUrl)},
43 pass(function(tab) {
44 chrome.tabs.get(
45 tabIds[1],
46 pass(function(tab) {
47 assertEq(pageUrl(kFooUrl), tab.url);
48 }));
49 }));
50 }));
51 },
52
53 function testUpdatingDefaultTabViaNull() {
54 chrome.tabs.update(
55 tabIds[2],
56 {"selected": true},
57 pass(function(tab) {
58 chrome.tabs.update(
59 null,
60 {"url": pageUrl(kBarUrl)},
61 pass(function(tab) {
62 chrome.tabs.get(
63 tabIds[2],
64 pass(function(tab) {
65 assertEq(pageUrl(kBarUrl), tab.url);
66 }));
67 }));
68 }));
69 }
70 ]);
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/tabs/basics/update.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698