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

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

Issue 296053009: Makes Env contain a ContextFactory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: foo Created 6 years, 7 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 | « chrome/browser/ui/ash/ash_init.cc ('k') | chrome/test/base/browser_with_test_window_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/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/accessibility/accessibility_extension_api.h" 10 #include "chrome/browser/accessibility/accessibility_extension_api.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 AccessibilityViewsDelegate() {} 45 AccessibilityViewsDelegate() {}
46 virtual ~AccessibilityViewsDelegate() {} 46 virtual ~AccessibilityViewsDelegate() {}
47 47
48 // Overridden from views::TestViewsDelegate: 48 // Overridden from views::TestViewsDelegate:
49 virtual void NotifyAccessibilityEvent( 49 virtual void NotifyAccessibilityEvent(
50 views::View* view, ui::AXEvent event_type) OVERRIDE { 50 views::View* view, ui::AXEvent event_type) OVERRIDE {
51 AccessibilityEventRouterViews::GetInstance()->HandleAccessibilityEvent( 51 AccessibilityEventRouterViews::GetInstance()->HandleAccessibilityEvent(
52 view, event_type); 52 view, event_type);
53 } 53 }
54 54
55 private:
55 DISALLOW_COPY_AND_ASSIGN(AccessibilityViewsDelegate); 56 DISALLOW_COPY_AND_ASSIGN(AccessibilityViewsDelegate);
56 }; 57 };
57 58
58 class AccessibilityWindowDelegate : public views::WidgetDelegate { 59 class AccessibilityWindowDelegate : public views::WidgetDelegate {
59 public: 60 public:
60 explicit AccessibilityWindowDelegate(views::View* contents) 61 explicit AccessibilityWindowDelegate(views::View* contents)
61 : contents_(contents) { } 62 : contents_(contents) { }
62 63
63 // Overridden from views::WidgetDelegate: 64 // Overridden from views::WidgetDelegate:
64 virtual void DeleteDelegate() OVERRIDE { delete this; } 65 virtual void DeleteDelegate() OVERRIDE { delete this; }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 } 104 }
104 105
105 virtual void SetUp() { 106 virtual void SetUp() {
106 #if defined(OS_WIN) 107 #if defined(OS_WIN)
107 ole_initializer_.reset(new ui::ScopedOleInitializer()); 108 ole_initializer_.reset(new ui::ScopedOleInitializer());
108 #endif 109 #endif
109 views::ViewsDelegate::views_delegate = new AccessibilityViewsDelegate(); 110 views::ViewsDelegate::views_delegate = new AccessibilityViewsDelegate();
110 #if defined(USE_AURA) 111 #if defined(USE_AURA)
111 // The ContextFactory must exist before any Compositors are created. 112 // The ContextFactory must exist before any Compositors are created.
112 bool enable_pixel_output = false; 113 bool enable_pixel_output = false;
113 ui::InitializeContextFactoryForTests(enable_pixel_output); 114 ui::ContextFactory* context_factory =
115 ui::InitializeContextFactoryForTests(enable_pixel_output);
114 116
115 aura_test_helper_.reset(new aura::test::AuraTestHelper(&message_loop_)); 117 aura_test_helper_.reset(new aura::test::AuraTestHelper(&message_loop_));
116 aura_test_helper_->SetUp(); 118 aura_test_helper_->SetUp(context_factory);
117 new wm::DefaultActivationClient(aura_test_helper_->root_window()); 119 new wm::DefaultActivationClient(aura_test_helper_->root_window());
118 #endif // USE_AURA 120 #endif // USE_AURA
119 EnableAccessibilityAndListenToFocusNotifications(); 121 EnableAccessibilityAndListenToFocusNotifications();
120 } 122 }
121 123
122 virtual void TearDown() { 124 virtual void TearDown() {
123 ClearCallback(); 125 ClearCallback();
124 #if defined(USE_AURA) 126 #if defined(USE_AURA)
125 aura_test_helper_->TearDown(); 127 aura_test_helper_->TearDown();
126 ui::TerminateContextFactoryForTests(); 128 ui::TerminateContextFactoryForTests();
127 #endif 129 #endif
128 delete views::ViewsDelegate::views_delegate; 130 delete views::ViewsDelegate::views_delegate;
129 views::ViewsDelegate::views_delegate = NULL;
130 131
131 // The Widget's FocusManager is deleted using DeleteSoon - this 132 // The Widget's FocusManager is deleted using DeleteSoon - this
132 // forces it to be deleted now, so we don't have any memory leaks 133 // forces it to be deleted now, so we don't have any memory leaks
133 // when this method exits. 134 // when this method exits.
134 base::MessageLoop::current()->RunUntilIdle(); 135 base::MessageLoop::current()->RunUntilIdle();
135 136
136 #if defined(OS_WIN) 137 #if defined(OS_WIN)
137 ole_initializer_.reset(); 138 ole_initializer_.reset();
138 #endif 139 #endif
139 } 140 }
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 502
502 AccessibilityEventRouterViews::RecursiveGetMenuItemIndexAndCount( 503 AccessibilityEventRouterViews::RecursiveGetMenuItemIndexAndCount(
503 menu_container, 504 menu_container,
504 menu->GetMenuItemByID(kTestCases[i].command_id), 505 menu->GetMenuItemByID(kTestCases[i].command_id),
505 &index, 506 &index,
506 &count); 507 &count);
507 EXPECT_EQ(kTestCases[i].expected_index, index) << "Case " << i; 508 EXPECT_EQ(kTestCases[i].expected_index, index) << "Case " << i;
508 EXPECT_EQ(kTestCases[i].expected_count, count) << "Case " << i; 509 EXPECT_EQ(kTestCases[i].expected_count, count) << "Case " << i;
509 } 510 }
510 } 511 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/ash_init.cc ('k') | chrome/test/base/browser_with_test_window_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698