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

Unified Diff: chrome/test/data/extensions/api_test/automation/tests/tabs/common.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, 7 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
Index: chrome/test/data/extensions/api_test/automation/tests/tabs/common.js
diff --git a/chrome/test/data/extensions/api_test/automation/tests/tabs/common.js b/chrome/test/data/extensions/api_test/automation/tests/tabs/common.js
index d6396cece50596bc1e0a399f465a82ef9aed3545..753899fd4303a9a4023eb391bab161a219d113c4 100644
--- a/chrome/test/data/extensions/api_test/automation/tests/tabs/common.js
+++ b/chrome/test/data/extensions/api_test/automation/tests/tabs/common.js
@@ -12,20 +12,30 @@ var StateType = chrome.automation.StateType;
var tree = null;
+function createTab(url, callback) {
+ chrome.tabs.create({"url": url}, function(tab) {
+ callback(tab);
+ });
+}
+
function setUpAndRunTests(allTests) {
+ getUrlFromConfig(function(url) {
+ createTab(url, function(unused_tab) {
+ chrome.automation.getTree(function (returnedTree) {
+ tree = returnedTree;
+ tree.addEventListener('loadComplete', function() {
+ chrome.test.runTests(allTests);
+ });
+ });
+ });
+ });
+}
+
+function getUrlFromConfig(callback) {
chrome.test.getConfig(function(config) {
assertTrue('testServer' in config, 'Expected testServer in config');
var url = 'http://a.com:PORT/index.html'
.replace(/PORT/, config.testServer.port);
-
- function gotTree(returnedTree) {
- tree = returnedTree;
- tree.addEventListener('loadComplete', function() {
- chrome.test.runTests(allTests);
- });
- }
- chrome.tabs.create({ 'url': url }, function() {
- chrome.automation.getTree(gotTree);
- });
+ callback(url)
});
}

Powered by Google App Engine
This is Rietveld 408576698