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" |
11 #include "chrome/browser/ui/views/accessibility_event_router_views.h" | 11 #include "chrome/browser/ui/views/accessibility_event_router_views.h" |
12 #include "chrome/common/chrome_notification_types.h" | 12 #include "chrome/common/chrome_notification_types.h" |
13 #include "chrome/test/base/testing_profile.h" | 13 #include "chrome/test/base/testing_profile.h" |
14 #include "content/public/browser/notification_registrar.h" | 14 #include "content/public/browser/notification_registrar.h" |
15 #include "content/common/notification_service.h" | 15 #include "content/public/browser/notification_service.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 #include "views/controls/button/text_button.h" | 17 #include "views/controls/button/text_button.h" |
18 #include "views/layout/grid_layout.h" | 18 #include "views/layout/grid_layout.h" |
19 #include "views/views_delegate.h" | 19 #include "views/views_delegate.h" |
20 #include "views/widget/native_widget.h" | 20 #include "views/widget/native_widget.h" |
21 #include "views/widget/root_view.h" | 21 #include "views/widget/root_view.h" |
22 #include "views/widget/widget.h" | 22 #include "views/widget/widget.h" |
23 #include "views/widget/widget_delegate.h" | 23 #include "views/widget/widget_delegate.h" |
24 | 24 |
25 #if defined(TOOLKIT_VIEWS) | 25 #if defined(TOOLKIT_VIEWS) |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 // Put the view in a window. | 153 // Put the view in a window. |
154 views::Widget* window = CreateWindowWithContents(contents); | 154 views::Widget* window = CreateWindowWithContents(contents); |
155 | 155 |
156 // Set focus to the first button initially. | 156 // Set focus to the first button initially. |
157 button1->RequestFocus(); | 157 button1->RequestFocus(); |
158 | 158 |
159 // Start listening to ACCESSIBILITY_CONTROL_FOCUSED notifications. | 159 // Start listening to ACCESSIBILITY_CONTROL_FOCUSED notifications. |
160 content::NotificationRegistrar registrar; | 160 content::NotificationRegistrar registrar; |
161 registrar.Add(this, | 161 registrar.Add(this, |
162 chrome::NOTIFICATION_ACCESSIBILITY_CONTROL_FOCUSED, | 162 chrome::NOTIFICATION_ACCESSIBILITY_CONTROL_FOCUSED, |
163 NotificationService::AllSources()); | 163 content::NotificationService::AllSources()); |
164 | 164 |
165 // Switch on accessibility event notifications. | 165 // Switch on accessibility event notifications. |
166 ExtensionAccessibilityEventRouter* accessibility_event_router = | 166 ExtensionAccessibilityEventRouter* accessibility_event_router = |
167 ExtensionAccessibilityEventRouter::GetInstance(); | 167 ExtensionAccessibilityEventRouter::GetInstance(); |
168 accessibility_event_router->SetAccessibilityEnabled(true); | 168 accessibility_event_router->SetAccessibilityEnabled(true); |
169 | 169 |
170 // Create a profile and associate it with this window. | 170 // Create a profile and associate it with this window. |
171 TestingProfile profile; | 171 TestingProfile profile; |
172 window->SetNativeWindowProperty(Profile::kProfileKey, &profile); | 172 window->SetNativeWindowProperty(Profile::kProfileKey, &profile); |
173 | 173 |
(...skipping 13 matching lines...) Expand all Loading... |
187 EXPECT_EQ(2, focus_event_count_); | 187 EXPECT_EQ(2, focus_event_count_); |
188 EXPECT_EQ(kButton3NewASCII, last_control_name_); | 188 EXPECT_EQ(kButton3NewASCII, last_control_name_); |
189 | 189 |
190 // Advance to button 1 and check the notification. | 190 // Advance to button 1 and check the notification. |
191 focus_manager->AdvanceFocus(false); | 191 focus_manager->AdvanceFocus(false); |
192 EXPECT_EQ(3, focus_event_count_); | 192 EXPECT_EQ(3, focus_event_count_); |
193 EXPECT_EQ(kButton1ASCII, last_control_name_); | 193 EXPECT_EQ(kButton1ASCII, last_control_name_); |
194 } | 194 } |
195 | 195 |
196 #endif // defined(TOOLKIT_VIEWS) | 196 #endif // defined(TOOLKIT_VIEWS) |
OLD | NEW |