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

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

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

Powered by Google App Engine
This is Rietveld 408576698