| 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" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 ui::ContextFactory* context_factory); | 26 ui::ContextFactory* context_factory); |
| 27 ~ViewEventTestPlatformPartChromeOS() override; | 27 ~ViewEventTestPlatformPartChromeOS() override; |
| 28 | 28 |
| 29 // Overridden from ViewEventTestPlatformPart: | 29 // Overridden from ViewEventTestPlatformPart: |
| 30 gfx::NativeWindow GetContext() override { | 30 gfx::NativeWindow GetContext() override { |
| 31 return ash::Shell::GetPrimaryRootWindow(); | 31 return ash::Shell::GetPrimaryRootWindow(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 private: | 34 private: |
| 35 wm::WMState wm_state_; | 35 wm::WMState wm_state_; |
| 36 scoped_ptr<aura::Env> env_; |
| 36 | 37 |
| 37 DISALLOW_COPY_AND_ASSIGN(ViewEventTestPlatformPartChromeOS); | 38 DISALLOW_COPY_AND_ASSIGN(ViewEventTestPlatformPartChromeOS); |
| 38 }; | 39 }; |
| 39 | 40 |
| 40 ViewEventTestPlatformPartChromeOS::ViewEventTestPlatformPartChromeOS( | 41 ViewEventTestPlatformPartChromeOS::ViewEventTestPlatformPartChromeOS( |
| 41 ui::ContextFactory* context_factory) { | 42 ui::ContextFactory* context_factory) { |
| 42 // Ash Shell can't just live on its own without a browser process, we need to | 43 // Ash Shell can't just live on its own without a browser process, we need to |
| 43 // also create the message center. | 44 // also create the message center. |
| 44 message_center::MessageCenter::Initialize(); | 45 message_center::MessageCenter::Initialize(); |
| 45 chromeos::DBusThreadManager::Initialize(); | 46 chromeos::DBusThreadManager::Initialize(); |
| 46 chromeos::CrasAudioHandler::InitializeForTesting(); | 47 chromeos::CrasAudioHandler::InitializeForTesting(); |
| 47 chromeos::NetworkHandler::Initialize(); | 48 chromeos::NetworkHandler::Initialize(); |
| 48 | 49 |
| 49 aura::Env::CreateInstance(true); | 50 env_ = aura::Env::CreateInstance(); |
| 50 ash::test::TestShellDelegate* shell_delegate = | 51 ash::test::TestShellDelegate* shell_delegate = |
| 51 new ash::test::TestShellDelegate(); | 52 new ash::test::TestShellDelegate(); |
| 52 ash::ShellInitParams init_params; | 53 ash::ShellInitParams init_params; |
| 53 init_params.delegate = shell_delegate; | 54 init_params.delegate = shell_delegate; |
| 54 init_params.context_factory = context_factory; | 55 init_params.context_factory = context_factory; |
| 55 ash::Shell::CreateInstance(init_params); | 56 ash::Shell::CreateInstance(init_params); |
| 56 ash::test::AshTestHelper::GetTestSessionStateDelegate()-> | 57 ash::test::AshTestHelper::GetTestSessionStateDelegate()-> |
| 57 SetActiveUserSessionStarted(true); | 58 SetActiveUserSessionStarted(true); |
| 58 GetContext()->GetHost()->Show(); | 59 GetContext()->GetHost()->Show(); |
| 59 } | 60 } |
| 60 | 61 |
| 61 ViewEventTestPlatformPartChromeOS::~ViewEventTestPlatformPartChromeOS() { | 62 ViewEventTestPlatformPartChromeOS::~ViewEventTestPlatformPartChromeOS() { |
| 62 ash::Shell::DeleteInstance(); | 63 ash::Shell::DeleteInstance(); |
| 63 aura::Env::DeleteInstance(); | 64 env_.reset(); |
| 64 | 65 |
| 65 chromeos::NetworkHandler::Shutdown(); | 66 chromeos::NetworkHandler::Shutdown(); |
| 66 chromeos::CrasAudioHandler::Shutdown(); | 67 chromeos::CrasAudioHandler::Shutdown(); |
| 67 chromeos::DBusThreadManager::Shutdown(); | 68 chromeos::DBusThreadManager::Shutdown(); |
| 68 // Ash Shell can't just live on its own without a browser process, we need to | 69 // Ash Shell can't just live on its own without a browser process, we need to |
| 69 // also shut down the message center. | 70 // also shut down the message center. |
| 70 message_center::MessageCenter::Shutdown(); | 71 message_center::MessageCenter::Shutdown(); |
| 71 } | 72 } |
| 72 | 73 |
| 73 } // namespace | 74 } // namespace |
| 74 | 75 |
| 75 // static | 76 // static |
| 76 ViewEventTestPlatformPart* ViewEventTestPlatformPart::Create( | 77 ViewEventTestPlatformPart* ViewEventTestPlatformPart::Create( |
| 77 ui::ContextFactory* context_factory) { | 78 ui::ContextFactory* context_factory) { |
| 78 return new ViewEventTestPlatformPartChromeOS(context_factory); | 79 return new ViewEventTestPlatformPartChromeOS(context_factory); |
| 79 } | 80 } |
| OLD | NEW |