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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox2/cvox2/background/background.extjs

Issue 536233002: Begin introducing some of the initial pieces for ChromeVox next commands. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@chromeos_conversions
Patch Set: Rebase. Created 6 years, 3 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
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 // Include test fixture. 5 // Include test fixture.
6 GEN_INCLUDE(['../../../chromevox/testing/chromevox_e2e_test_base.js']); 6 GEN_INCLUDE(['../../../chromevox/testing/chromevox_e2e_test_base.js']);
7 7
8 /** 8 /**
9 * Test fixture for cvox2.Background. 9 * Test fixture for cvox2.Background.
10 * @constructor 10 * @constructor
(...skipping 27 matching lines...) Expand all
38 speak: function(textString, queueMode, properties) { 38 speak: function(textString, queueMode, properties) {
39 this.utterances.push(textString); 39 this.utterances.push(textString);
40 }, 40 },
41 41
42 /** 42 /**
43 * Checks to see if a string was spoken. 43 * Checks to see if a string was spoken.
44 * @param {string} textString The string to check. 44 * @param {string} textString The string to check.
45 * @return {boolean} True if the string was spoken (possibly as part of a 45 * @return {boolean} True if the string was spoken (possibly as part of a
46 * larger utterance). 46 * larger utterance).
47 */ 47 */
48 checkIfTextWasSpoken: function(textString) { 48 checkIfSubstringWasSpoken: function(textString) {
49 return this.utterances.some(function(t) { 49 return this.utterances.some(function(t) {
50 return t.indexOf(textString) != -1; 50 return t.indexOf(textString) != -1;
51 }); 51 });
52 } 52 }
53 }; 53 };
54 54
55 /** Tests that ChromeVox classic is in this context. */ 55 /** Tests that ChromeVox classic is in this context. */
56 SYNC_TEST_F('BackgroundTest', 'ClassicNamespaces', function() { 56 SYNC_TEST_F('BackgroundTest', 'ClassicNamespaces', function() {
57 assertEquals('object', typeof(cvox)); 57 assertEquals('object', typeof(cvox));
58 assertEquals('function', typeof(cvox.ChromeVoxBackground)); 58 assertEquals('function', typeof(cvox.ChromeVoxBackground));
59 }); 59 });
60 60
61 /** Tests that ChromeVox next is in this context. */ 61 /** Tests that ChromeVox next is in this context. */
62 SYNC_TEST_F('BackgroundTest', 'NextNamespaces', function() { 62 SYNC_TEST_F('BackgroundTest', 'NextNamespaces', function() {
63 assertEquals('object', typeof(cvox2)); 63 assertEquals('object', typeof(cvox2));
64 assertEquals('function', typeof(cvox2.Background)); 64 assertEquals('function', typeof(cvox2.Background));
65 }); 65 });
66 66
67 /** Tests that ChromeVox reads the desktop tree. */ 67 /** Tests that ChromeVox reads the desktop tree. */
68 TEST_F('BackgroundTest', 'DesktopFocus', function() { 68 TEST_F('BackgroundTest', 'DesktopFocus', function() {
69 function findStatusTray(root) { 69 function findStatusTray(root) {
70 if (root.role == chrome.automation.RoleType.button && 70 if (root.role == chrome.automation.RoleType.button &&
71 root.attributes.name == 'Status tray') { 71 root.attributes.name &&
72 root.attributes.name.indexOf('Status tray') != -1) {
72 return root; 73 return root;
73 } 74 }
74 for (var i = 0; i < root.children().length; i++) { 75 for (var i = 0; i < root.children().length; i++) {
75 var found = findStatusTray(root.children()[i]); 76 var found = findStatusTray(root.children()[i]);
76 if (found) 77 if (found)
77 return found; 78 return found;
78 } 79 }
79 return null; 80 return null;
80 } 81 }
81 82
82 chrome.automation.getDesktop(function(root) { 83 chrome.automation.getDesktop(function(root) {
83 var testButton = findStatusTray(root); 84 var testButton = findStatusTray(root);
84 testButton.addEventListener(chrome.automation.EventType.focus, 85 testButton.addEventListener(chrome.automation.EventType.focus,
85 function(e) { 86 function(e) {
86 var result = 87 var result =
87 cvox.ChromeVox.tts.checkIfTextWasSpoken('Status tray button'); 88 cvox.ChromeVox.tts.checkIfSubstringWasSpoken('Status tray');
88 testDone([result, '']); 89 testDone([result, '']);
89 }, 90 },
90 true); 91 true);
91 testButton.focus(); 92 testButton.focus();
92 }); 93 });
93 }); 94 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698