OLD | NEW |
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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 chromeos::CrasAudioHandler::InitializeForTesting(); | 119 chromeos::CrasAudioHandler::InitializeForTesting(); |
120 chromeos::NetworkHandler::Initialize(); | 120 chromeos::NetworkHandler::Initialize(); |
121 #endif // OS_CHROMEOS | 121 #endif // OS_CHROMEOS |
122 ash::test::TestShellDelegate* shell_delegate = | 122 ash::test::TestShellDelegate* shell_delegate = |
123 new ash::test::TestShellDelegate(); | 123 new ash::test::TestShellDelegate(); |
124 ash::Shell::CreateInstance(shell_delegate); | 124 ash::Shell::CreateInstance(shell_delegate); |
125 shell_delegate->test_session_state_delegate() | 125 shell_delegate->test_session_state_delegate() |
126 ->SetActiveUserSessionStarted(true); | 126 ->SetActiveUserSessionStarted(true); |
127 context = ash::Shell::GetPrimaryRootWindow(); | 127 context = ash::Shell::GetPrimaryRootWindow(); |
128 #endif // !OS_WIN | 128 #endif // !OS_WIN |
| 129 #if defined(USE_AURA) |
| 130 aura::Env::CreateInstance(); |
| 131 #endif |
| 132 |
129 #elif defined(USE_AURA) | 133 #elif defined(USE_AURA) |
130 // Instead of using the ash shell, use an AuraTestHelper to create and manage | 134 // Instead of using the ash shell, use an AuraTestHelper to create and manage |
131 // the test screen. | 135 // the test screen. |
132 aura_test_helper_.reset( | 136 aura_test_helper_.reset( |
133 new aura::test::AuraTestHelper(base::MessageLoopForUI::current())); | 137 new aura::test::AuraTestHelper(base::MessageLoopForUI::current())); |
134 aura_test_helper_->SetUp(); | 138 aura_test_helper_->SetUp(); |
135 context = aura_test_helper_->root_window(); | 139 context = aura_test_helper_->root_window(); |
136 #endif // USE_AURA | 140 #endif // USE_AURA |
137 window_ = views::Widget::CreateWindowWithContext(this, context); | 141 window_ = views::Widget::CreateWindowWithContext(this, context); |
138 } | 142 } |
(...skipping 12 matching lines...) Expand all Loading... |
151 #if defined(OS_WIN) | 155 #if defined(OS_WIN) |
152 #else | 156 #else |
153 ash::Shell::DeleteInstance(); | 157 ash::Shell::DeleteInstance(); |
154 #if defined(OS_CHROMEOS) | 158 #if defined(OS_CHROMEOS) |
155 chromeos::NetworkHandler::Shutdown(); | 159 chromeos::NetworkHandler::Shutdown(); |
156 chromeos::CrasAudioHandler::Shutdown(); | 160 chromeos::CrasAudioHandler::Shutdown(); |
157 #endif | 161 #endif |
158 // Ash Shell can't just live on its own without a browser process, we need to | 162 // Ash Shell can't just live on its own without a browser process, we need to |
159 // also shut down the message center. | 163 // also shut down the message center. |
160 message_center::MessageCenter::Shutdown(); | 164 message_center::MessageCenter::Shutdown(); |
| 165 #endif |
| 166 #if defined(USE_AURA) |
161 aura::Env::DeleteInstance(); | 167 aura::Env::DeleteInstance(); |
162 #endif | 168 #endif |
| 169 |
163 #elif defined(USE_AURA) | 170 #elif defined(USE_AURA) |
164 aura_test_helper_->TearDown(); | 171 aura_test_helper_->TearDown(); |
165 #endif | 172 #endif |
166 ui::ShutdownInputMethodForTesting(); | 173 ui::ShutdownInputMethodForTesting(); |
167 } | 174 } |
168 | 175 |
169 bool ViewEventTestBase::CanResize() const { | 176 bool ViewEventTestBase::CanResize() const { |
170 return true; | 177 return true; |
171 } | 178 } |
172 | 179 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 dnd_thread_.reset(NULL); | 234 dnd_thread_.reset(NULL); |
228 } | 235 } |
229 | 236 |
230 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { | 237 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { |
231 StopBackgroundThread(); | 238 StopBackgroundThread(); |
232 | 239 |
233 task.Run(); | 240 task.Run(); |
234 if (HasFatalFailure()) | 241 if (HasFatalFailure()) |
235 Done(); | 242 Done(); |
236 } | 243 } |
OLD | NEW |