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

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

Issue 443553003: MacViews: Split ViewEventTestBase into platform-specific files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months 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 | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #include "chrome/test/base/chrome_views_test_helper.h"
6
7 #include "ash/shell.h"
8 #include "ash/shell_init_params.h"
9 #include "ash/test/test_session_state_delegate.h"
10 #include "ash/test/test_shell_delegate.h"
11 #include "chromeos/audio/cras_audio_handler.h"
12 #include "chromeos/dbus/dbus_thread_manager.h"
13 #include "chromeos/network/network_handler.h"
14 #include "ui/aura/env.h"
15 #include "ui/aura/window_tree_host.h"
16 #include "ui/message_center/message_center.h"
17 #include "ui/wm/core/wm_state.h"
18
19 namespace {
20
21 // ChromeViewsTestHelper implementation for ChromeOS (chromeos=1).
22 class ChromeViewsTestHelperChromeOS : public ChromeViewsTestHelper {
23 public:
24 ChromeViewsTestHelperChromeOS() {}
25
26 // Overridden from ChromeViewsTestHelper:
27 virtual gfx::NativeWindow PlatformSetUp(
28 ui::ContextFactory* context_factory) OVERRIDE;
29 virtual void PlatformTearDown() OVERRIDE;
30
31 private:
32 wm::WMState wm_state_;
33
34 DISALLOW_COPY_AND_ASSIGN(ChromeViewsTestHelperChromeOS);
35 };
36
37 gfx::NativeWindow ChromeViewsTestHelperChromeOS::PlatformSetUp(
38 ui::ContextFactory* context_factory) {
39 // Ash Shell can't just live on its own without a browser process, we need to
40 // also create the message center.
41 message_center::MessageCenter::Initialize();
42 chromeos::DBusThreadManager::InitializeWithStub();
43 chromeos::CrasAudioHandler::InitializeForTesting();
44 chromeos::NetworkHandler::Initialize();
45 ash::test::TestShellDelegate* shell_delegate =
46 new ash::test::TestShellDelegate();
47 ash::ShellInitParams init_params;
48 init_params.delegate = shell_delegate;
49 init_params.context_factory = context_factory;
50 ash::Shell::CreateInstance(init_params);
51 shell_delegate->test_session_state_delegate()->SetActiveUserSessionStarted(
52 true);
53 gfx::NativeWindow context = ash::Shell::GetPrimaryRootWindow();
54 context->GetHost()->Show();
55 return context;
56 }
57
58 void ChromeViewsTestHelperChromeOS::PlatformTearDown() {
59 ash::Shell::DeleteInstance();
60 chromeos::NetworkHandler::Shutdown();
61 chromeos::CrasAudioHandler::Shutdown();
62 chromeos::DBusThreadManager::Shutdown();
63 // Ash Shell can't just live on its own without a browser process, we need to
64 // also shut down the message center.
65 message_center::MessageCenter::Shutdown();
66
67 aura::Env::DeleteInstance();
68 }
69
70 } // namespace
71
72 // static
73 ChromeViewsTestHelper* ChromeViewsTestHelper::Create() {
74 return new ChromeViewsTestHelperChromeOS();
75 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698