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_test_utils.h" | 12 #include "chrome/test/base/ui_test_utils.h" |
13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
14 #include "ui/base/ime/input_method_initializer.h" | 14 #include "ui/base/ime/input_method_initializer.h" |
15 #include "ui/base/test/ui_controls.h" | 15 #include "ui/base/test/ui_controls.h" |
16 #include "ui/message_center/message_center.h" | 16 #include "ui/message_center/message_center.h" |
17 #include "ui/views/view.h" | 17 #include "ui/views/view.h" |
18 #include "ui/views/widget/desktop_aura/desktop_screen.h" | 18 #include "ui/views/widget/desktop_aura/desktop_screen.h" |
19 #include "ui/views/widget/widget.h" | 19 #include "ui/views/widget/widget.h" |
20 | 20 |
21 #if defined(USE_ASH) | 21 #if defined(USE_ASH) |
22 #include "ash/shell.h" | 22 #include "ash/shell.h" |
| 23 #include "ash/test/test_session_state_delegate.h" |
23 #include "ash/test/test_shell_delegate.h" | 24 #include "ash/test/test_shell_delegate.h" |
24 #endif | 25 #endif |
25 | 26 |
26 #if defined(USE_AURA) | 27 #if defined(USE_AURA) |
27 #include "ui/aura/client/event_client.h" | 28 #include "ui/aura/client/event_client.h" |
28 #include "ui/aura/env.h" | 29 #include "ui/aura/env.h" |
29 #include "ui/aura/root_window.h" | 30 #include "ui/aura/root_window.h" |
30 #include "ui/aura/test/aura_test_helper.h" | 31 #include "ui/aura/test/aura_test_helper.h" |
31 #endif | 32 #endif |
32 | 33 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 // interactive_ui_tests is brought up on that platform. | 102 // interactive_ui_tests is brought up on that platform. |
102 gfx::Screen::SetScreenInstance( | 103 gfx::Screen::SetScreenInstance( |
103 gfx::SCREEN_TYPE_NATIVE, views::CreateDesktopScreen()); | 104 gfx::SCREEN_TYPE_NATIVE, views::CreateDesktopScreen()); |
104 #else | 105 #else |
105 // Ash Shell can't just live on its own without a browser process, we need to | 106 // Ash Shell can't just live on its own without a browser process, we need to |
106 // also create the message center. | 107 // also create the message center. |
107 message_center::MessageCenter::Initialize(); | 108 message_center::MessageCenter::Initialize(); |
108 #if defined(OS_CHROMEOS) | 109 #if defined(OS_CHROMEOS) |
109 chromeos::CrasAudioHandler::InitializeForTesting(); | 110 chromeos::CrasAudioHandler::InitializeForTesting(); |
110 #endif | 111 #endif |
111 ash::Shell::CreateInstance(new ash::test::TestShellDelegate()); | 112 ash::test::TestShellDelegate* shell_delegate = |
| 113 new ash::test::TestShellDelegate(); |
| 114 ash::Shell::CreateInstance(shell_delegate); |
| 115 shell_delegate->test_session_state_delegate() |
| 116 ->SetActiveUserSessionStarted(true); |
112 context = ash::Shell::GetPrimaryRootWindow(); | 117 context = ash::Shell::GetPrimaryRootWindow(); |
113 #endif | 118 #endif |
114 #elif defined(USE_AURA) | 119 #elif defined(USE_AURA) |
115 // Instead of using the ash shell, use an AuraTestHelper to create and manage | 120 // Instead of using the ash shell, use an AuraTestHelper to create and manage |
116 // the test screen. | 121 // the test screen. |
117 aura_test_helper_.reset(new aura::test::AuraTestHelper(&message_loop_)); | 122 aura_test_helper_.reset(new aura::test::AuraTestHelper(&message_loop_)); |
118 aura_test_helper_->SetUp(); | 123 aura_test_helper_->SetUp(); |
119 context = aura_test_helper_->root_window(); | 124 context = aura_test_helper_->root_window(); |
120 #endif | 125 #endif |
121 window_ = views::Widget::CreateWindowWithContext(this, context); | 126 window_ = views::Widget::CreateWindowWithContext(this, context); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 dnd_thread_.reset(NULL); | 215 dnd_thread_.reset(NULL); |
211 } | 216 } |
212 | 217 |
213 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { | 218 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { |
214 StopBackgroundThread(); | 219 StopBackgroundThread(); |
215 | 220 |
216 task.Run(); | 221 task.Run(); |
217 if (HasFatalFailure()) | 222 if (HasFatalFailure()) |
218 Done(); | 223 Done(); |
219 } | 224 } |
OLD | NEW |