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.h" | 9 #include "base/message_loop.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
11 #include "chrome/test/base/interactive_test_utils.h" | 11 #include "chrome/test/base/interactive_test_utils.h" |
12 #include "chrome/test/base/ui_controls.h" | 12 #include "chrome/test/base/ui_controls.h" |
13 #include "chrome/test/base/ui_test_utils.h" | 13 #include "chrome/test/base/ui_test_utils.h" |
14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
15 #include "ui/base/ime/text_input_test_support.h" | 15 #include "ui/base/ime/text_input_test_support.h" |
16 #include "ui/compositor/test/compositor_test_support.h" | 16 #include "ui/compositor/test/compositor_test_support.h" |
17 #include "ui/message_center/message_center.h" | |
18 #include "ui/views/view.h" | 17 #include "ui/views/view.h" |
19 #include "ui/views/widget/desktop_aura/desktop_screen.h" | 18 #include "ui/views/widget/desktop_aura/desktop_screen.h" |
20 #include "ui/views/widget/widget.h" | 19 #include "ui/views/widget/widget.h" |
21 | 20 |
| 21 #if defined(ENABLE_MESSAGE_CENTER) |
| 22 #include "ui/message_center/message_center.h" |
| 23 #endif |
| 24 |
22 #if defined(USE_ASH) | 25 #if defined(USE_ASH) |
23 #include "ash/shell.h" | 26 #include "ash/shell.h" |
24 #include "ash/test/test_shell_delegate.h" | 27 #include "ash/test/test_shell_delegate.h" |
25 #endif | 28 #endif |
26 | 29 |
27 #if defined(USE_AURA) | 30 #if defined(USE_AURA) |
28 #include "ui/aura/client/event_client.h" | 31 #include "ui/aura/client/event_client.h" |
29 #include "ui/aura/env.h" | 32 #include "ui/aura/env.h" |
30 #include "ui/aura/root_window.h" | 33 #include "ui/aura/root_window.h" |
31 #include "ui/aura/test/aura_test_helper.h" | 34 #include "ui/aura/test/aura_test_helper.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 ui::TextInputTestSupport::Initialize(); | 105 ui::TextInputTestSupport::Initialize(); |
103 ui::CompositorTestSupport::Initialize(); | 106 ui::CompositorTestSupport::Initialize(); |
104 gfx::NativeView context = NULL; | 107 gfx::NativeView context = NULL; |
105 #if defined(USE_ASH) | 108 #if defined(USE_ASH) |
106 #if defined(OS_WIN) | 109 #if defined(OS_WIN) |
107 // http://crbug.com/154081 use ash::Shell code path below on win_ash bots when | 110 // http://crbug.com/154081 use ash::Shell code path below on win_ash bots when |
108 // interactive_ui_tests is brought up on that platform. | 111 // interactive_ui_tests is brought up on that platform. |
109 gfx::Screen::SetScreenInstance( | 112 gfx::Screen::SetScreenInstance( |
110 gfx::SCREEN_TYPE_NATIVE, views::CreateDesktopScreen()); | 113 gfx::SCREEN_TYPE_NATIVE, views::CreateDesktopScreen()); |
111 #else | 114 #else |
| 115 #if defined(ENABLE_MESSAGE_CENTER) |
112 // Ash Shell can't just live on its own without a browser process, we need to | 116 // Ash Shell can't just live on its own without a browser process, we need to |
113 // also create the message center. | 117 // also create the message center. |
114 message_center::MessageCenter::Initialize(); | 118 message_center::MessageCenter::Initialize(); |
| 119 #endif |
115 #if defined(OS_CHROMEOS) | 120 #if defined(OS_CHROMEOS) |
116 chromeos::CrasAudioHandler::InitializeForTesting(); | 121 chromeos::CrasAudioHandler::InitializeForTesting(); |
117 #endif | 122 #endif |
118 ash::Shell::CreateInstance(new ash::test::TestShellDelegate()); | 123 ash::Shell::CreateInstance(new ash::test::TestShellDelegate()); |
119 context = ash::Shell::GetPrimaryRootWindow(); | 124 context = ash::Shell::GetPrimaryRootWindow(); |
120 #endif | 125 #endif |
121 #elif defined(USE_AURA) | 126 #elif defined(USE_AURA) |
122 // Instead of using the ash shell, use an AuraTestHelper to create and manage | 127 // Instead of using the ash shell, use an AuraTestHelper to create and manage |
123 // the test screen. | 128 // the test screen. |
124 aura_test_helper_.reset(new aura::test::AuraTestHelper(&message_loop_)); | 129 aura_test_helper_.reset(new aura::test::AuraTestHelper(&message_loop_)); |
(...skipping 17 matching lines...) Expand all Loading... |
142 #endif | 147 #endif |
143 window_ = NULL; | 148 window_ = NULL; |
144 } | 149 } |
145 #if defined(USE_ASH) | 150 #if defined(USE_ASH) |
146 #if defined(OS_WIN) | 151 #if defined(OS_WIN) |
147 #else | 152 #else |
148 ash::Shell::DeleteInstance(); | 153 ash::Shell::DeleteInstance(); |
149 #if defined(OS_CHROMEOS) | 154 #if defined(OS_CHROMEOS) |
150 chromeos::CrasAudioHandler::Shutdown(); | 155 chromeos::CrasAudioHandler::Shutdown(); |
151 #endif | 156 #endif |
| 157 #if defined(ENABLE_MESSAGE_CENTER) |
152 // Ash Shell can't just live on its own without a browser process, we need to | 158 // Ash Shell can't just live on its own without a browser process, we need to |
153 // also shut down the message center. | 159 // also shut down the message center. |
154 message_center::MessageCenter::Shutdown(); | 160 message_center::MessageCenter::Shutdown(); |
| 161 #endif |
155 aura::Env::DeleteInstance(); | 162 aura::Env::DeleteInstance(); |
156 #endif | 163 #endif |
157 #elif defined(USE_AURA) | 164 #elif defined(USE_AURA) |
158 aura_test_helper_->TearDown(); | 165 aura_test_helper_->TearDown(); |
159 #endif | 166 #endif |
160 ui::CompositorTestSupport::Terminate(); | 167 ui::CompositorTestSupport::Terminate(); |
161 ui::TextInputTestSupport::Shutdown(); | 168 ui::TextInputTestSupport::Shutdown(); |
162 } | 169 } |
163 | 170 |
164 bool ViewEventTestBase::CanResize() const { | 171 bool ViewEventTestBase::CanResize() const { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 dnd_thread_.reset(NULL); | 229 dnd_thread_.reset(NULL); |
223 } | 230 } |
224 | 231 |
225 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { | 232 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { |
226 StopBackgroundThread(); | 233 StopBackgroundThread(); |
227 | 234 |
228 task.Run(); | 235 task.Run(); |
229 if (HasFatalFailure()) | 236 if (HasFatalFailure()) |
230 Done(); | 237 Done(); |
231 } | 238 } |
OLD | NEW |