| 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/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/test/display_manager_test_api.h" | 9 #include "ash/test/display_manager_test_api.h" |
| 10 #include "ash/test/shell_test_api.h" | 10 #include "ash/test/shell_test_api.h" |
| 11 #include "ash/test/test_session_state_delegate.h" | 11 #include "ash/test/test_session_state_delegate.h" |
| 12 #include "ash/test/test_shell_delegate.h" | 12 #include "ash/test/test_shell_delegate.h" |
| 13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
| 14 #include "ui/aura/env.h" | 14 #include "ui/aura/env.h" |
| 15 #include "ui/base/ime/input_method_initializer.h" | 15 #include "ui/base/ime/input_method_initializer.h" |
| 16 #include "ui/compositor/compositor.h" |
| 16 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 17 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
| 17 #include "ui/message_center/message_center.h" | 18 #include "ui/message_center/message_center.h" |
| 18 | 19 |
| 19 #if defined(OS_CHROMEOS) | 20 #if defined(OS_CHROMEOS) |
| 20 #include "chromeos/audio/cras_audio_handler.h" | 21 #include "chromeos/audio/cras_audio_handler.h" |
| 21 #endif | 22 #endif |
| 22 | 23 |
| 23 #if defined(USE_X11) | 24 #if defined(USE_X11) |
| 24 #include "ui/aura/root_window_host_x11.h" | 25 #include "ui/aura/root_window_host_x11.h" |
| 25 #endif | 26 #endif |
| (...skipping 27 matching lines...) Expand all Loading... |
| 53 message_center::MessageCenter::Initialize(); | 54 message_center::MessageCenter::Initialize(); |
| 54 | 55 |
| 55 #if defined(OS_CHROMEOS) | 56 #if defined(OS_CHROMEOS) |
| 56 if (ash::switches::UseNewAudioHandler()) { | 57 if (ash::switches::UseNewAudioHandler()) { |
| 57 // Create CrasAuidoHandler for testing since g_browser_process is not | 58 // Create CrasAuidoHandler for testing since g_browser_process is not |
| 58 // created in AshTestBase tests. | 59 // created in AshTestBase tests. |
| 59 chromeos::CrasAudioHandler::InitializeForTesting(); | 60 chromeos::CrasAudioHandler::InitializeForTesting(); |
| 60 } | 61 } |
| 61 #endif | 62 #endif |
| 62 | 63 |
| 64 // The ContextFactory must exist before any Compositors are created. |
| 65 bool allow_test_contexts = true; |
| 66 ui::Compositor::InitializeContextFactoryForTests(allow_test_contexts); |
| 67 |
| 63 ash::Shell::CreateInstance(test_shell_delegate_); | 68 ash::Shell::CreateInstance(test_shell_delegate_); |
| 64 Shell* shell = Shell::GetInstance(); | 69 Shell* shell = Shell::GetInstance(); |
| 65 test_shell_delegate_->test_session_state_delegate()-> | 70 test_shell_delegate_->test_session_state_delegate()-> |
| 66 SetActiveUserSessionStarted(true); | 71 SetActiveUserSessionStarted(true); |
| 67 test_shell_delegate_->test_session_state_delegate()->SetHasActiveUser(true); | 72 test_shell_delegate_->test_session_state_delegate()->SetHasActiveUser(true); |
| 68 | 73 |
| 69 test::DisplayManagerTestApi(shell->display_manager()). | 74 test::DisplayManagerTestApi(shell->display_manager()). |
| 70 DisableChangeDisplayUponHostResize(); | 75 DisableChangeDisplayUponHostResize(); |
| 71 ShellTestApi(shell).DisableOutputConfiguratorAnimation(); | 76 ShellTestApi(shell).DisableOutputConfiguratorAnimation(); |
| 72 } | 77 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 100 aura::RootWindow* AshTestHelper::CurrentContext() { | 105 aura::RootWindow* AshTestHelper::CurrentContext() { |
| 101 aura::RootWindow* root_window = Shell::GetActiveRootWindow(); | 106 aura::RootWindow* root_window = Shell::GetActiveRootWindow(); |
| 102 if (!root_window) | 107 if (!root_window) |
| 103 root_window = Shell::GetPrimaryRootWindow(); | 108 root_window = Shell::GetPrimaryRootWindow(); |
| 104 DCHECK(root_window); | 109 DCHECK(root_window); |
| 105 return root_window; | 110 return root_window; |
| 106 } | 111 } |
| 107 | 112 |
| 108 } // namespace test | 113 } // namespace test |
| 109 } // namespace ash | 114 } // namespace ash |
| OLD | NEW |