| OLD | NEW |
| 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 } |
| OLD | NEW |