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/ash_switches.h" | |
10 #include "ash/common/material_design/material_design_controller.h" | 9 #include "ash/common/material_design/material_design_controller.h" |
11 #include "ash/shell.h" | 10 #include "ash/shell.h" |
12 #include "ash/shell_init_params.h" | 11 #include "ash/shell_init_params.h" |
13 #include "ash/test/ash_test_helper.h" | 12 #include "ash/test/ash_test_helper.h" |
14 #include "ash/test/test_session_state_delegate.h" | 13 #include "ash/test/test_session_state_delegate.h" |
15 #include "ash/test/test_shell_delegate.h" | 14 #include "ash/test/test_shell_delegate.h" |
16 #include "base/command_line.h" | 15 #include "base/command_line.h" |
17 #include "base/macros.h" | 16 #include "base/macros.h" |
18 #include "chromeos/audio/cras_audio_handler.h" | 17 #include "chromeos/audio/cras_audio_handler.h" |
19 #include "chromeos/dbus/dbus_thread_manager.h" | 18 #include "chromeos/dbus/dbus_thread_manager.h" |
20 #include "chromeos/network/network_handler.h" | 19 #include "chromeos/network/network_handler.h" |
21 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
22 #include "device/bluetooth/dbus/bluez_dbus_manager.h" | 21 #include "device/bluetooth/dbus/bluez_dbus_manager.h" |
23 #include "ui/aura/env.h" | 22 #include "ui/aura/env.h" |
24 #include "ui/aura/window_tree_host.h" | 23 #include "ui/aura/window_tree_host.h" |
| 24 #include "ui/display/display_switches.h" |
25 #include "ui/message_center/message_center.h" | 25 #include "ui/message_center/message_center.h" |
26 #include "ui/wm/core/wm_state.h" | 26 #include "ui/wm/core/wm_state.h" |
27 | 27 |
28 namespace { | 28 namespace { |
29 | 29 |
30 // ViewEventTestPlatformPart implementation for ChromeOS (chromeos=1). | 30 // ViewEventTestPlatformPart implementation for ChromeOS (chromeos=1). |
31 class ViewEventTestPlatformPartChromeOS : public ViewEventTestPlatformPart { | 31 class ViewEventTestPlatformPartChromeOS : public ViewEventTestPlatformPart { |
32 public: | 32 public: |
33 explicit ViewEventTestPlatformPartChromeOS( | 33 explicit ViewEventTestPlatformPartChromeOS( |
34 ui::ContextFactory* context_factory); | 34 ui::ContextFactory* context_factory); |
(...skipping 26 matching lines...) Expand all Loading... |
61 ash::MaterialDesignController::Initialize(); | 61 ash::MaterialDesignController::Initialize(); |
62 | 62 |
63 env_ = aura::Env::CreateInstance(); | 63 env_ = aura::Env::CreateInstance(); |
64 ash::test::TestShellDelegate* shell_delegate = | 64 ash::test::TestShellDelegate* shell_delegate = |
65 new ash::test::TestShellDelegate(); | 65 new ash::test::TestShellDelegate(); |
66 ash::ShellInitParams init_params; | 66 ash::ShellInitParams init_params; |
67 init_params.delegate = shell_delegate; | 67 init_params.delegate = shell_delegate; |
68 init_params.context_factory = context_factory; | 68 init_params.context_factory = context_factory; |
69 init_params.blocking_pool = content::BrowserThread::GetBlockingPool(); | 69 init_params.blocking_pool = content::BrowserThread::GetBlockingPool(); |
70 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 70 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
71 ash::switches::kAshHostWindowBounds, "0+0-1280x800"); | 71 switches::kHostWindowBounds, "0+0-1280x800"); |
72 ash::Shell::CreateInstance(init_params); | 72 ash::Shell::CreateInstance(init_params); |
73 ash::test::AshTestHelper::GetTestSessionStateDelegate()-> | 73 ash::test::AshTestHelper::GetTestSessionStateDelegate()-> |
74 SetActiveUserSessionStarted(true); | 74 SetActiveUserSessionStarted(true); |
75 GetContext()->GetHost()->Show(); | 75 GetContext()->GetHost()->Show(); |
76 } | 76 } |
77 | 77 |
78 ViewEventTestPlatformPartChromeOS::~ViewEventTestPlatformPartChromeOS() { | 78 ViewEventTestPlatformPartChromeOS::~ViewEventTestPlatformPartChromeOS() { |
79 ash::Shell::DeleteInstance(); | 79 ash::Shell::DeleteInstance(); |
80 env_.reset(); | 80 env_.reset(); |
81 | 81 |
82 chromeos::NetworkHandler::Shutdown(); | 82 chromeos::NetworkHandler::Shutdown(); |
83 chromeos::CrasAudioHandler::Shutdown(); | 83 chromeos::CrasAudioHandler::Shutdown(); |
84 bluez::BluezDBusManager::Shutdown(); | 84 bluez::BluezDBusManager::Shutdown(); |
85 chromeos::DBusThreadManager::Shutdown(); | 85 chromeos::DBusThreadManager::Shutdown(); |
86 // Ash Shell can't just live on its own without a browser process, we need to | 86 // Ash Shell can't just live on its own without a browser process, we need to |
87 // also shut down the message center. | 87 // also shut down the message center. |
88 message_center::MessageCenter::Shutdown(); | 88 message_center::MessageCenter::Shutdown(); |
89 } | 89 } |
90 | 90 |
91 } // namespace | 91 } // namespace |
92 | 92 |
93 // static | 93 // static |
94 ViewEventTestPlatformPart* ViewEventTestPlatformPart::Create( | 94 ViewEventTestPlatformPart* ViewEventTestPlatformPart::Create( |
95 ui::ContextFactory* context_factory) { | 95 ui::ContextFactory* context_factory) { |
96 return new ViewEventTestPlatformPartChromeOS(context_factory); | 96 return new ViewEventTestPlatformPartChromeOS(context_factory); |
97 } | 97 } |
OLD | NEW |