| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/accessibility/accessibility_extension_api.h" | 10 #include "chrome/browser/accessibility/accessibility_extension_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/public/browser/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 "ui/base/accessibility/accessible_view_state.h" | 17 #include "ui/base/accessibility/accessible_view_state.h" |
| 18 #include "ui/views/controls/button/text_button.h" | 18 #include "ui/views/controls/button/text_button.h" |
| 19 #include "ui/views/controls/label.h" | 19 #include "ui/views/controls/label.h" |
| 20 #include "ui/views/layout/grid_layout.h" | 20 #include "ui/views/layout/grid_layout.h" |
| 21 #include "ui/views/views_delegate.h" | 21 #include "ui/views/views_delegate.h" |
| 22 #include "ui/views/widget/native_widget.h" | 22 #include "ui/views/widget/native_widget.h" |
| 23 #include "ui/views/widget/root_view.h" | 23 #include "ui/views/widget/root_view.h" |
| 24 #include "ui/views/widget/widget.h" | 24 #include "ui/views/widget/widget.h" |
| 25 #include "ui/views/widget/widget_delegate.h" | 25 #include "ui/views/widget/widget_delegate.h" |
| 26 | 26 |
| 27 #if defined(USE_AURA) | 27 #if defined(USE_AURA) |
| 28 #include "ui/aura/env.h" | |
| 29 #include "ui/aura/monitor_manager.h" | 28 #include "ui/aura/monitor_manager.h" |
| 30 #include "ui/aura/root_window.h" | 29 #include "ui/aura/root_window.h" |
| 31 #include "ui/aura/test/test_screen.h" | 30 #include "ui/aura/test/test_screen.h" |
| 32 #include "ui/aura/test/test_stacking_client.h" | 31 #include "ui/aura/test/test_stacking_client.h" |
| 33 #endif | 32 #endif |
| 34 | 33 |
| 35 #if defined(TOOLKIT_VIEWS) | 34 #if defined(TOOLKIT_VIEWS) |
| 36 | 35 |
| 37 class AccessibilityViewsDelegate : public views::ViewsDelegate { | 36 class AccessibilityViewsDelegate : public views::ViewsDelegate { |
| 38 public: | 37 public: |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 ui::AccessibilityTypes::Role role_; | 119 ui::AccessibilityTypes::Role role_; |
| 121 }; | 120 }; |
| 122 | 121 |
| 123 class AccessibilityEventRouterViewsTest | 122 class AccessibilityEventRouterViewsTest |
| 124 : public testing::Test, | 123 : public testing::Test, |
| 125 public content::NotificationObserver { | 124 public content::NotificationObserver { |
| 126 public: | 125 public: |
| 127 virtual void SetUp() { | 126 virtual void SetUp() { |
| 128 views::ViewsDelegate::views_delegate = new AccessibilityViewsDelegate(); | 127 views::ViewsDelegate::views_delegate = new AccessibilityViewsDelegate(); |
| 129 #if defined(USE_AURA) | 128 #if defined(USE_AURA) |
| 130 root_window_.reset(aura::Env::GetInstance()->monitor_manager()-> | 129 root_window_.reset( |
| 131 CreateRootWindowForPrimaryMonitor()); | 130 aura::MonitorManager::CreateRootWindowForPrimaryMonitor()); |
| 132 gfx::Screen::SetInstance(new aura::TestScreen(root_window_.get())); | 131 gfx::Screen::SetInstance(new aura::TestScreen(root_window_.get())); |
| 133 test_stacking_client_.reset( | 132 test_stacking_client_.reset( |
| 134 new aura::test::TestStackingClient(root_window_.get())); | 133 new aura::test::TestStackingClient(root_window_.get())); |
| 135 #endif | 134 #endif |
| 136 } | 135 } |
| 137 | 136 |
| 138 virtual void TearDown() { | 137 virtual void TearDown() { |
| 139 #if defined(USE_AURA) | 138 #if defined(USE_AURA) |
| 140 test_stacking_client_.reset(); | 139 test_stacking_client_.reset(); |
| 141 root_window_.reset(); | 140 root_window_.reset(); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 | 321 |
| 323 // Test that we got the event with the expected name and context. | 322 // Test that we got the event with the expected name and context. |
| 324 EXPECT_EQ(1, focus_event_count_); | 323 EXPECT_EQ(1, focus_event_count_); |
| 325 EXPECT_EQ(kButtonNameASCII, last_control_name_); | 324 EXPECT_EQ(kButtonNameASCII, last_control_name_); |
| 326 EXPECT_EQ(kAlertTextASCII, last_control_context_); | 325 EXPECT_EQ(kAlertTextASCII, last_control_context_); |
| 327 | 326 |
| 328 window->CloseNow(); | 327 window->CloseNow(); |
| 329 } | 328 } |
| 330 | 329 |
| 331 #endif // defined(TOOLKIT_VIEWS) | 330 #endif // defined(TOOLKIT_VIEWS) |
| OLD | NEW |