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

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

Issue 485843002: Add logspam to help diagnose flaky tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Log --> LOG Created 6 years, 4 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var assertEq = chrome.test.assertEq; 5 var assertEq = chrome.test.assertEq;
6 var assertFalse = chrome.test.assertFalse; 6 var assertFalse = chrome.test.assertFalse;
7 var assertTrue = chrome.test.assertTrue; 7 var assertTrue = chrome.test.assertTrue;
8 8
9 var EventType = chrome.automation.EventType; 9 var EventType = chrome.automation.EventType;
10 var RoleType = chrome.automation.RoleType; 10 var RoleType = chrome.automation.RoleType;
11 var StateType = chrome.automation.StateType; 11 var StateType = chrome.automation.StateType;
12 12
13 var rootNode = null; 13 var rootNode = null;
14 14
15 function createTab(url, callback) { 15 function createTab(url, callback) {
16 chrome.tabs.create({"url": url}, function(tab) { 16 chrome.tabs.create({"url": url}, function(tab) {
17 callback(tab); 17 callback(tab);
18 }); 18 });
19 } 19 }
20 20
21 function setUpAndRunTests(allTests) { 21 function setUpAndRunTests(allTests) {
22 getUrlFromConfig(function(url) { 22 getUrlFromConfig(function(url) {
23 createTab(url, function(unused_tab) { 23 createTab(url, function(unused_tab) {
24 chrome.automation.getTree(function (returnedRootNode) { 24 chrome.automation.getTree(function (returnedRootNode) {
25 rootNode = returnedRootNode; 25 rootNode = returnedRootNode;
26 if (rootNode.attributes.docLoaded) { 26 if (rootNode.attributes.docLoaded) {
27 console.log('In getTree() callback: ' +
28 'docLoaded attr already true; running tests');
27 chrome.test.runTests(allTests); 29 chrome.test.runTests(allTests);
28 return; 30 return;
29 } 31 }
32 console.log('In getTree() callback: ' +
33 'docLoaded false; waiting for loadComplete');
30 rootNode.addEventListener('loadComplete', function() { 34 rootNode.addEventListener('loadComplete', function() {
35 console.log('loadComplete received; running tests.');
31 chrome.test.runTests(allTests); 36 chrome.test.runTests(allTests);
32 }); 37 });
33 }); 38 });
34 }); 39 });
35 }); 40 });
36 } 41 }
37 42
38 function getUrlFromConfig(callback) { 43 function getUrlFromConfig(callback) {
39 chrome.test.getConfig(function(config) { 44 chrome.test.getConfig(function(config) {
40 assertTrue('testServer' in config, 'Expected testServer in config'); 45 assertTrue('testServer' in config, 'Expected testServer in config');
41 var url = 'http://a.com:PORT/index.html' 46 var url = 'http://a.com:PORT/index.html'
42 .replace(/PORT/, config.testServer.port); 47 .replace(/PORT/, config.testServer.port);
43 callback(url) 48 callback(url)
44 }); 49 });
45 } 50 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698