| 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_browser_process_test.h" | |
| 14 #include "chrome/test/base/testing_profile.h" | 13 #include "chrome/test/base/testing_profile.h" |
| 15 #include "content/common/notification_registrar.h" | 14 #include "content/common/notification_registrar.h" |
| 16 #include "content/common/notification_service.h" | 15 #include "content/common/notification_service.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 18 #include "views/controls/button/text_button.h" | 17 #include "views/controls/button/text_button.h" |
| 19 #include "views/layout/grid_layout.h" | 18 #include "views/layout/grid_layout.h" |
| 20 #include "views/views_delegate.h" | 19 #include "views/views_delegate.h" |
| 21 #include "views/widget/native_widget.h" | 20 #include "views/widget/native_widget.h" |
| 22 #include "views/widget/root_view.h" | 21 #include "views/widget/root_view.h" |
| 23 #include "views/widget/widget.h" | 22 #include "views/widget/widget.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 virtual const views::Widget* GetWidget() const OVERRIDE { | 82 virtual const views::Widget* GetWidget() const OVERRIDE { |
| 84 return contents_->GetWidget(); | 83 return contents_->GetWidget(); |
| 85 } | 84 } |
| 86 virtual views::Widget* GetWidget() OVERRIDE { return contents_->GetWidget(); } | 85 virtual views::Widget* GetWidget() OVERRIDE { return contents_->GetWidget(); } |
| 87 | 86 |
| 88 private: | 87 private: |
| 89 views::View* contents_; | 88 views::View* contents_; |
| 90 }; | 89 }; |
| 91 | 90 |
| 92 class AccessibilityEventRouterViewsTest | 91 class AccessibilityEventRouterViewsTest |
| 93 : public TestingBrowserProcessTest, | 92 : public testing::Test, |
| 94 public NotificationObserver { | 93 public NotificationObserver { |
| 95 public: | 94 public: |
| 96 virtual void SetUp() { | 95 virtual void SetUp() { |
| 97 views::ViewsDelegate::views_delegate = new AccessibilityViewsDelegate(); | 96 views::ViewsDelegate::views_delegate = new AccessibilityViewsDelegate(); |
| 98 window_delegate_ = NULL; | 97 window_delegate_ = NULL; |
| 99 } | 98 } |
| 100 | 99 |
| 101 virtual void TearDown() { | 100 virtual void TearDown() { |
| 102 delete views::ViewsDelegate::views_delegate; | 101 delete views::ViewsDelegate::views_delegate; |
| 103 views::ViewsDelegate::views_delegate = NULL; | 102 views::ViewsDelegate::views_delegate = NULL; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 EXPECT_EQ(2, focus_event_count_); | 184 EXPECT_EQ(2, focus_event_count_); |
| 186 EXPECT_EQ(kButton3NewASCII, last_control_name_); | 185 EXPECT_EQ(kButton3NewASCII, last_control_name_); |
| 187 | 186 |
| 188 // Advance to button 1 and check the notification. | 187 // Advance to button 1 and check the notification. |
| 189 focus_manager->AdvanceFocus(false); | 188 focus_manager->AdvanceFocus(false); |
| 190 EXPECT_EQ(3, focus_event_count_); | 189 EXPECT_EQ(3, focus_event_count_); |
| 191 EXPECT_EQ(kButton1ASCII, last_control_name_); | 190 EXPECT_EQ(kButton1ASCII, last_control_name_); |
| 192 } | 191 } |
| 193 | 192 |
| 194 #endif // defined(TOOLKIT_VIEWS) | 193 #endif // defined(TOOLKIT_VIEWS) |
| OLD | NEW |