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 // Include test fixture. | 5 // Include test fixture. |
6 GEN_INCLUDE(['../testing/chromevox_unittest_base.js']); | 6 GEN_INCLUDE(['../testing/chromevox_unittest_base.js']); |
7 | 7 |
8 /** | 8 /** |
9 * Test fixture. | 9 * Test fixture. |
10 * @constructor | 10 * @constructor |
(...skipping 23 matching lines...) Expand all Loading... |
34 assertEquals('jump_commands', categories[6]); | 34 assertEquals('jump_commands', categories[6]); |
35 assertEquals('tables', categories[7]); | 35 assertEquals('tables', categories[7]); |
36 | 36 |
37 assertEquals('stop_speech_key', | 37 assertEquals('stop_speech_key', |
38 cvox.CommandStore.messageForCommand('stopSpeech')); | 38 cvox.CommandStore.messageForCommand('stopSpeech')); |
39 assertEquals('controlling_speech', | 39 assertEquals('controlling_speech', |
40 cvox.CommandStore.categoryForCommand('stopSpeech')); | 40 cvox.CommandStore.categoryForCommand('stopSpeech')); |
41 | 41 |
42 var controllingSpeechCmds = | 42 var controllingSpeechCmds = |
43 cvox.CommandStore.commandsForCategory('controlling_speech'); | 43 cvox.CommandStore.commandsForCategory('controlling_speech'); |
44 assertEquals(10, controllingSpeechCmds.length); | 44 assertEquals(11, controllingSpeechCmds.length); |
45 assertEquals('stopSpeech', controllingSpeechCmds[0]); | 45 assertEquals('stopSpeech', controllingSpeechCmds[0]); |
46 assertEquals('decreaseTtsRate', controllingSpeechCmds[1]); | 46 assertEquals('toggleChromeVox', controllingSpeechCmds[1]); |
47 assertEquals('increaseTtsRate', controllingSpeechCmds[2]); | 47 assertEquals('decreaseTtsRate', controllingSpeechCmds[2]); |
48 assertEquals('decreaseTtsPitch', controllingSpeechCmds[3]); | 48 assertEquals('increaseTtsRate', controllingSpeechCmds[3]); |
49 assertEquals('increaseTtsPitch', controllingSpeechCmds[4]); | 49 assertEquals('decreaseTtsPitch', controllingSpeechCmds[4]); |
| 50 assertEquals('increaseTtsPitch', controllingSpeechCmds[5]); |
50 }); | 51 }); |
51 | 52 |
52 | 53 |
53 /** Tests that undefined is returned for bad queries. */ | 54 /** Tests that undefined is returned for bad queries. */ |
54 TEST_F('CvoxCommandStoreUnitTest', 'InvalidQueries', function() { | 55 TEST_F('CvoxCommandStoreUnitTest', 'InvalidQueries', function() { |
55 assertThat(cvox.CommandStore.commandsForCategory('foo'), eqJSON([])); | 56 assertThat(cvox.CommandStore.commandsForCategory('foo'), eqJSON([])); |
56 assertTrue(undefined == cvox.CommandStore.categoryForCommand('foo')); | 57 assertTrue(undefined == cvox.CommandStore.categoryForCommand('foo')); |
57 assertTrue(undefined == cvox.CommandStore.messageForCommand('foo')); | 58 assertTrue(undefined == cvox.CommandStore.messageForCommand('foo')); |
58 }); | 59 }); |
59 | 60 |
60 | 61 |
61 /** Tests the validity of every command. */ | 62 /** Tests the validity of every command. */ |
62 TEST_F('CvoxCommandStoreUnitTest', 'CommandValidity', function() { | 63 TEST_F('CvoxCommandStoreUnitTest', 'CommandValidity', function() { |
63 var categories = cvox.CommandStore.categories(); | 64 var categories = cvox.CommandStore.categories(); |
64 for (var i = 0; i < categories.length; i++) { | 65 for (var i = 0; i < categories.length; i++) { |
65 var commands = cvox.CommandStore.commandsForCategory(categories[i]); | 66 var commands = cvox.CommandStore.commandsForCategory(categories[i]); |
66 for (j = 0; j < commands.length; j++) { | 67 for (j = 0; j < commands.length; j++) { |
67 var command = commands[j]; | 68 var command = commands[j]; |
68 assertEquals(command + ' function', | 69 assertEquals(command + ' function', |
69 command + ' ' + typeof(cvox.ChromeVoxUserCommands.commands[command])); | 70 command + ' ' + typeof(cvox.ChromeVoxUserCommands.commands[command])); |
70 } | 71 } |
71 } | 72 } |
72 }); | 73 }); |
OLD | NEW |