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