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