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

Side by Side Diff: chrome/browser/resources/chromeos/switch_access/automation_predicate_unittest.gtestjs

Issue 2863613003: Implemented scanning by group (Closed)
Patch Set: Responded to comments Created 3 years, 7 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
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 /**
6 * Test fixture for automation_predicate.js.
7 * @constructor
8 * @extends {testing.Test}
9 */
10 function AutomationPredicateUnitTest () {
11 testing.Test.call(this);
12 };
13
14 AutomationPredicateUnitTest.prototype = {
15 __proto__: testing.Test.prototype,
16
17 /** @override */
18 extraLibraries: [
19 'automation_predicate.js',
20 ],
21
22 /** @override */
23 browsePreload: DUMMY_URL,
24 };
25
26 TEST_F('AutomationPredicateUnitTest', 'IsInteresting', function() {
27 chrome.automation = {
28 RoleType: {
29 DESKTOP: 'desktop', ROOT_WEB_AREA: 'rootWebArea', TAB: 'tab',
30 TAB_LIST: 'tabList', WEB_VIEW: 'webView'
31 },
32 StateType: {FOCUSABLE: 'focusable', OFFSCREEN: 'offscreen'}
33 };
34
35 // Testing focusable.
36 let loc1 = {left: 0, top: 0, width: 0, height: 0};
37 let node1 = {location: loc1, state: {}};
38 let node2 = {location: loc1, state: {focusable: false}};
39 let node3 = {location: loc1, state: {focusable: true}};
40 assertFalse(AutomationPredicate.isInteresting(node1));
41 assertFalse(AutomationPredicate.isInteresting(node2));
42 assertTrue(AutomationPredicate.isInteresting(node3));
43
44 // Testing onscreen.
45 let loc2 = {left: -1, top: 0, width: 0, height: 0};
46 let loc3 = {left: 0, top: -1, width: 0, height: 0};
47 let node4 = {location: loc2, state: {focusable: true}};
48 let node5 = {location: loc3, state: {focusable: true}};
49 let node6 = {location: loc1, state: {focusable: true, offscreen: true}}
50 assertFalse(AutomationPredicate.isInteresting(node4));
51 assertFalse(AutomationPredicate.isInteresting(node5));
52 assertFalse(AutomationPredicate.isInteresting(node6));
53
54 // Testing if tab.
55 let node7 = {location: loc1, role: 'desktop', state: {}};
56 let node8 = {location: loc1, role: 'tabList', state: {}};
57 let node9 =
58 {location: loc1, parent: node8, root: node7, role: 'tab', state: {}};
59 assertFalse(AutomationPredicate.isInteresting(node7));
60 assertFalse(AutomationPredicate.isInteresting(node8));
61 assertTrue(AutomationPredicate.isInteresting(node9));
62 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698