| 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..e1ae825806b63615e27232c24d80e814f80913b8
|
| --- /dev/null
|
| +++ b/chrome/test/data/extensions/api_test/automation/tests/tabs/tab_id.js
|
| @@ -0,0 +1,35 @@
|
| +// 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.
|
| +
|
| +function createBackgroundTab(url, callback) {
|
| + chrome.tabs.query({ active: true }, function(tabs) {
|
| + chrome.test.assertEq(1, tabs.length);
|
| + var originalActiveTab = tabs[0];
|
| + createTab(url, function(tab) {
|
| + chrome.tabs.update(originalActiveTab.id, { active: true }, function() {
|
| + callback(tab);
|
| + });
|
| + })
|
| + });
|
| +}
|
| +
|
| +var allTests = [
|
| + function testGetTabById() {
|
| + getUrlFromConfig(function(url) {
|
| + // Keep the NTP as the active tab so that we know we're requesting the
|
| + // tab by ID rather than just getting the active tab still.
|
| + createBackgroundTab(url, function(tab) {
|
| + chrome.automation.getTree(tab.id, function(tree) {
|
| + tree.addEventListener('loadComplete', function() {
|
| + var title = tree.root.attributes['docTitle'];
|
| + chrome.test.assertEq('Automation Tests', title);
|
| + chrome.test.succeed();
|
| + });
|
| + })
|
| + });
|
| + });
|
| + }
|
| +];
|
| +
|
| +chrome.test.runTests(allTests);
|
|
|