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

Side by Side Diff: chrome/browser/ui/views/accessibility/accessibility_event_router_views_unittest.cc

Issue 10913237: Allow the Views Delegate to provide the native widget. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/accessibility_event_router_views .h" 11 #include "chrome/browser/ui/views/accessibility/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/test/test_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/test/aura_test_helper.h" 28 #include "ui/aura/test/aura_test_helper.h"
29 #endif 29 #endif
30 30
31 #if defined(TOOLKIT_VIEWS) 31 #if defined(TOOLKIT_VIEWS)
32 32
33 class AccessibilityViewsDelegate : public views::ViewsDelegate { 33 class AccessibilityViewsDelegate : public views::TestViewsDelegate {
34 public: 34 public:
35 AccessibilityViewsDelegate() {} 35 AccessibilityViewsDelegate() {}
36 virtual ~AccessibilityViewsDelegate() {} 36 virtual ~AccessibilityViewsDelegate() {}
37 37
38 // Overridden from views::ViewsDelegate: 38 // Overridden from views::TestViewsDelegate:
39 virtual void SaveWindowPlacement(const views::Widget* window,
40 const std::string& window_name,
41 const gfx::Rect& bounds,
42 ui::WindowShowState show_state) OVERRIDE {
43 }
44 virtual bool GetSavedWindowPlacement(
45 const std::string& window_name,
46 gfx::Rect* bounds,
47 ui::WindowShowState* show_state) const OVERRIDE {
48 return false;
49 }
50 virtual void NotifyAccessibilityEvent( 39 virtual void NotifyAccessibilityEvent(
51 views::View* view, ui::AccessibilityTypes::Event event_type) OVERRIDE { 40 views::View* view, ui::AccessibilityTypes::Event event_type) OVERRIDE {
52 AccessibilityEventRouterViews::GetInstance()->HandleAccessibilityEvent( 41 AccessibilityEventRouterViews::GetInstance()->HandleAccessibilityEvent(
53 view, event_type); 42 view, event_type);
54 } 43 }
55 virtual void NotifyMenuItemFocused(const string16& menu_name,
56 const string16& menu_item_name,
57 int item_index,
58 int item_count,
59 bool has_submenu) OVERRIDE {}
60 #if defined(OS_WIN)
61 virtual HICON GetDefaultWindowIcon() const OVERRIDE {
62 return NULL;
63 }
64 #endif
65 virtual views::NonClientFrameView* CreateDefaultNonClientFrameView(
66 views::Widget* widget) OVERRIDE {
67 return NULL;
68 }
69 virtual bool UseTransparentWindows() const OVERRIDE {
70 return false;
71 }
72 virtual void AddRef() OVERRIDE {}
73 virtual void ReleaseRef() OVERRIDE {}
74
75 virtual int GetDispositionForEvent(int event_flags) OVERRIDE {
76 return 0;
77 }
78
79 #if defined(USE_AURA)
80 virtual views::NativeWidgetHelperAura* CreateNativeWidgetHelper(
81 views::NativeWidgetAura* native_widget) OVERRIDE {
82 return NULL;
83 }
84 #endif
85
86 virtual content::WebContents* CreateWebContents(
87 content::BrowserContext* browser_context,
88 content::SiteInstance* site_instance) OVERRIDE {
89 return NULL;
90 }
91 44
92 DISALLOW_COPY_AND_ASSIGN(AccessibilityViewsDelegate); 45 DISALLOW_COPY_AND_ASSIGN(AccessibilityViewsDelegate);
93 }; 46 };
94 47
95 class AccessibilityWindowDelegate : public views::WidgetDelegate { 48 class AccessibilityWindowDelegate : public views::WidgetDelegate {
96 public: 49 public:
97 explicit AccessibilityWindowDelegate(views::View* contents) 50 explicit AccessibilityWindowDelegate(views::View* contents)
98 : contents_(contents) { } 51 : contents_(contents) { }
99 52
100 // Overridden from views::WidgetDelegate: 53 // Overridden from views::WidgetDelegate:
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 283
331 // Test that we got the event with the expected name and context. 284 // Test that we got the event with the expected name and context.
332 EXPECT_EQ(1, focus_event_count_); 285 EXPECT_EQ(1, focus_event_count_);
333 EXPECT_EQ(kButtonNameASCII, last_control_name_); 286 EXPECT_EQ(kButtonNameASCII, last_control_name_);
334 EXPECT_EQ(kAlertTextASCII, last_control_context_); 287 EXPECT_EQ(kAlertTextASCII, last_control_context_);
335 288
336 window->CloseNow(); 289 window->CloseNow();
337 } 290 }
338 291
339 #endif // defined(TOOLKIT_VIEWS) 292 #endif // defined(TOOLKIT_VIEWS)
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698