Index: chrome/test/data/extensions/api_test/automation/tests/tabs/tab_id.js |
diff --git a/chrome/test/data/extensions/api_test/automation/tests/tabs/tab_id.js b/chrome/test/data/extensions/api_test/automation/tests/tabs/tab_id.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..66723d9ba1dfef3fa704a2f265ae4685f822ac45 |
--- /dev/null |
+++ b/chrome/test/data/extensions/api_test/automation/tests/tabs/tab_id.js |
@@ -0,0 +1,27 @@ |
+// Copyright 2014 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 allTests = [ |
+ function testGetTabById() { |
+ chrome.tabs.query({ active: true }, function(tabs) { |
+ chrome.test.assertEq(1, tabs.length); |
+ var newTabPageTab = tabs[0]; |
+ getUrlFromConfig(function(url) { |
+ createTab(url, function(tab) { |
+ // make the NTP the active tab so that we know we're requesting the |
+ // tab by ID rather than just getting the active tab still. |
+ chrome.tabs.update(newTabPageTab.id, { active: true }, function() { |
+ chrome.automation.getTree(tab.id, function(tree) { |
David Tseng
2014/05/29 22:41:31
This almost makes me want named object parameters
aboxhall
2014/05/30 15:37:11
What other named parameters might we want? I'm def
|
+ var title = tree.root.attributes['docTitle']; |
David Tseng
2014/05/29 22:41:31
nit: attributes.docTitle
|
+ chrome.test.assertEq('Automation Tests', title); |
+ chrome.test.succeed(); |
+ }); |
+ }); |
+ }); |
+ }); |
+ }); |
+ } |
+]; |
+ |
+chrome.test.runTests(allTests); |