Fix vectorized icon for PPAPI broker website setting icon
[chromium-blink-merge.git] / chrome / test / base / view_event_test_platform_part_chromeos.cc
blob3767dda75eaf3f2f55ae211b56d296b622cd40dc
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
3 // found in the LICENSE file.
5 #include "chrome/test/base/view_event_test_platform_part.h"
7 #include "ash/shell.h"
8 #include "ash/shell_init_params.h"
9 #include "ash/test/ash_test_helper.h"
10 #include "ash/test/test_session_state_delegate.h"
11 #include "ash/test/test_shell_delegate.h"
12 #include "chromeos/audio/cras_audio_handler.h"
13 #include "chromeos/dbus/dbus_thread_manager.h"
14 #include "chromeos/network/network_handler.h"
15 #include "ui/aura/env.h"
16 #include "ui/aura/window_tree_host.h"
17 #include "ui/message_center/message_center.h"
18 #include "ui/wm/core/wm_state.h"
20 namespace {
22 // ViewEventTestPlatformPart implementation for ChromeOS (chromeos=1).
23 class ViewEventTestPlatformPartChromeOS : public ViewEventTestPlatformPart {
24 public:
25 explicit ViewEventTestPlatformPartChromeOS(
26 ui::ContextFactory* context_factory);
27 ~ViewEventTestPlatformPartChromeOS() override;
29 // Overridden from ViewEventTestPlatformPart:
30 gfx::NativeWindow GetContext() override {
31 return ash::Shell::GetPrimaryRootWindow();
34 private:
35 wm::WMState wm_state_;
37 DISALLOW_COPY_AND_ASSIGN(ViewEventTestPlatformPartChromeOS);
40 ViewEventTestPlatformPartChromeOS::ViewEventTestPlatformPartChromeOS(
41 ui::ContextFactory* context_factory) {
42 // Ash Shell can't just live on its own without a browser process, we need to
43 // also create the message center.
44 message_center::MessageCenter::Initialize();
45 chromeos::DBusThreadManager::Initialize();
46 chromeos::CrasAudioHandler::InitializeForTesting();
47 chromeos::NetworkHandler::Initialize();
49 aura::Env::CreateInstance(true);
50 ash::test::TestShellDelegate* shell_delegate =
51 new ash::test::TestShellDelegate();
52 ash::ShellInitParams init_params;
53 init_params.delegate = shell_delegate;
54 init_params.context_factory = context_factory;
55 ash::Shell::CreateInstance(init_params);
56 ash::test::AshTestHelper::GetTestSessionStateDelegate()->
57 SetActiveUserSessionStarted(true);
58 GetContext()->GetHost()->Show();
61 ViewEventTestPlatformPartChromeOS::~ViewEventTestPlatformPartChromeOS() {
62 ash::Shell::DeleteInstance();
63 aura::Env::DeleteInstance();
65 chromeos::NetworkHandler::Shutdown();
66 chromeos::CrasAudioHandler::Shutdown();
67 chromeos::DBusThreadManager::Shutdown();
68 // Ash Shell can't just live on its own without a browser process, we need to
69 // also shut down the message center.
70 message_center::MessageCenter::Shutdown();
73 } // namespace
75 // static
76 ViewEventTestPlatformPart* ViewEventTestPlatformPart::Create(
77 ui::ContextFactory* context_factory) {
78 return new ViewEventTestPlatformPartChromeOS(context_factory);