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

Side by Side Diff: ash/test/ash_test_helper.cc

Issue 273073002: Changes code using Compositor to pass in ContextFactory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tooltip on chromeos Created 6 years, 7 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
« no previous file with comments | « ash/test/ash_test_helper.h ('k') | chrome/browser/ui/ash/ash_init.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ash/test/ash_test_helper.h" 5 #include "ash/test/ash_test_helper.h"
6 6
7 #include "ash/accelerators/accelerator_controller.h" 7 #include "ash/accelerators/accelerator_controller.h"
8 #include "ash/ash_switches.h" 8 #include "ash/ash_switches.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_init_params.h" 10 #include "ash/shell_init_params.h"
(...skipping 25 matching lines...) Expand all
36 #endif 36 #endif
37 37
38 #if defined(USE_X11) 38 #if defined(USE_X11)
39 #include "ui/aura/window_tree_host_x11.h" 39 #include "ui/aura/window_tree_host_x11.h"
40 #endif 40 #endif
41 41
42 namespace ash { 42 namespace ash {
43 namespace test { 43 namespace test {
44 44
45 AshTestHelper::AshTestHelper(base::MessageLoopForUI* message_loop) 45 AshTestHelper::AshTestHelper(base::MessageLoopForUI* message_loop)
46 : message_loop_(message_loop), 46 : context_factory_(NULL),
47 message_loop_(message_loop),
47 test_shell_delegate_(NULL), 48 test_shell_delegate_(NULL),
48 test_screenshot_delegate_(NULL), 49 test_screenshot_delegate_(NULL),
49 dbus_thread_manager_initialized_(false) { 50 dbus_thread_manager_initialized_(false) {
50 CHECK(message_loop_); 51 CHECK(message_loop_);
51 #if defined(USE_X11) 52 #if defined(USE_X11)
52 aura::test::SetUseOverrideRedirectWindowByDefault(true); 53 aura::test::SetUseOverrideRedirectWindowByDefault(true);
53 #endif 54 #endif
54 } 55 }
55 56
56 AshTestHelper::~AshTestHelper() { 57 AshTestHelper::~AshTestHelper() {
57 } 58 }
58 59
59 void AshTestHelper::SetUp(bool start_session) { 60 void AshTestHelper::SetUp(bool start_session) {
60 views_delegate_.reset(new AshTestViewsDelegate); 61 views_delegate_.reset(new AshTestViewsDelegate);
61 62
62 // Disable animations during tests. 63 // Disable animations during tests.
63 zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode( 64 zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode(
64 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)); 65 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION));
65 ui::InitializeInputMethodForTesting(); 66 ui::InitializeInputMethodForTesting();
66 67
67 bool enable_pixel_output = false; 68 bool enable_pixel_output = false;
68 ui::InitializeContextFactoryForTests(enable_pixel_output); 69 context_factory_ = ui::InitializeContextFactoryForTests(enable_pixel_output);
69 70
70 // Creates Shell and hook with Desktop. 71 // Creates Shell and hook with Desktop.
71 if (!test_shell_delegate_) 72 if (!test_shell_delegate_)
72 test_shell_delegate_ = new TestShellDelegate; 73 test_shell_delegate_ = new TestShellDelegate;
73 74
74 // Creates MessageCenter since g_browser_process is not created in AshTestBase 75 // Creates MessageCenter since g_browser_process is not created in AshTestBase
75 // tests. 76 // tests.
76 message_center::MessageCenter::Initialize(); 77 message_center::MessageCenter::Initialize();
77 78
78 #if defined(OS_CHROMEOS) 79 #if defined(OS_CHROMEOS)
79 // Create DBusThreadManager for testing. 80 // Create DBusThreadManager for testing.
80 if (!chromeos::DBusThreadManager::IsInitialized()) { 81 if (!chromeos::DBusThreadManager::IsInitialized()) {
81 chromeos::DBusThreadManager::InitializeWithStub(); 82 chromeos::DBusThreadManager::InitializeWithStub();
82 dbus_thread_manager_initialized_ = true; 83 dbus_thread_manager_initialized_ = true;
83 } 84 }
84 // Create CrasAudioHandler for testing since g_browser_process is not 85 // Create CrasAudioHandler for testing since g_browser_process is not
85 // created in AshTestBase tests. 86 // created in AshTestBase tests.
86 chromeos::CrasAudioHandler::InitializeForTesting(); 87 chromeos::CrasAudioHandler::InitializeForTesting();
87 #endif 88 #endif
88 ShellInitParams init_params; 89 ShellInitParams init_params;
89 init_params.delegate = test_shell_delegate_; 90 init_params.delegate = test_shell_delegate_;
91 init_params.context_factory = context_factory_;
90 ash::Shell::CreateInstance(init_params); 92 ash::Shell::CreateInstance(init_params);
91 aura::test::EnvTestHelper(aura::Env::GetInstance()).SetInputStateLookup( 93 aura::test::EnvTestHelper(aura::Env::GetInstance()).SetInputStateLookup(
92 scoped_ptr<aura::InputStateLookup>()); 94 scoped_ptr<aura::InputStateLookup>());
93 95
94 Shell* shell = Shell::GetInstance(); 96 Shell* shell = Shell::GetInstance();
95 if (start_session) { 97 if (start_session) {
96 test_shell_delegate_->test_session_state_delegate()-> 98 test_shell_delegate_->test_session_state_delegate()->
97 SetActiveUserSessionStarted(true); 99 SetActiveUserSessionStarted(true);
98 test_shell_delegate_->test_session_state_delegate()-> 100 test_shell_delegate_->test_session_state_delegate()->
99 SetHasActiveUser(true); 101 SetHasActiveUser(true);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 bool AshTestHelper::SupportsHostWindowResize() { 169 bool AshTestHelper::SupportsHostWindowResize() {
168 #if defined(OS_WIN) 170 #if defined(OS_WIN)
169 return false; 171 return false;
170 #else 172 #else
171 return true; 173 return true;
172 #endif 174 #endif
173 } 175 }
174 176
175 } // namespace test 177 } // namespace test
176 } // namespace ash 178 } // namespace ash
OLDNEW
« no previous file with comments | « ash/test/ash_test_helper.h ('k') | chrome/browser/ui/ash/ash_init.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698