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

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

Issue 304293002: Add human readable programmatic enum name/values to chrome.automation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Last feedback. 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
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
9 var EventType = chrome.automation.EventType;
10 var RoleType = chrome.automation.RoleType;
11 var StateType = chrome.automation.StateType;
12
8 var tree = null; 13 var tree = null;
9 14
10 function findAutomationNode(root, condition) { 15 function findAutomationNode(root, condition) {
11 if (condition(root)) 16 if (condition(root))
12 return root; 17 return root;
13 18
14 var children = root.children(); 19 var children = root.children();
15 for (var i = 0; i < children.length; i++) { 20 for (var i = 0; i < children.length; i++) {
16 var result = findAutomationNode(children[i], condition); 21 var result = findAutomationNode(children[i], condition);
17 if (result) 22 if (result)
18 return result; 23 return result;
19 } 24 }
20 return null; 25 return null;
21 } 26 }
22 27
23 function setupAndRunTests(allTests) { 28 function setupAndRunTests(allTests) {
24 chrome.automation.getDesktop(function(treeArg) { 29 chrome.automation.getDesktop(function(treeArg) {
25 tree = treeArg; 30 tree = treeArg;
26 chrome.test.runTests(allTests); 31 chrome.test.runTests(allTests);
27 }); 32 });
28 } 33 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698