OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/extensions/extension_accessibility_api.h" | 10 #include "chrome/browser/extensions/extension_accessibility_api.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 focus_event_count_++; | 119 focus_event_count_++; |
120 last_control_name_ = info->name(); | 120 last_control_name_ = info->name(); |
121 } | 121 } |
122 | 122 |
123 MessageLoopForUI message_loop_; | 123 MessageLoopForUI message_loop_; |
124 int focus_event_count_; | 124 int focus_event_count_; |
125 std::string last_control_name_; | 125 std::string last_control_name_; |
126 AccessibilityWindowDelegate* window_delegate_; | 126 AccessibilityWindowDelegate* window_delegate_; |
127 }; | 127 }; |
128 | 128 |
129 // Crashes on Linux Aura, http://crbug.com/100338 | 129 TEST_F(AccessibilityEventRouterViewsTest, TestFocusNotification) { |
130 #if defined(USE_AURA) && !defined(OS_WIN) | |
131 #define MAYBE_TestFocusNotification DISABLED_TestFocusNotification | |
132 #else | |
133 #define MAYBE_TestFocusNotification TestFocusNotification | |
134 #endif | |
135 TEST_F(AccessibilityEventRouterViewsTest, MAYBE_TestFocusNotification) { | |
136 const char kButton1ASCII[] = "Button1"; | 130 const char kButton1ASCII[] = "Button1"; |
137 const char kButton2ASCII[] = "Button2"; | 131 const char kButton2ASCII[] = "Button2"; |
138 const char kButton3ASCII[] = "Button3"; | 132 const char kButton3ASCII[] = "Button3"; |
139 const char kButton3NewASCII[] = "Button3New"; | 133 const char kButton3NewASCII[] = "Button3New"; |
140 | 134 |
141 // Create a contents view with 3 buttons. | 135 // Create a contents view with 3 buttons. |
142 views::View* contents = new views::View(); | 136 views::View* contents = new views::View(); |
143 views::NativeTextButton* button1 = new views::NativeTextButton( | 137 views::NativeTextButton* button1 = new views::NativeTextButton( |
144 NULL, ASCIIToUTF16(kButton1ASCII)); | 138 NULL, ASCIIToUTF16(kButton1ASCII)); |
145 contents->AddChildView(button1); | 139 contents->AddChildView(button1); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 EXPECT_EQ(2, focus_event_count_); | 181 EXPECT_EQ(2, focus_event_count_); |
188 EXPECT_EQ(kButton3NewASCII, last_control_name_); | 182 EXPECT_EQ(kButton3NewASCII, last_control_name_); |
189 | 183 |
190 // Advance to button 1 and check the notification. | 184 // Advance to button 1 and check the notification. |
191 focus_manager->AdvanceFocus(false); | 185 focus_manager->AdvanceFocus(false); |
192 EXPECT_EQ(3, focus_event_count_); | 186 EXPECT_EQ(3, focus_event_count_); |
193 EXPECT_EQ(kButton1ASCII, last_control_name_); | 187 EXPECT_EQ(kButton1ASCII, last_control_name_); |
194 } | 188 } |
195 | 189 |
196 #endif // defined(TOOLKIT_VIEWS) | 190 #endif // defined(TOOLKIT_VIEWS) |
OLD | NEW |