| 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/shell_init_params.h" | 10 #include "ash/shell_init_params.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 void AshTestHelper::SetUp(bool start_session) { | 59 void AshTestHelper::SetUp(bool start_session) { |
| 60 views_delegate_.reset(new AshTestViewsDelegate); | 60 views_delegate_.reset(new AshTestViewsDelegate); |
| 61 | 61 |
| 62 // Disable animations during tests. | 62 // Disable animations during tests. |
| 63 zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode( | 63 zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode( |
| 64 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)); | 64 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)); |
| 65 ui::InitializeInputMethodForTesting(); | 65 ui::InitializeInputMethodForTesting(); |
| 66 | 66 |
| 67 bool enable_pixel_output = false; | 67 bool enable_pixel_output = false; |
| 68 ui::InitializeContextFactoryForTests(enable_pixel_output); | 68 ui::ContextFactory* context_factory = |
| 69 ui::InitializeContextFactoryForTests(enable_pixel_output); |
| 69 | 70 |
| 70 // Creates Shell and hook with Desktop. | 71 // Creates Shell and hook with Desktop. |
| 71 if (!test_shell_delegate_) | 72 if (!test_shell_delegate_) |
| 72 test_shell_delegate_ = new TestShellDelegate; | 73 test_shell_delegate_ = new TestShellDelegate; |
| 73 | 74 |
| 74 // Creates MessageCenter since g_browser_process is not created in AshTestBase | 75 // Creates MessageCenter since g_browser_process is not created in AshTestBase |
| 75 // tests. | 76 // tests. |
| 76 message_center::MessageCenter::Initialize(); | 77 message_center::MessageCenter::Initialize(); |
| 77 | 78 |
| 78 #if defined(OS_CHROMEOS) | 79 #if defined(OS_CHROMEOS) |
| 79 // Create DBusThreadManager for testing. | 80 // Create DBusThreadManager for testing. |
| 80 if (!chromeos::DBusThreadManager::IsInitialized()) { | 81 if (!chromeos::DBusThreadManager::IsInitialized()) { |
| 81 chromeos::DBusThreadManager::InitializeWithStub(); | 82 chromeos::DBusThreadManager::InitializeWithStub(); |
| 82 dbus_thread_manager_initialized_ = true; | 83 dbus_thread_manager_initialized_ = true; |
| 83 } | 84 } |
| 84 // Create CrasAudioHandler for testing since g_browser_process is not | 85 // Create CrasAudioHandler for testing since g_browser_process is not |
| 85 // created in AshTestBase tests. | 86 // created in AshTestBase tests. |
| 86 chromeos::CrasAudioHandler::InitializeForTesting(); | 87 chromeos::CrasAudioHandler::InitializeForTesting(); |
| 87 #endif | 88 #endif |
| 88 ShellInitParams init_params; | 89 ShellInitParams init_params; |
| 89 init_params.delegate = test_shell_delegate_; | 90 init_params.delegate = test_shell_delegate_; |
| 91 init_params.context_factory = context_factory; |
| 90 ash::Shell::CreateInstance(init_params); | 92 ash::Shell::CreateInstance(init_params); |
| 91 aura::test::EnvTestHelper(aura::Env::GetInstance()).SetInputStateLookup( | 93 aura::test::EnvTestHelper(aura::Env::GetInstance()).SetInputStateLookup( |
| 92 scoped_ptr<aura::InputStateLookup>()); | 94 scoped_ptr<aura::InputStateLookup>()); |
| 93 | 95 |
| 94 Shell* shell = Shell::GetInstance(); | 96 Shell* shell = Shell::GetInstance(); |
| 95 if (start_session) { | 97 if (start_session) { |
| 96 test_shell_delegate_->test_session_state_delegate()-> | 98 test_shell_delegate_->test_session_state_delegate()-> |
| 97 SetActiveUserSessionStarted(true); | 99 SetActiveUserSessionStarted(true); |
| 98 test_shell_delegate_->test_session_state_delegate()-> | 100 test_shell_delegate_->test_session_state_delegate()-> |
| 99 SetHasActiveUser(true); | 101 SetHasActiveUser(true); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 bool AshTestHelper::SupportsHostWindowResize() { | 169 bool AshTestHelper::SupportsHostWindowResize() { |
| 168 #if defined(OS_WIN) | 170 #if defined(OS_WIN) |
| 169 return false; | 171 return false; |
| 170 #else | 172 #else |
| 171 return true; | 173 return true; |
| 172 #endif | 174 #endif |
| 173 } | 175 } |
| 174 | 176 |
| 175 } // namespace test | 177 } // namespace test |
| 176 } // namespace ash | 178 } // namespace ash |
| OLD | NEW |