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

Side by Side Diff: chrome/browser/chromeos/login/wizard_accessibility_handler_unittest.cc

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/accessibility_events.h" 5 #include "chrome/browser/accessibility_events.h"
6 #include "chrome/browser/chromeos/login/wizard_accessibility_handler.h" 6 #include "chrome/browser/chromeos/login/wizard_accessibility_handler.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 using chromeos::EarconType; 9 using chromeos::EarconType;
10 using chromeos::WizardAccessibilityHandler; 10 using chromeos::WizardAccessibilityHandler;
11 11
12 namespace chromeos { 12 namespace chromeos {
13 13
14 class WizardAccessibilityHandlerTest : public testing::Test { 14 class WizardAccessibilityHandlerTest : public testing::Test {
15 protected: 15 protected:
16 void ChangeText(WizardAccessibilityHandler* handler, 16 void ChangeText(WizardAccessibilityHandler* handler,
17 AccessibilityTextBoxInfo* textbox_info, 17 AccessibilityTextBoxInfo* textbox_info,
18 const std::string& value, 18 const std::string& value,
19 int selection_start, 19 int selection_start,
20 int selection_end, 20 int selection_end,
21 std::string* description) { 21 std::string* description) {
22 textbox_info->SetValue(value, selection_start, selection_end); 22 textbox_info->SetValue(value, selection_start, selection_end);
23 EarconType earcon = chromeos::NO_EARCON; 23 EarconType earcon = chromeos::NO_EARCON;
24 handler->DescribeAccessibilityEvent( 24 handler->DescribeAccessibilityEvent(
25 NotificationType::ACCESSIBILITY_TEXT_CHANGED, 25 chrome::ACCESSIBILITY_TEXT_CHANGED,
26 textbox_info, 26 textbox_info,
27 description, 27 description,
28 &earcon); 28 &earcon);
29 } 29 }
30 }; 30 };
31 31
32 TEST_F(WizardAccessibilityHandlerTest, TestFocusEvents) { 32 TEST_F(WizardAccessibilityHandlerTest, TestFocusEvents) {
33 WizardAccessibilityHandler handler; 33 WizardAccessibilityHandler handler;
34 34
35 std::string description; 35 std::string description;
36 EarconType earcon; 36 EarconType earcon;
37 37
38 // No need to test every possible control, but test several types 38 // No need to test every possible control, but test several types
39 // to exercise different types of string concatenation. 39 // to exercise different types of string concatenation.
40 40
41 // NOTE: unittests are forced to run under the en-US locale, so it's 41 // NOTE: unittests are forced to run under the en-US locale, so it's
42 // safe to do these string comparisons without using l10n_util. 42 // safe to do these string comparisons without using l10n_util.
43 43
44 // Test a simple control. 44 // Test a simple control.
45 std::string button_name = "Save"; 45 std::string button_name = "Save";
46 AccessibilityButtonInfo button_info(NULL, button_name); 46 AccessibilityButtonInfo button_info(NULL, button_name);
47 handler.DescribeAccessibilityEvent( 47 handler.DescribeAccessibilityEvent(
48 NotificationType::ACCESSIBILITY_CONTROL_FOCUSED, 48 chrome::ACCESSIBILITY_CONTROL_FOCUSED,
49 &button_info, 49 &button_info,
50 &description, 50 &description,
51 &earcon); 51 &earcon);
52 EXPECT_EQ(chromeos::EARCON_BUTTON, earcon); 52 EXPECT_EQ(chromeos::EARCON_BUTTON, earcon);
53 EXPECT_EQ("Save Button", description); 53 EXPECT_EQ("Save Button", description);
54 54
55 // Test a control with multiple states. 55 // Test a control with multiple states.
56 std::string checkbox_name = "Accessibility"; 56 std::string checkbox_name = "Accessibility";
57 AccessibilityCheckboxInfo checkbox_info(NULL, checkbox_name, false); 57 AccessibilityCheckboxInfo checkbox_info(NULL, checkbox_name, false);
58 handler.DescribeAccessibilityEvent( 58 handler.DescribeAccessibilityEvent(
59 NotificationType::ACCESSIBILITY_CONTROL_FOCUSED, 59 chrome::ACCESSIBILITY_CONTROL_FOCUSED,
60 &checkbox_info, 60 &checkbox_info,
61 &description, 61 &description,
62 &earcon); 62 &earcon);
63 EXPECT_EQ(chromeos::EARCON_CHECK_OFF, earcon); 63 EXPECT_EQ(chromeos::EARCON_CHECK_OFF, earcon);
64 EXPECT_EQ("Accessibility Unchecked check box", description); 64 EXPECT_EQ("Accessibility Unchecked check box", description);
65 checkbox_info.SetChecked(true); 65 checkbox_info.SetChecked(true);
66 handler.DescribeAccessibilityEvent( 66 handler.DescribeAccessibilityEvent(
67 NotificationType::ACCESSIBILITY_CONTROL_FOCUSED, 67 chrome::ACCESSIBILITY_CONTROL_FOCUSED,
68 &checkbox_info, 68 &checkbox_info,
69 &description, 69 &description,
70 &earcon); 70 &earcon);
71 EXPECT_EQ(chromeos::EARCON_CHECK_ON, earcon); 71 EXPECT_EQ(chromeos::EARCON_CHECK_ON, earcon);
72 EXPECT_EQ("Accessibility Checked check box", description); 72 EXPECT_EQ("Accessibility Checked check box", description);
73 73
74 // Test a control with a value and index. 74 // Test a control with a value and index.
75 std::string combobox_name = "Language"; 75 std::string combobox_name = "Language";
76 std::string combobox_value = "English"; 76 std::string combobox_value = "English";
77 AccessibilityComboBoxInfo combobox_info( 77 AccessibilityComboBoxInfo combobox_info(
78 NULL, combobox_name, combobox_value, 12, 35); 78 NULL, combobox_name, combobox_value, 12, 35);
79 handler.DescribeAccessibilityEvent( 79 handler.DescribeAccessibilityEvent(
80 NotificationType::ACCESSIBILITY_CONTROL_FOCUSED, 80 chrome::ACCESSIBILITY_CONTROL_FOCUSED,
81 &combobox_info, 81 &combobox_info,
82 &description, 82 &description,
83 &earcon); 83 &earcon);
84 EXPECT_EQ(chromeos::EARCON_LISTBOX, earcon); 84 EXPECT_EQ(chromeos::EARCON_LISTBOX, earcon);
85 EXPECT_EQ("English Language Combo box 13 of 35", description); 85 EXPECT_EQ("English Language Combo box 13 of 35", description);
86 } 86 }
87 87
88 TEST_F(WizardAccessibilityHandlerTest, TestTextEvents) { 88 TEST_F(WizardAccessibilityHandlerTest, TestTextEvents) {
89 WizardAccessibilityHandler handler; 89 WizardAccessibilityHandler handler;
90 90
91 std::string description; 91 std::string description;
92 EarconType earcon; 92 EarconType earcon;
93 93
94 AccessibilityTextBoxInfo textbox_info(NULL, "", false); 94 AccessibilityTextBoxInfo textbox_info(NULL, "", false);
95 handler.DescribeAccessibilityEvent( 95 handler.DescribeAccessibilityEvent(
96 NotificationType::ACCESSIBILITY_CONTROL_FOCUSED, 96 chrome::ACCESSIBILITY_CONTROL_FOCUSED,
97 &textbox_info, 97 &textbox_info,
98 &description, 98 &description,
99 &earcon); 99 &earcon);
100 EXPECT_EQ("Text box", description); 100 EXPECT_EQ("Text box", description);
101 EXPECT_EQ(chromeos::EARCON_TEXTBOX, earcon); 101 EXPECT_EQ(chromeos::EARCON_TEXTBOX, earcon);
102 102
103 // Type "hello world.", one character at a time. 103 // Type "hello world.", one character at a time.
104 ChangeText(&handler, &textbox_info, "h", 1, 1, &description); 104 ChangeText(&handler, &textbox_info, "h", 1, 1, &description);
105 EXPECT_EQ("h", description); 105 EXPECT_EQ("h", description);
106 ChangeText(&handler, &textbox_info, "he", 2, 2, &description); 106 ChangeText(&handler, &textbox_info, "he", 2, 2, &description);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 EXPECT_EQ("Space", description); 155 EXPECT_EQ("Space", description);
156 ChangeText(&handler, &textbox_info, " world.", 4, 4, &description); 156 ChangeText(&handler, &textbox_info, " world.", 4, 4, &description);
157 EXPECT_EQ("Unselected", description); 157 EXPECT_EQ("Unselected", description);
158 158
159 // If the string suddenly changes, it should just speak the new value. 159 // If the string suddenly changes, it should just speak the new value.
160 ChangeText(&handler, &textbox_info, "Potato", 0, 0, &description); 160 ChangeText(&handler, &textbox_info, "Potato", 0, 0, &description);
161 EXPECT_EQ("Potato", description); 161 EXPECT_EQ("Potato", description);
162 } 162 }
163 163
164 } 164 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698