| 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 "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/shell_init_params.h" | 8 #include "ash/shell_init_params.h" |
| 9 #include "ash/test/ash_test_helper.h" | 9 #include "ash/test/ash_test_helper.h" |
| 10 #include "ash/test/test_session_state_delegate.h" | 10 #include "ash/test/test_session_state_delegate.h" |
| 11 #include "ash/test/test_shell_delegate.h" | 11 #include "ash/test/test_shell_delegate.h" |
| 12 #include "chromeos/audio/cras_audio_handler.h" | 12 #include "chromeos/audio/cras_audio_handler.h" |
| 13 #include "chromeos/dbus/dbus_thread_manager.h" | 13 #include "chromeos/dbus/dbus_thread_manager.h" |
| 14 #include "chromeos/network/network_handler.h" | 14 #include "chromeos/network/network_handler.h" |
| 15 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 16 #include "device/bluetooth/dbus/bluez_dbus_manager.h" |
| 16 #include "ui/aura/env.h" | 17 #include "ui/aura/env.h" |
| 17 #include "ui/aura/window_tree_host.h" | 18 #include "ui/aura/window_tree_host.h" |
| 18 #include "ui/message_center/message_center.h" | 19 #include "ui/message_center/message_center.h" |
| 19 #include "ui/wm/core/wm_state.h" | 20 #include "ui/wm/core/wm_state.h" |
| 20 | 21 |
| 21 namespace { | 22 namespace { |
| 22 | 23 |
| 23 // ViewEventTestPlatformPart implementation for ChromeOS (chromeos=1). | 24 // ViewEventTestPlatformPart implementation for ChromeOS (chromeos=1). |
| 24 class ViewEventTestPlatformPartChromeOS : public ViewEventTestPlatformPart { | 25 class ViewEventTestPlatformPartChromeOS : public ViewEventTestPlatformPart { |
| 25 public: | 26 public: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 37 | 38 |
| 38 DISALLOW_COPY_AND_ASSIGN(ViewEventTestPlatformPartChromeOS); | 39 DISALLOW_COPY_AND_ASSIGN(ViewEventTestPlatformPartChromeOS); |
| 39 }; | 40 }; |
| 40 | 41 |
| 41 ViewEventTestPlatformPartChromeOS::ViewEventTestPlatformPartChromeOS( | 42 ViewEventTestPlatformPartChromeOS::ViewEventTestPlatformPartChromeOS( |
| 42 ui::ContextFactory* context_factory) { | 43 ui::ContextFactory* context_factory) { |
| 43 // Ash Shell can't just live on its own without a browser process, we need to | 44 // Ash Shell can't just live on its own without a browser process, we need to |
| 44 // also create the message center. | 45 // also create the message center. |
| 45 message_center::MessageCenter::Initialize(); | 46 message_center::MessageCenter::Initialize(); |
| 46 chromeos::DBusThreadManager::Initialize(); | 47 chromeos::DBusThreadManager::Initialize(); |
| 48 bluez::BluezDBusManager::Initialize( |
| 49 chromeos::DBusThreadManager::Get()->GetSystemBus(), |
| 50 chromeos::DBusThreadManager::Get()->IsUsingStub( |
| 51 chromeos::DBusClientBundle::BLUETOOTH)); |
| 47 chromeos::CrasAudioHandler::InitializeForTesting(); | 52 chromeos::CrasAudioHandler::InitializeForTesting(); |
| 48 chromeos::NetworkHandler::Initialize(); | 53 chromeos::NetworkHandler::Initialize(); |
| 49 | 54 |
| 50 aura::Env::CreateInstance(true); | 55 aura::Env::CreateInstance(true); |
| 51 ash::test::TestShellDelegate* shell_delegate = | 56 ash::test::TestShellDelegate* shell_delegate = |
| 52 new ash::test::TestShellDelegate(); | 57 new ash::test::TestShellDelegate(); |
| 53 ash::ShellInitParams init_params; | 58 ash::ShellInitParams init_params; |
| 54 init_params.delegate = shell_delegate; | 59 init_params.delegate = shell_delegate; |
| 55 init_params.context_factory = context_factory; | 60 init_params.context_factory = context_factory; |
| 56 init_params.blocking_pool = content::BrowserThread::GetBlockingPool(); | 61 init_params.blocking_pool = content::BrowserThread::GetBlockingPool(); |
| 57 ash::Shell::CreateInstance(init_params); | 62 ash::Shell::CreateInstance(init_params); |
| 58 ash::test::AshTestHelper::GetTestSessionStateDelegate()-> | 63 ash::test::AshTestHelper::GetTestSessionStateDelegate()-> |
| 59 SetActiveUserSessionStarted(true); | 64 SetActiveUserSessionStarted(true); |
| 60 GetContext()->GetHost()->Show(); | 65 GetContext()->GetHost()->Show(); |
| 61 } | 66 } |
| 62 | 67 |
| 63 ViewEventTestPlatformPartChromeOS::~ViewEventTestPlatformPartChromeOS() { | 68 ViewEventTestPlatformPartChromeOS::~ViewEventTestPlatformPartChromeOS() { |
| 64 ash::Shell::DeleteInstance(); | 69 ash::Shell::DeleteInstance(); |
| 65 aura::Env::DeleteInstance(); | 70 aura::Env::DeleteInstance(); |
| 66 | 71 |
| 67 chromeos::NetworkHandler::Shutdown(); | 72 chromeos::NetworkHandler::Shutdown(); |
| 68 chromeos::CrasAudioHandler::Shutdown(); | 73 chromeos::CrasAudioHandler::Shutdown(); |
| 74 bluez::BluezDBusManager::Shutdown(); |
| 69 chromeos::DBusThreadManager::Shutdown(); | 75 chromeos::DBusThreadManager::Shutdown(); |
| 70 // Ash Shell can't just live on its own without a browser process, we need to | 76 // Ash Shell can't just live on its own without a browser process, we need to |
| 71 // also shut down the message center. | 77 // also shut down the message center. |
| 72 message_center::MessageCenter::Shutdown(); | 78 message_center::MessageCenter::Shutdown(); |
| 73 } | 79 } |
| 74 | 80 |
| 75 } // namespace | 81 } // namespace |
| 76 | 82 |
| 77 // static | 83 // static |
| 78 ViewEventTestPlatformPart* ViewEventTestPlatformPart::Create( | 84 ViewEventTestPlatformPart* ViewEventTestPlatformPart::Create( |
| 79 ui::ContextFactory* context_factory) { | 85 ui::ContextFactory* context_factory) { |
| 80 return new ViewEventTestPlatformPartChromeOS(context_factory); | 86 return new ViewEventTestPlatformPartChromeOS(context_factory); |
| 81 } | 87 } |
| OLD | NEW |