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

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

Issue 1921133002: Adds ash::MaterialDesignController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adds ash::MaterialDesignController (CHECK_* -> DCHECK_*) Created 4 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
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/display/display_info.h" 9 #include "ash/display/display_info.h"
10 #include "ash/material_design/material_design_controller.h"
10 #include "ash/shell.h" 11 #include "ash/shell.h"
11 #include "ash/shell_init_params.h" 12 #include "ash/shell_init_params.h"
12 #include "ash/test/ash_test_views_delegate.h" 13 #include "ash/test/ash_test_views_delegate.h"
13 #include "ash/test/content/test_shell_content_state.h" 14 #include "ash/test/content/test_shell_content_state.h"
14 #include "ash/test/display_manager_test_api.h" 15 #include "ash/test/display_manager_test_api.h"
16 #include "ash/test/material_design_controller_test_api.h"
15 #include "ash/test/shell_test_api.h" 17 #include "ash/test/shell_test_api.h"
16 #include "ash/test/test_screenshot_delegate.h" 18 #include "ash/test/test_screenshot_delegate.h"
17 #include "ash/test/test_session_state_delegate.h" 19 #include "ash/test/test_session_state_delegate.h"
18 #include "ash/test/test_shell_delegate.h" 20 #include "ash/test/test_shell_delegate.h"
19 #include "ash/test/test_system_tray_delegate.h" 21 #include "ash/test/test_system_tray_delegate.h"
20 #include "base/run_loop.h" 22 #include "base/run_loop.h"
21 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
22 #include "ui/aura/env.h" 24 #include "ui/aura/env.h"
23 #include "ui/aura/input_state_lookup.h" 25 #include "ui/aura/input_state_lookup.h"
24 #include "ui/aura/test/env_test_helper.h" 26 #include "ui/aura/test/env_test_helper.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 ShellContentState::SetInstance(content_state); 119 ShellContentState::SetInstance(content_state);
118 120
119 // Reset the global state for the cursor manager. This includes the 121 // Reset the global state for the cursor manager. This includes the
120 // last cursor visibility state, etc. 122 // last cursor visibility state, etc.
121 ::wm::CursorManager::ResetCursorVisibilityStateForTest(); 123 ::wm::CursorManager::ResetCursorVisibilityStateForTest();
122 124
123 // ContentTestSuiteBase might have already initialized 125 // ContentTestSuiteBase might have already initialized
124 // MaterialDesignController in unit_tests suite. 126 // MaterialDesignController in unit_tests suite.
125 ui::test::MaterialDesignControllerTestAPI::Uninitialize(); 127 ui::test::MaterialDesignControllerTestAPI::Uninitialize();
126 ui::MaterialDesignController::Initialize(); 128 ui::MaterialDesignController::Initialize();
129 ash::MaterialDesignController::Initialize();
127 ShellInitParams init_params; 130 ShellInitParams init_params;
128 init_params.delegate = test_shell_delegate_; 131 init_params.delegate = test_shell_delegate_;
129 init_params.context_factory = context_factory; 132 init_params.context_factory = context_factory;
130 init_params.blocking_pool = content::BrowserThread::GetBlockingPool(); 133 init_params.blocking_pool = content::BrowserThread::GetBlockingPool();
131 ash::Shell::CreateInstance(init_params); 134 ash::Shell::CreateInstance(init_params);
132 aura::test::EnvTestHelper(aura::Env::GetInstance()) 135 aura::test::EnvTestHelper(aura::Env::GetInstance())
133 .SetInputStateLookup(std::unique_ptr<aura::InputStateLookup>()); 136 .SetInputStateLookup(std::unique_ptr<aura::InputStateLookup>());
134 137
135 Shell* shell = Shell::GetInstance(); 138 Shell* shell = Shell::GetInstance();
136 if (start_session) { 139 if (start_session) {
137 GetTestSessionStateDelegate()->SetActiveUserSessionStarted(true); 140 GetTestSessionStateDelegate()->SetActiveUserSessionStarted(true);
138 GetTestSessionStateDelegate()->SetHasActiveUser(true); 141 GetTestSessionStateDelegate()->SetHasActiveUser(true);
139 } 142 }
140 143
141 test::DisplayManagerTestApi().DisableChangeDisplayUponHostResize(); 144 test::DisplayManagerTestApi().DisableChangeDisplayUponHostResize();
142 ShellTestApi(shell).DisableDisplayAnimator(); 145 ShellTestApi(shell).DisableDisplayAnimator();
143 146
144 test_screenshot_delegate_ = new TestScreenshotDelegate(); 147 test_screenshot_delegate_ = new TestScreenshotDelegate();
145 shell->accelerator_controller()->SetScreenshotDelegate( 148 shell->accelerator_controller()->SetScreenshotDelegate(
146 std::unique_ptr<ScreenshotDelegate>(test_screenshot_delegate_)); 149 std::unique_ptr<ScreenshotDelegate>(test_screenshot_delegate_));
147 } 150 }
148 151
149 void AshTestHelper::TearDown() { 152 void AshTestHelper::TearDown() {
150 // Tear down the shell. 153 // Tear down the shell.
151 Shell::DeleteInstance(); 154 Shell::DeleteInstance();
155 test::MaterialDesignControllerTestAPI::Uninitialize();
152 ShellContentState::DestroyInstance(); 156 ShellContentState::DestroyInstance();
153 157
154 test_screenshot_delegate_ = NULL; 158 test_screenshot_delegate_ = NULL;
155 159
156 // Remove global message center state. 160 // Remove global message center state.
157 message_center::MessageCenter::Shutdown(); 161 message_center::MessageCenter::Shutdown();
158 162
159 #if defined(OS_CHROMEOS) 163 #if defined(OS_CHROMEOS)
160 chromeos::CrasAudioHandler::Shutdown(); 164 chromeos::CrasAudioHandler::Shutdown();
161 if (bluez_dbus_manager_initialized_) { 165 if (bluez_dbus_manager_initialized_) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 bool AshTestHelper::SupportsHostWindowResize() { 219 bool AshTestHelper::SupportsHostWindowResize() {
216 #if defined(OS_WIN) 220 #if defined(OS_WIN)
217 return false; 221 return false;
218 #else 222 #else
219 return true; 223 return true;
220 #endif 224 #endif
221 } 225 }
222 226
223 } // namespace test 227 } // namespace test
224 } // namespace ash 228 } // namespace ash
OLDNEW
« no previous file with comments | « ash/material_design/material_design_controller_unittest.cc ('k') | ash/test/material_design_controller_test_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698