Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(565)

Side by Side Diff: chrome/test/base/view_event_test_platform_part_chromeos.cc

Issue 2528013002: Initialize the message center as part of the testing browser process (Closed)
Patch Set: re-uploding due to time outs Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/test/base/testing_browser_process.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/material_design/material_design_controller.h" 9 #include "ash/common/material_design/material_design_controller.h"
10 #include "ash/common/test/test_session_state_delegate.h" 10 #include "ash/common/test/test_session_state_delegate.h"
11 #include "ash/shell.h" 11 #include "ash/shell.h"
12 #include "ash/shell_init_params.h" 12 #include "ash/shell_init_params.h"
13 #include "ash/test/ash_test_helper.h" 13 #include "ash/test/ash_test_helper.h"
14 #include "ash/test/test_shell_delegate.h" 14 #include "ash/test/test_shell_delegate.h"
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "chromeos/audio/cras_audio_handler.h" 17 #include "chromeos/audio/cras_audio_handler.h"
18 #include "chromeos/dbus/dbus_thread_manager.h" 18 #include "chromeos/dbus/dbus_thread_manager.h"
19 #include "chromeos/network/network_handler.h" 19 #include "chromeos/network/network_handler.h"
20 #include "content/public/browser/browser_thread.h" 20 #include "content/public/browser/browser_thread.h"
21 #include "device/bluetooth/dbus/bluez_dbus_manager.h" 21 #include "device/bluetooth/dbus/bluez_dbus_manager.h"
22 #include "ui/aura/env.h" 22 #include "ui/aura/env.h"
23 #include "ui/aura/window_tree_host.h" 23 #include "ui/aura/window_tree_host.h"
24 #include "ui/display/display_switches.h" 24 #include "ui/display/display_switches.h"
25 #include "ui/message_center/message_center.h"
26 #include "ui/wm/core/wm_state.h" 25 #include "ui/wm/core/wm_state.h"
27 26
28 namespace { 27 namespace {
29 28
30 // ViewEventTestPlatformPart implementation for ChromeOS (chromeos=1). 29 // ViewEventTestPlatformPart implementation for ChromeOS (chromeos=1).
31 class ViewEventTestPlatformPartChromeOS : public ViewEventTestPlatformPart { 30 class ViewEventTestPlatformPartChromeOS : public ViewEventTestPlatformPart {
32 public: 31 public:
33 explicit ViewEventTestPlatformPartChromeOS( 32 explicit ViewEventTestPlatformPartChromeOS(
34 ui::ContextFactory* context_factory); 33 ui::ContextFactory* context_factory);
35 ~ViewEventTestPlatformPartChromeOS() override; 34 ~ViewEventTestPlatformPartChromeOS() override;
36 35
37 // Overridden from ViewEventTestPlatformPart: 36 // Overridden from ViewEventTestPlatformPart:
38 gfx::NativeWindow GetContext() override { 37 gfx::NativeWindow GetContext() override {
39 return ash::Shell::GetPrimaryRootWindow(); 38 return ash::Shell::GetPrimaryRootWindow();
40 } 39 }
41 40
42 private: 41 private:
43 wm::WMState wm_state_; 42 wm::WMState wm_state_;
44 std::unique_ptr<aura::Env> env_; 43 std::unique_ptr<aura::Env> env_;
45 44
46 DISALLOW_COPY_AND_ASSIGN(ViewEventTestPlatformPartChromeOS); 45 DISALLOW_COPY_AND_ASSIGN(ViewEventTestPlatformPartChromeOS);
47 }; 46 };
48 47
49 ViewEventTestPlatformPartChromeOS::ViewEventTestPlatformPartChromeOS( 48 ViewEventTestPlatformPartChromeOS::ViewEventTestPlatformPartChromeOS(
50 ui::ContextFactory* context_factory) { 49 ui::ContextFactory* context_factory) {
51 // Ash Shell can't just live on its own without a browser process, we need to 50 // Ash Shell can't just live on its own without a browser process.
52 // also create the message center.
53 message_center::MessageCenter::Initialize();
54 chromeos::DBusThreadManager::Initialize(); 51 chromeos::DBusThreadManager::Initialize();
55 bluez::BluezDBusManager::Initialize( 52 bluez::BluezDBusManager::Initialize(
56 chromeos::DBusThreadManager::Get()->GetSystemBus(), 53 chromeos::DBusThreadManager::Get()->GetSystemBus(),
57 chromeos::DBusThreadManager::Get()->IsUsingFakes()); 54 chromeos::DBusThreadManager::Get()->IsUsingFakes());
58 chromeos::CrasAudioHandler::InitializeForTesting(); 55 chromeos::CrasAudioHandler::InitializeForTesting();
59 chromeos::NetworkHandler::Initialize(); 56 chromeos::NetworkHandler::Initialize();
60 ash::MaterialDesignController::Initialize(); 57 ash::MaterialDesignController::Initialize();
61 58
62 env_ = aura::Env::CreateInstance(); 59 env_ = aura::Env::CreateInstance();
63 ash::test::TestShellDelegate* shell_delegate = 60 ash::test::TestShellDelegate* shell_delegate =
(...skipping 11 matching lines...) Expand all
75 } 72 }
76 73
77 ViewEventTestPlatformPartChromeOS::~ViewEventTestPlatformPartChromeOS() { 74 ViewEventTestPlatformPartChromeOS::~ViewEventTestPlatformPartChromeOS() {
78 ash::Shell::DeleteInstance(); 75 ash::Shell::DeleteInstance();
79 env_.reset(); 76 env_.reset();
80 77
81 chromeos::NetworkHandler::Shutdown(); 78 chromeos::NetworkHandler::Shutdown();
82 chromeos::CrasAudioHandler::Shutdown(); 79 chromeos::CrasAudioHandler::Shutdown();
83 bluez::BluezDBusManager::Shutdown(); 80 bluez::BluezDBusManager::Shutdown();
84 chromeos::DBusThreadManager::Shutdown(); 81 chromeos::DBusThreadManager::Shutdown();
85 // Ash Shell can't just live on its own without a browser process, we need to
86 // also shut down the message center.
87 message_center::MessageCenter::Shutdown();
88 } 82 }
89 83
90 } // namespace 84 } // namespace
91 85
92 // static 86 // static
93 ViewEventTestPlatformPart* ViewEventTestPlatformPart::Create( 87 ViewEventTestPlatformPart* ViewEventTestPlatformPart::Create(
94 ui::ContextFactory* context_factory) { 88 ui::ContextFactory* context_factory) {
95 return new ViewEventTestPlatformPartChromeOS(context_factory); 89 return new ViewEventTestPlatformPartChromeOS(context_factory);
96 } 90 }
OLDNEW
« no previous file with comments | « chrome/test/base/testing_browser_process.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698