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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/common/command_store_test.js

Issue 541403002: Rename ChromeVox tests and utilities for consistency. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: Clarify comment in .gypi file. 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
(Empty)
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
3 // found in the LICENSE file.
4
5 // Include test fixture.
6 GEN_INCLUDE(['../testing/chromevox_unittest_base.js']);
7
8 /**
9 * Test fixture.
10 * @constructor
11 * @extends {ChromeVoxUnitTestBase}
12 */
13 function CvoxCommandStoreUnitTest() {}
14
15 CvoxCommandStoreUnitTest.prototype = {
16 __proto__: ChromeVoxUnitTestBase.prototype,
17
18 /** @override */
19 closureModuleDeps: [
20 'cvox.ChromeVoxUserCommands',
21 'cvox.CommandStore',
22 ]
23 };
24
25 TEST_F('CvoxCommandStoreUnitTest', 'TableData', function() {
26 var categories = cvox.CommandStore.categories();
27 assertEquals(10, categories.length);
28 assertEquals('modifier_keys', categories[0]);
29 assertEquals('controlling_speech', categories[1]);
30 assertEquals('navigation', categories[2]);
31 assertEquals('information', categories[3]);
32 assertEquals('help_commands', categories[4]);
33 assertEquals('overview', categories[5]);
34 assertEquals('jump_commands', categories[6]);
35 assertEquals('tables', categories[7]);
36
37 assertEquals('stop_speech_key',
38 cvox.CommandStore.messageForCommand('stopSpeech'));
39 assertEquals('controlling_speech',
40 cvox.CommandStore.categoryForCommand('stopSpeech'));
41
42 var controllingSpeechCmds =
43 cvox.CommandStore.commandsForCategory('controlling_speech');
44 assertEquals(11, controllingSpeechCmds.length);
45 assertEquals('stopSpeech', controllingSpeechCmds[0]);
46 assertEquals('toggleChromeVox', controllingSpeechCmds[1]);
47 assertEquals('decreaseTtsRate', controllingSpeechCmds[2]);
48 assertEquals('increaseTtsRate', controllingSpeechCmds[3]);
49 assertEquals('decreaseTtsPitch', controllingSpeechCmds[4]);
50 assertEquals('increaseTtsPitch', controllingSpeechCmds[5]);
51 });
52
53
54 /** Tests that undefined is returned for bad queries. */
55 TEST_F('CvoxCommandStoreUnitTest', 'InvalidQueries', function() {
56 assertThat(cvox.CommandStore.commandsForCategory('foo'), eqJSON([]));
57 assertTrue(undefined == cvox.CommandStore.categoryForCommand('foo'));
58 assertTrue(undefined == cvox.CommandStore.messageForCommand('foo'));
59 });
60
61
62 /** Tests the validity of every command. */
63 TEST_F('CvoxCommandStoreUnitTest', 'CommandValidity', function() {
64 var categories = cvox.CommandStore.categories();
65 for (var i = 0; i < categories.length; i++) {
66 var commands = cvox.CommandStore.commandsForCategory(categories[i]);
67 for (j = 0; j < commands.length; j++) {
68 var command = commands[j];
69 assertEquals(command + ' function',
70 command + ' ' + typeof(cvox.ChromeVoxUserCommands.commands[command]));
71 }
72 }
73 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698