| 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/display_manager_test_api.h" | 10 #include "ash/test/display_manager_test_api.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 CHECK(message_loop_); | 42 CHECK(message_loop_); |
| 43 #if defined(USE_X11) | 43 #if defined(USE_X11) |
| 44 aura::test::SetUseOverrideRedirectWindowByDefault(true); | 44 aura::test::SetUseOverrideRedirectWindowByDefault(true); |
| 45 #endif | 45 #endif |
| 46 } | 46 } |
| 47 | 47 |
| 48 AshTestHelper::~AshTestHelper() { | 48 AshTestHelper::~AshTestHelper() { |
| 49 } | 49 } |
| 50 | 50 |
| 51 void AshTestHelper::SetUp(bool start_session) { | 51 void AshTestHelper::SetUp(bool start_session) { |
| 52 // SetWindowStackingClient() takes ownership of TransientWindowStackingClient. |
| 53 aura::client::SetWindowStackingClient( |
| 54 new views::corewm::TransientWindowStackingClient); |
| 55 |
| 52 // Disable animations during tests. | 56 // Disable animations during tests. |
| 53 zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode( | 57 zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode( |
| 54 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)); | 58 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)); |
| 55 ui::InitializeInputMethodForTesting(); | 59 ui::InitializeInputMethodForTesting(); |
| 56 | 60 |
| 57 bool allow_test_contexts = true; | 61 bool allow_test_contexts = true; |
| 58 ui::InitializeContextFactoryForTests(allow_test_contexts); | 62 ui::InitializeContextFactoryForTests(allow_test_contexts); |
| 59 | 63 |
| 60 // Creates Shell and hook with Desktop. | 64 // Creates Shell and hook with Desktop. |
| 61 test_shell_delegate_ = new TestShellDelegate; | 65 test_shell_delegate_ = new TestShellDelegate; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 81 SetHasActiveUser(true); | 85 SetHasActiveUser(true); |
| 82 } | 86 } |
| 83 | 87 |
| 84 test::DisplayManagerTestApi(shell->display_manager()). | 88 test::DisplayManagerTestApi(shell->display_manager()). |
| 85 DisableChangeDisplayUponHostResize(); | 89 DisableChangeDisplayUponHostResize(); |
| 86 ShellTestApi(shell).DisableOutputConfiguratorAnimation(); | 90 ShellTestApi(shell).DisableOutputConfiguratorAnimation(); |
| 87 | 91 |
| 88 test_screenshot_delegate_ = new TestScreenshotDelegate(); | 92 test_screenshot_delegate_ = new TestScreenshotDelegate(); |
| 89 shell->accelerator_controller()->SetScreenshotDelegate( | 93 shell->accelerator_controller()->SetScreenshotDelegate( |
| 90 scoped_ptr<ScreenshotDelegate>(test_screenshot_delegate_)); | 94 scoped_ptr<ScreenshotDelegate>(test_screenshot_delegate_)); |
| 91 | |
| 92 // SetWindowStackingClient() takes ownership of TransientWindowStackingClient. | |
| 93 aura::client::SetWindowStackingClient( | |
| 94 new views::corewm::TransientWindowStackingClient); | |
| 95 } | 95 } |
| 96 | 96 |
| 97 void AshTestHelper::TearDown() { | 97 void AshTestHelper::TearDown() { |
| 98 // Tear down the shell. | 98 // Tear down the shell. |
| 99 Shell::DeleteInstance(); | 99 Shell::DeleteInstance(); |
| 100 test_screenshot_delegate_ = NULL; | 100 test_screenshot_delegate_ = NULL; |
| 101 | 101 |
| 102 // Remove global message center state. | 102 // Remove global message center state. |
| 103 message_center::MessageCenter::Shutdown(); | 103 message_center::MessageCenter::Shutdown(); |
| 104 | 104 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 130 aura::Window* AshTestHelper::CurrentContext() { | 130 aura::Window* AshTestHelper::CurrentContext() { |
| 131 aura::Window* root_window = Shell::GetTargetRootWindow(); | 131 aura::Window* root_window = Shell::GetTargetRootWindow(); |
| 132 if (!root_window) | 132 if (!root_window) |
| 133 root_window = Shell::GetPrimaryRootWindow(); | 133 root_window = Shell::GetPrimaryRootWindow(); |
| 134 DCHECK(root_window); | 134 DCHECK(root_window); |
| 135 return root_window; | 135 return root_window; |
| 136 } | 136 } |
| 137 | 137 |
| 138 } // namespace test | 138 } // namespace test |
| 139 } // namespace ash | 139 } // namespace ash |
| OLD | NEW |