| 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 allTests = [ | 5 var allTests = [ |
| 6 function testDoDefault() { | 6 function testDoDefault() { |
| 7 var firstTextField = findAutomationNode(tree.root, | 7 var firstTextField = findAutomationNode(tree.root, |
| 8 function(node) { | 8 function(node) { |
| 9 return node.role == 'textField'; | 9 return node.role == 'textField'; |
| 10 }); | 10 }); |
| 11 assertTrue(!!firstTextField); | 11 assertTrue(!!firstTextField); |
| 12 firstTextField.addEventListener('focus', function(e) { | 12 firstTextField.addEventListener(EventType.focus, function(e) { |
| 13 chrome.test.succeed(); | 13 chrome.test.succeed(); |
| 14 }, true); | 14 }, true); |
| 15 firstTextField.doDefault(); | 15 firstTextField.doDefault(); |
| 16 }, | 16 }, |
| 17 | 17 |
| 18 function testFocus() { | 18 function testFocus() { |
| 19 var firstFocusableNode = findAutomationNode(tree.root, | 19 var firstFocusableNode = findAutomationNode(tree.root, |
| 20 function(node) { | 20 function(node) { |
| 21 return node.role == 'button' && node.state.focusable; | 21 return node.role == 'button' && node.state.focusable; |
| 22 }); | 22 }); |
| 23 assertTrue(!!firstFocusableNode); | 23 assertTrue(!!firstFocusableNode); |
| 24 firstFocusableNode.addEventListener('focus', function(e) { | 24 firstFocusableNode.addEventListener(EventType.focus, function(e) { |
| 25 chrome.test.succeed(); | 25 chrome.test.succeed(); |
| 26 }, true); | 26 }, true); |
| 27 firstFocusableNode.focus(); | 27 firstFocusableNode.focus(); |
| 28 } | 28 } |
| 29 ]; | 29 ]; |
| 30 | 30 |
| 31 setupAndRunTests(allTests); | 31 setupAndRunTests(allTests); |
| OLD | NEW |