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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/data/extensions/api_test/tabs/basics/update.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/api_test/tabs/basics/update.js
diff --git a/chrome/test/data/extensions/api_test/tabs/basics/update.js b/chrome/test/data/extensions/api_test/tabs/basics/update.js
new file mode 100644
index 0000000000000000000000000000000000000000..4d9ee7aafa464207b41d45de27ab5f0f07f46e60
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/tabs/basics/update.js
@@ -0,0 +1,70 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var tabIds = [];
+var kFooUrl = "foo";
+var kBarUrl = "bar";
+
+chrome.test.runTests([
+ function setUp() {
+ chrome.tabs.create({"url": pageUrl("a")}, function(tab) {
+ tabIds.push(tab.id);
+ });
+ chrome.tabs.create({"url": pageUrl("b")}, function(tab) {
+ tabIds.push(tab.id);
+ });
+ chrome.tabs.create({"url": pageUrl("c")}, function(tab) {
+ tabIds.push(tab.id);
+ });
+ chrome.windows.create({"url": pageUrl("xxx")}, pass(function(tab) {}));
+ },
+
+ function testBasicSetup() {
+ chrome.tabs.get(tabIds[0], pass(function(tab) {
+ assertEq(pageUrl("a"), tab.url);
+ }));
+ chrome.tabs.get(tabIds[1], pass(function(tab) {
+ assertEq(pageUrl("b"), tab.url);
+ }));
+ chrome.tabs.get(tabIds[2], pass(function(tab) {
+ assertEq(pageUrl("c"), tab.url);
+ }));
+ },
+
+ function testUpdatingDefaultTabViaUndefined() {
+ chrome.tabs.update(
+ tabIds[1],
+ {"selected": true},
+ pass(function(tab) {
+ chrome.tabs.update(
+ undefined,
+ {"url": pageUrl(kFooUrl)},
+ pass(function(tab) {
+ chrome.tabs.get(
+ tabIds[1],
+ pass(function(tab) {
+ assertEq(pageUrl(kFooUrl), tab.url);
+ }));
+ }));
+ }));
+ },
+
+ function testUpdatingDefaultTabViaNull() {
+ chrome.tabs.update(
+ tabIds[2],
+ {"selected": true},
+ pass(function(tab) {
+ chrome.tabs.update(
+ null,
+ {"url": pageUrl(kBarUrl)},
+ pass(function(tab) {
+ chrome.tabs.get(
+ tabIds[2],
+ pass(function(tab) {
+ assertEq(pageUrl(kBarUrl), tab.url);
+ }));
+ }));
+ }));
+ }
+]);
« 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