OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ash/test/ash_test_helper.h" | 5 #include "ash/test/ash_test_helper.h" |
6 | 6 |
7 #include "ash/accelerators/accelerator_controller.h" | 7 #include "ash/accelerators/accelerator_controller.h" |
8 #include "ash/ash_switches.h" | 8 #include "ash/ash_switches.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/test/ash_test_views_delegate.h" | |
11 #include "ash/test/display_manager_test_api.h" | 10 #include "ash/test/display_manager_test_api.h" |
12 #include "ash/test/shell_test_api.h" | 11 #include "ash/test/shell_test_api.h" |
13 #include "ash/test/test_screenshot_delegate.h" | 12 #include "ash/test/test_screenshot_delegate.h" |
14 #include "ash/test/test_session_state_delegate.h" | 13 #include "ash/test/test_session_state_delegate.h" |
15 #include "ash/test/test_shell_delegate.h" | 14 #include "ash/test/test_shell_delegate.h" |
16 #include "ash/test/test_system_tray_delegate.h" | 15 #include "ash/test/test_system_tray_delegate.h" |
17 #include "base/run_loop.h" | 16 #include "base/run_loop.h" |
18 #include "ui/aura/env.h" | 17 #include "ui/aura/env.h" |
19 #include "ui/aura/input_state_lookup.h" | 18 #include "ui/aura/input_state_lookup.h" |
20 #include "ui/aura/test/env_test_helper.h" | 19 #include "ui/aura/test/env_test_helper.h" |
21 #include "ui/base/ime/input_method_initializer.h" | 20 #include "ui/base/ime/input_method_initializer.h" |
22 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 21 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
23 #include "ui/compositor/test/context_factories_for_test.h" | 22 #include "ui/compositor/test/context_factories_for_test.h" |
24 #include "ui/message_center/message_center.h" | 23 #include "ui/message_center/message_center.h" |
25 #include "ui/wm/core/capture_controller.h" | 24 #include "ui/wm/core/capture_controller.h" |
| 25 #include "ui/wm/core/wm_state.h" |
26 | 26 |
27 #if defined(OS_CHROMEOS) | 27 #if defined(OS_CHROMEOS) |
28 #include "chromeos/audio/cras_audio_handler.h" | 28 #include "chromeos/audio/cras_audio_handler.h" |
29 #include "chromeos/dbus/dbus_thread_manager.h" | 29 #include "chromeos/dbus/dbus_thread_manager.h" |
30 #include "ui/keyboard/keyboard.h" | 30 #include "ui/keyboard/keyboard.h" |
31 #endif | 31 #endif |
32 | 32 |
33 #if defined(OS_WIN) | 33 #if defined(OS_WIN) |
34 #include "base/win/windows_version.h" | 34 #include "base/win/windows_version.h" |
35 #endif | 35 #endif |
(...skipping 13 matching lines...) Expand all Loading... |
49 CHECK(message_loop_); | 49 CHECK(message_loop_); |
50 #if defined(USE_X11) | 50 #if defined(USE_X11) |
51 aura::test::SetUseOverrideRedirectWindowByDefault(true); | 51 aura::test::SetUseOverrideRedirectWindowByDefault(true); |
52 #endif | 52 #endif |
53 } | 53 } |
54 | 54 |
55 AshTestHelper::~AshTestHelper() { | 55 AshTestHelper::~AshTestHelper() { |
56 } | 56 } |
57 | 57 |
58 void AshTestHelper::SetUp(bool start_session) { | 58 void AshTestHelper::SetUp(bool start_session) { |
59 views_delegate_.reset(new AshTestViewsDelegate); | 59 wm_state_.reset(new wm::WMState); |
60 | 60 |
61 // Disable animations during tests. | 61 // Disable animations during tests. |
62 zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode( | 62 zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode( |
63 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)); | 63 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)); |
64 ui::InitializeInputMethodForTesting(); | 64 ui::InitializeInputMethodForTesting(); |
65 | 65 |
66 bool enable_pixel_output = false; | 66 bool enable_pixel_output = false; |
67 ui::InitializeContextFactoryForTests(enable_pixel_output); | 67 ui::InitializeContextFactoryForTests(enable_pixel_output); |
68 | 68 |
69 // Creates Shell and hook with Desktop. | 69 // Creates Shell and hook with Desktop. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 ui::TerminateContextFactoryForTests(); | 126 ui::TerminateContextFactoryForTests(); |
127 | 127 |
128 // Need to reset the initial login status. | 128 // Need to reset the initial login status. |
129 TestSystemTrayDelegate::SetInitialLoginStatus(user::LOGGED_IN_USER); | 129 TestSystemTrayDelegate::SetInitialLoginStatus(user::LOGGED_IN_USER); |
130 | 130 |
131 ui::ShutdownInputMethodForTesting(); | 131 ui::ShutdownInputMethodForTesting(); |
132 zero_duration_mode_.reset(); | 132 zero_duration_mode_.reset(); |
133 | 133 |
134 CHECK(!wm::ScopedCaptureClient::IsActive()); | 134 CHECK(!wm::ScopedCaptureClient::IsActive()); |
135 | 135 |
136 views_delegate_.reset(); | 136 wm_state_.reset(); |
137 } | 137 } |
138 | 138 |
139 void AshTestHelper::RunAllPendingInMessageLoop() { | 139 void AshTestHelper::RunAllPendingInMessageLoop() { |
140 DCHECK(base::MessageLoopForUI::current() == message_loop_); | 140 DCHECK(base::MessageLoopForUI::current() == message_loop_); |
141 aura::Env::CreateInstance(true); | 141 aura::Env::CreateInstance(true); |
142 base::RunLoop run_loop; | 142 base::RunLoop run_loop; |
143 run_loop.RunUntilIdle(); | 143 run_loop.RunUntilIdle(); |
144 } | 144 } |
145 | 145 |
146 aura::Window* AshTestHelper::CurrentContext() { | 146 aura::Window* AshTestHelper::CurrentContext() { |
(...skipping 17 matching lines...) Expand all Loading... |
164 bool AshTestHelper::SupportsHostWindowResize() { | 164 bool AshTestHelper::SupportsHostWindowResize() { |
165 #if defined(OS_WIN) | 165 #if defined(OS_WIN) |
166 return false; | 166 return false; |
167 #else | 167 #else |
168 return true; | 168 return true; |
169 #endif | 169 #endif |
170 } | 170 } |
171 | 171 |
172 } // namespace test | 172 } // namespace test |
173 } // namespace ash | 173 } // namespace ash |
OLD | NEW |