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

Side by Side Diff: chrome/test/data/extensions/api_test/automation/tests/tabs/tab_id.js

Issue 308003003: Allow requesting Automation tree by tabId (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 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
OLDNEW
(Empty)
1 // Copyright 2014 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 function createBackgroundTab(url, callback) {
6 chrome.tabs.query({ active: true }, function(tabs) {
7 chrome.test.assertEq(1, tabs.length);
8 var originalActiveTab = tabs[0];
9 createTab(url, function(tab) {
10 chrome.tabs.update(originalActiveTab.id, { active: true }, function() {
11 callback(tab);
12 });
13 })
14 });
15 }
16
17 var allTests = [
18 function testGetTabById() {
19 getUrlFromConfig(function(url) {
20 // Keep the NTP as the active tab so that we know we're requesting the
21 // tab by ID rather than just getting the active tab still.
22 createBackgroundTab(url, function(tab) {
23 chrome.automation.getTree(tab.id, function(tree) {
24 tree.addEventListener('loadComplete', function() {
25 var title = tree.root.attributes['docTitle'];
26 chrome.test.assertEq('Automation Tests', title);
27 chrome.test.succeed();
28 });
29 })
30 });
31 });
32 }
33 ];
34
35 chrome.test.runTests(allTests);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698