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

Side by Side Diff: chrome/test/base/view_event_test_base.cc

Issue 292323002: Unmangles ifdefs in ViewEventTestBase (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | « no previous file | no next file » | 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 "chrome/test/base/view_event_test_base.h" 5 #include "chrome/test/base/view_event_test_base.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 wm_state_.reset(new wm::WMState); 104 wm_state_.reset(new wm::WMState);
105 105
106 views::ViewsDelegate::views_delegate = &views_delegate_; 106 views::ViewsDelegate::views_delegate = &views_delegate_;
107 ui::InitializeInputMethodForTesting(); 107 ui::InitializeInputMethodForTesting();
108 gfx::NativeView context = NULL; 108 gfx::NativeView context = NULL;
109 109
110 // The ContextFactory must exist before any Compositors are created. 110 // The ContextFactory must exist before any Compositors are created.
111 bool enable_pixel_output = false; 111 bool enable_pixel_output = false;
112 ui::InitializeContextFactoryForTests(enable_pixel_output); 112 ui::InitializeContextFactoryForTests(enable_pixel_output);
113 113
114 #if defined(USE_ASH) 114 #if defined(OS_CHROMEOS)
115 #if !defined(OS_CHROMEOS)
116 // http://crbug.com/154081 use ash::Shell code path below on win_ash bots when
117 // interactive_ui_tests is brought up on that platform.
118 gfx::Screen::SetScreenInstance(
119 gfx::SCREEN_TYPE_NATIVE, views::CreateDesktopScreen());
120
121 #else // !OS_CHROMEOS
122 // Ash Shell can't just live on its own without a browser process, we need to 115 // Ash Shell can't just live on its own without a browser process, we need to
123 // also create the message center. 116 // also create the message center.
124 message_center::MessageCenter::Initialize(); 117 message_center::MessageCenter::Initialize();
125 #if defined(OS_CHROMEOS)
126 chromeos::DBusThreadManager::InitializeWithStub(); 118 chromeos::DBusThreadManager::InitializeWithStub();
127 chromeos::CrasAudioHandler::InitializeForTesting(); 119 chromeos::CrasAudioHandler::InitializeForTesting();
128 chromeos::NetworkHandler::Initialize(); 120 chromeos::NetworkHandler::Initialize();
129 #endif // OS_CHROMEOS
130 ash::test::TestShellDelegate* shell_delegate = 121 ash::test::TestShellDelegate* shell_delegate =
131 new ash::test::TestShellDelegate(); 122 new ash::test::TestShellDelegate();
132 ash::ShellInitParams init_params; 123 ash::ShellInitParams init_params;
133 init_params.delegate = shell_delegate; 124 init_params.delegate = shell_delegate;
134 ash::Shell::CreateInstance(init_params); 125 ash::Shell::CreateInstance(init_params);
135 shell_delegate->test_session_state_delegate() 126 shell_delegate->test_session_state_delegate()
136 ->SetActiveUserSessionStarted(true); 127 ->SetActiveUserSessionStarted(true);
137 context = ash::Shell::GetPrimaryRootWindow(); 128 context = ash::Shell::GetPrimaryRootWindow();
138 context->GetHost()->Show(); 129 context->GetHost()->Show();
139 #endif // !OS_CHROMEOS 130 #elif defined(USE_ASH)
131 // http://crbug.com/154081 use ash::Shell code path below on win_ash bots when
132 // interactive_ui_tests is brought up on that platform.
133 gfx::Screen::SetScreenInstance(
134 gfx::SCREEN_TYPE_NATIVE, views::CreateDesktopScreen());
140 aura::Env::CreateInstance(true); 135 aura::Env::CreateInstance(true);
141 #elif defined(USE_AURA) 136 #elif defined(USE_AURA)
142 // Instead of using the ash shell, use an AuraTestHelper to create and manage 137 // Instead of using the ash shell, use an AuraTestHelper to create and manage
143 // the test screen. 138 // the test screen.
144 aura_test_helper_.reset( 139 aura_test_helper_.reset(
145 new aura::test::AuraTestHelper(base::MessageLoopForUI::current())); 140 new aura::test::AuraTestHelper(base::MessageLoopForUI::current()));
146 aura_test_helper_->SetUp(); 141 aura_test_helper_->SetUp();
147 new wm::DefaultActivationClient(aura_test_helper_->root_window()); 142 new wm::DefaultActivationClient(aura_test_helper_->root_window());
148 context = aura_test_helper_->root_window(); 143 context = aura_test_helper_->root_window();
149 #endif // !USE_ASH && USE_AURA 144 #endif
150 145
151 window_ = views::Widget::CreateWindowWithContext(this, context); 146 window_ = views::Widget::CreateWindowWithContext(this, context);
152 } 147 }
153 148
154 void ViewEventTestBase::TearDown() { 149 void ViewEventTestBase::TearDown() {
155 if (window_) { 150 if (window_) {
156 window_->Close(); 151 window_->Close();
157 content::RunAllPendingInMessageLoop(); 152 content::RunAllPendingInMessageLoop();
158 window_ = NULL; 153 window_ = NULL;
159 } 154 }
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 dnd_thread_.reset(NULL); 240 dnd_thread_.reset(NULL);
246 } 241 }
247 242
248 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { 243 void ViewEventTestBase::RunTestMethod(const base::Closure& task) {
249 StopBackgroundThread(); 244 StopBackgroundThread();
250 245
251 task.Run(); 246 task.Run();
252 if (HasFatalFailure()) 247 if (HasFatalFailure())
253 Done(); 248 Done();
254 } 249 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698