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

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

Issue 292443002: linux_aura: Compile ash into chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src
Patch Set: Rebase to ToT 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
« no previous file with comments | « chrome/installer/linux/debian/expected_deps ('k') | ui/app_list/views/app_list_view.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 "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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(USE_ASH)
115 #if defined(OS_WIN) 115 #if !defined(OS_CHROMEOS)
116 // http://crbug.com/154081 use ash::Shell code path below on win_ash bots when 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. 117 // interactive_ui_tests is brought up on that platform.
118 gfx::Screen::SetScreenInstance( 118 gfx::Screen::SetScreenInstance(
119 gfx::SCREEN_TYPE_NATIVE, views::CreateDesktopScreen()); 119 gfx::SCREEN_TYPE_NATIVE, views::CreateDesktopScreen());
120 120
121 #else // !OS_WIN 121 #else // !OS_CHROMEOS
122 // Ash Shell can't just live on its own without a browser process, we need to 122 // Ash Shell can't just live on its own without a browser process, we need to
123 // also create the message center. 123 // also create the message center.
124 message_center::MessageCenter::Initialize(); 124 message_center::MessageCenter::Initialize();
125 #if defined(OS_CHROMEOS) 125 #if defined(OS_CHROMEOS)
126 chromeos::DBusThreadManager::InitializeWithStub(); 126 chromeos::DBusThreadManager::InitializeWithStub();
127 chromeos::CrasAudioHandler::InitializeForTesting(); 127 chromeos::CrasAudioHandler::InitializeForTesting();
128 chromeos::NetworkHandler::Initialize(); 128 chromeos::NetworkHandler::Initialize();
129 #endif // OS_CHROMEOS 129 #endif // OS_CHROMEOS
130 ash::test::TestShellDelegate* shell_delegate = 130 ash::test::TestShellDelegate* shell_delegate =
131 new ash::test::TestShellDelegate(); 131 new ash::test::TestShellDelegate();
132 ash::ShellInitParams init_params; 132 ash::ShellInitParams init_params;
133 init_params.delegate = shell_delegate; 133 init_params.delegate = shell_delegate;
134 ash::Shell::CreateInstance(init_params); 134 ash::Shell::CreateInstance(init_params);
135 shell_delegate->test_session_state_delegate() 135 shell_delegate->test_session_state_delegate()
136 ->SetActiveUserSessionStarted(true); 136 ->SetActiveUserSessionStarted(true);
137 context = ash::Shell::GetPrimaryRootWindow(); 137 context = ash::Shell::GetPrimaryRootWindow();
138 context->GetHost()->Show(); 138 context->GetHost()->Show();
139 #endif // !OS_WIN 139 #endif // !OS_CHROMEOS
140 aura::Env::CreateInstance(true); 140 aura::Env::CreateInstance(true);
141 #elif defined(USE_AURA) 141 #elif defined(USE_AURA)
142 // Instead of using the ash shell, use an AuraTestHelper to create and manage 142 // Instead of using the ash shell, use an AuraTestHelper to create and manage
143 // the test screen. 143 // the test screen.
144 aura_test_helper_.reset( 144 aura_test_helper_.reset(
145 new aura::test::AuraTestHelper(base::MessageLoopForUI::current())); 145 new aura::test::AuraTestHelper(base::MessageLoopForUI::current()));
146 aura_test_helper_->SetUp(); 146 aura_test_helper_->SetUp();
147 new wm::DefaultActivationClient(aura_test_helper_->root_window()); 147 new wm::DefaultActivationClient(aura_test_helper_->root_window());
148 context = aura_test_helper_->root_window(); 148 context = aura_test_helper_->root_window();
149 #endif // !USE_ASH && USE_AURA 149 #endif // !USE_ASH && USE_AURA
150 150
151 window_ = views::Widget::CreateWindowWithContext(this, context); 151 window_ = views::Widget::CreateWindowWithContext(this, context);
152 } 152 }
153 153
154 void ViewEventTestBase::TearDown() { 154 void ViewEventTestBase::TearDown() {
155 if (window_) { 155 if (window_) {
156 window_->Close(); 156 window_->Close();
157 content::RunAllPendingInMessageLoop(); 157 content::RunAllPendingInMessageLoop();
158 window_ = NULL; 158 window_ = NULL;
159 } 159 }
160 160
161 ui::Clipboard::DestroyClipboardForCurrentThread(); 161 ui::Clipboard::DestroyClipboardForCurrentThread();
162 162
163 #if defined(USE_ASH) 163 #if defined(USE_ASH)
164 #if !defined(OS_WIN) 164 #if defined(OS_CHROMEOS)
165 ash::Shell::DeleteInstance(); 165 ash::Shell::DeleteInstance();
166 #if defined(OS_CHROMEOS)
167 chromeos::NetworkHandler::Shutdown(); 166 chromeos::NetworkHandler::Shutdown();
168 chromeos::CrasAudioHandler::Shutdown(); 167 chromeos::CrasAudioHandler::Shutdown();
169 chromeos::DBusThreadManager::Shutdown(); 168 chromeos::DBusThreadManager::Shutdown();
170 #endif
171 // Ash Shell can't just live on its own without a browser process, we need to 169 // Ash Shell can't just live on its own without a browser process, we need to
172 // also shut down the message center. 170 // also shut down the message center.
173 message_center::MessageCenter::Shutdown(); 171 message_center::MessageCenter::Shutdown();
174 #endif // !OS_WIN 172 #endif
175 aura::Env::DeleteInstance(); 173 aura::Env::DeleteInstance();
176 #elif defined(USE_AURA) 174 #elif defined(USE_AURA)
177 aura_test_helper_->TearDown(); 175 aura_test_helper_->TearDown();
178 #endif // !USE_ASH && USE_AURA 176 #endif // !USE_ASH && USE_AURA
179 177
180 ui::TerminateContextFactoryForTests(); 178 ui::TerminateContextFactoryForTests();
181 179
182 ui::ShutdownInputMethodForTesting(); 180 ui::ShutdownInputMethodForTesting();
183 views::ViewsDelegate::views_delegate = NULL; 181 views::ViewsDelegate::views_delegate = NULL;
184 182
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 dnd_thread_.reset(NULL); 245 dnd_thread_.reset(NULL);
248 } 246 }
249 247
250 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { 248 void ViewEventTestBase::RunTestMethod(const base::Closure& task) {
251 StopBackgroundThread(); 249 StopBackgroundThread();
252 250
253 task.Run(); 251 task.Run();
254 if (HasFatalFailure()) 252 if (HasFatalFailure())
255 Done(); 253 Done();
256 } 254 }
OLDNEW
« no previous file with comments | « chrome/installer/linux/debian/expected_deps ('k') | ui/app_list/views/app_list_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698