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(rootNode, | 7 var firstTextField = findAutomationNode(rootNode, |
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 listenOnce(firstTextField, EventType.focus, function(e) { | 12 listenOnce(firstTextField, 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() { | |
19 var firstFocusableNode = findAutomationNode(rootNode, | |
20 function(node) { | |
21 return node.role == 'button' && node.state.focusable; | |
22 }); | |
23 assertTrue(!!firstFocusableNode); | |
24 listenOnce(firstFocusableNode, EventType.focus, function(e) { | |
25 chrome.test.succeed(); | |
26 }, true); | |
27 firstFocusableNode.focus(); | |
28 }, | |
29 | |
30 function testDoDefaultViews() { | 18 function testDoDefaultViews() { |
31 listenOnce(rootNode, 'focus', function(node) { | 19 listenOnce(rootNode, 'focus', function(node) { |
32 chrome.test.succeed(); | 20 chrome.test.succeed(); |
33 }, true); | 21 }, true); |
34 var button = rootNode.find( | 22 var button = rootNode.find( |
35 {role: 'button', attributes: {name: 'Bookmark this page'}}); | 23 {role: 'button', attributes: {name: 'Bookmark this page'}}); |
36 button.doDefault(); | 24 button.doDefault(); |
37 }, | 25 }, |
38 | 26 |
39 function testContextMenu() { | 27 function testContextMenu() { |
40 var addressBar = rootNode.find({role: 'textField'}); | 28 var addressBar = rootNode.find({role: 'textField'}); |
41 listenOnce(rootNode, EventType.menuStart, function(e) { | 29 listenOnce(rootNode, EventType.menuStart, function(e) { |
42 addressBar.showContextMenu(); | 30 addressBar.showContextMenu(); |
43 chrome.test.succeed(); | 31 chrome.test.succeed(); |
44 }, true); | 32 }, true); |
45 addressBar.showContextMenu(); | 33 addressBar.showContextMenu(); |
46 } | 34 } |
47 ]; | 35 ]; |
48 | 36 |
49 setUpAndRunTests(allTests); | 37 setUpAndRunTests(allTests); |
OLD | NEW |