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.
5 var assertEq = chrome.test.assertEq;
6 var assertFalse = chrome.test.assertFalse;
7 var assertTrue = chrome.test.assertTrue;
9 var EventType = chrome.automation.EventType;
10 var RoleType = chrome.automation.RoleType;
11 var StateType = chrome.automation.StateType;
15 function createTab(url, callback) {
16 chrome.tabs.create({"url": url}, function(tab) {
21 function setUpAndRunTests(allTests) {
22 getUrlFromConfig(function(url) {
23 createTab(url, function(unused_tab) {
24 chrome.automation.getTree(function (returnedRootNode) {
25 rootNode = returnedRootNode;
26 rootNode.addEventListener('loadComplete', function() {
27 chrome.test.runTests(allTests);
34 function getUrlFromConfig(callback) {
35 chrome.test.getConfig(function(config) {
36 assertTrue('testServer' in config, 'Expected testServer in config');
37 var url = 'http://a.com:PORT/index.html'
38 .replace(/PORT/, config.testServer.port);