| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_platform_part.h" | 5 #include "chrome/test/base/view_event_test_platform_part.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "ash/common/test/test_session_state_delegate.h" | 9 #include "ash/common/test/test_session_controller_client.h" |
| 10 #include "ash/common/wm_shell.h" |
| 10 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 11 #include "ash/shell_init_params.h" | 12 #include "ash/shell_init_params.h" |
| 12 #include "ash/test/ash_test_helper.h" | 13 #include "ash/test/ash_test_helper.h" |
| 13 #include "ash/test/test_shell_delegate.h" | 14 #include "ash/test/test_shell_delegate.h" |
| 14 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 15 #include "base/macros.h" | 16 #include "base/macros.h" |
| 16 #include "chromeos/audio/cras_audio_handler.h" | 17 #include "chromeos/audio/cras_audio_handler.h" |
| 17 #include "chromeos/dbus/dbus_thread_manager.h" | 18 #include "chromeos/dbus/dbus_thread_manager.h" |
| 18 #include "chromeos/network/network_handler.h" | 19 #include "chromeos/network/network_handler.h" |
| 19 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 ash::test::TestShellDelegate* shell_delegate = | 64 ash::test::TestShellDelegate* shell_delegate = |
| 64 new ash::test::TestShellDelegate(); | 65 new ash::test::TestShellDelegate(); |
| 65 ash::ShellInitParams init_params; | 66 ash::ShellInitParams init_params; |
| 66 init_params.delegate = shell_delegate; | 67 init_params.delegate = shell_delegate; |
| 67 init_params.context_factory = context_factory; | 68 init_params.context_factory = context_factory; |
| 68 init_params.context_factory_private = context_factory_private; | 69 init_params.context_factory_private = context_factory_private; |
| 69 init_params.blocking_pool = content::BrowserThread::GetBlockingPool(); | 70 init_params.blocking_pool = content::BrowserThread::GetBlockingPool(); |
| 70 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 71 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| 71 switches::kHostWindowBounds, "0+0-1280x800"); | 72 switches::kHostWindowBounds, "0+0-1280x800"); |
| 72 ash::Shell::CreateInstance(init_params); | 73 ash::Shell::CreateInstance(init_params); |
| 73 ash::test::AshTestHelper::GetTestSessionStateDelegate()-> | 74 ash::test::TestSessionControllerClient session_controller_client( |
| 74 SetActiveUserSessionStarted(true); | 75 ash::WmShell::Get()->session_controller()); |
| 76 session_controller_client.SetPredefinedUserSessions(1); |
| 75 GetContext()->GetHost()->Show(); | 77 GetContext()->GetHost()->Show(); |
| 76 } | 78 } |
| 77 | 79 |
| 78 ViewEventTestPlatformPartChromeOS::~ViewEventTestPlatformPartChromeOS() { | 80 ViewEventTestPlatformPartChromeOS::~ViewEventTestPlatformPartChromeOS() { |
| 79 ash::Shell::DeleteInstance(); | 81 ash::Shell::DeleteInstance(); |
| 80 env_.reset(); | 82 env_.reset(); |
| 81 | 83 |
| 82 chromeos::NetworkHandler::Shutdown(); | 84 chromeos::NetworkHandler::Shutdown(); |
| 83 chromeos::CrasAudioHandler::Shutdown(); | 85 chromeos::CrasAudioHandler::Shutdown(); |
| 84 bluez::BluezDBusManager::Shutdown(); | 86 bluez::BluezDBusManager::Shutdown(); |
| 85 chromeos::DBusThreadManager::Shutdown(); | 87 chromeos::DBusThreadManager::Shutdown(); |
| 86 // Ash Shell can't just live on its own without a browser process, we need to | 88 // Ash Shell can't just live on its own without a browser process, we need to |
| 87 // also shut down the message center. | 89 // also shut down the message center. |
| 88 message_center::MessageCenter::Shutdown(); | 90 message_center::MessageCenter::Shutdown(); |
| 89 } | 91 } |
| 90 | 92 |
| 91 } // namespace | 93 } // namespace |
| 92 | 94 |
| 93 // static | 95 // static |
| 94 ViewEventTestPlatformPart* ViewEventTestPlatformPart::Create( | 96 ViewEventTestPlatformPart* ViewEventTestPlatformPart::Create( |
| 95 ui::ContextFactory* context_factory, | 97 ui::ContextFactory* context_factory, |
| 96 ui::ContextFactoryPrivate* context_factory_private) { | 98 ui::ContextFactoryPrivate* context_factory_private) { |
| 97 return new ViewEventTestPlatformPartChromeOS(context_factory, | 99 return new ViewEventTestPlatformPartChromeOS(context_factory, |
| 98 context_factory_private); | 100 context_factory_private); |
| 99 } | 101 } |
| OLD | NEW |