| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 ui::TextInputTestSupport::Initialize(); | 101 ui::TextInputTestSupport::Initialize(); |
| 105 ui::CompositorTestSupport::Initialize(); | 102 ui::CompositorTestSupport::Initialize(); |
| 106 gfx::NativeView context = NULL; | 103 gfx::NativeView context = NULL; |
| 107 #if defined(USE_ASH) | 104 #if defined(USE_ASH) |
| 108 #if defined(OS_WIN) | 105 #if defined(OS_WIN) |
| 109 // http://crbug.com/154081 use ash::Shell code path below on win_ash bots when | 106 // http://crbug.com/154081 use ash::Shell code path below on win_ash bots when |
| 110 // interactive_ui_tests is brought up on that platform. | 107 // interactive_ui_tests is brought up on that platform. |
| 111 gfx::Screen::SetScreenInstance( | 108 gfx::Screen::SetScreenInstance( |
| 112 gfx::SCREEN_TYPE_NATIVE, views::CreateDesktopScreen()); | 109 gfx::SCREEN_TYPE_NATIVE, views::CreateDesktopScreen()); |
| 113 #else | 110 #else |
| 114 #if defined(ENABLE_MESSAGE_CENTER) | |
| 115 // Ash Shell can't just live on its own without a browser process, we need to | 111 // Ash Shell can't just live on its own without a browser process, we need to |
| 116 // also create the message center. | 112 // also create the message center. |
| 117 message_center::MessageCenter::Initialize(); | 113 message_center::MessageCenter::Initialize(); |
| 118 #endif | |
| 119 #if defined(OS_CHROMEOS) | 114 #if defined(OS_CHROMEOS) |
| 120 chromeos::CrasAudioHandler::InitializeForTesting(); | 115 chromeos::CrasAudioHandler::InitializeForTesting(); |
| 121 #endif | 116 #endif |
| 122 ash::Shell::CreateInstance(new ash::test::TestShellDelegate()); | 117 ash::Shell::CreateInstance(new ash::test::TestShellDelegate()); |
| 123 context = ash::Shell::GetPrimaryRootWindow(); | 118 context = ash::Shell::GetPrimaryRootWindow(); |
| 124 #endif | 119 #endif |
| 125 #elif defined(USE_AURA) | 120 #elif defined(USE_AURA) |
| 126 // Instead of using the ash shell, use an AuraTestHelper to create and manage | 121 // Instead of using the ash shell, use an AuraTestHelper to create and manage |
| 127 // the test screen. | 122 // the test screen. |
| 128 aura_test_helper_.reset(new aura::test::AuraTestHelper(&message_loop_)); | 123 aura_test_helper_.reset(new aura::test::AuraTestHelper(&message_loop_)); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 146 #endif | 141 #endif |
| 147 window_ = NULL; | 142 window_ = NULL; |
| 148 } | 143 } |
| 149 #if defined(USE_ASH) | 144 #if defined(USE_ASH) |
| 150 #if defined(OS_WIN) | 145 #if defined(OS_WIN) |
| 151 #else | 146 #else |
| 152 ash::Shell::DeleteInstance(); | 147 ash::Shell::DeleteInstance(); |
| 153 #if defined(OS_CHROMEOS) | 148 #if defined(OS_CHROMEOS) |
| 154 chromeos::CrasAudioHandler::Shutdown(); | 149 chromeos::CrasAudioHandler::Shutdown(); |
| 155 #endif | 150 #endif |
| 156 #if defined(ENABLE_MESSAGE_CENTER) | |
| 157 // Ash Shell can't just live on its own without a browser process, we need to | 151 // Ash Shell can't just live on its own without a browser process, we need to |
| 158 // also shut down the message center. | 152 // also shut down the message center. |
| 159 message_center::MessageCenter::Shutdown(); | 153 message_center::MessageCenter::Shutdown(); |
| 160 #endif | |
| 161 aura::Env::DeleteInstance(); | 154 aura::Env::DeleteInstance(); |
| 162 #endif | 155 #endif |
| 163 #elif defined(USE_AURA) | 156 #elif defined(USE_AURA) |
| 164 aura_test_helper_->TearDown(); | 157 aura_test_helper_->TearDown(); |
| 165 #endif | 158 #endif |
| 166 ui::CompositorTestSupport::Terminate(); | 159 ui::CompositorTestSupport::Terminate(); |
| 167 ui::TextInputTestSupport::Shutdown(); | 160 ui::TextInputTestSupport::Shutdown(); |
| 168 } | 161 } |
| 169 | 162 |
| 170 bool ViewEventTestBase::CanResize() const { | 163 bool ViewEventTestBase::CanResize() const { |
| (...skipping 58 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 |