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

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

Issue 1878973002: [reland] Makes MaterialDesignController initialization explicit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Made it possible to restore MaterialDesignController state after each test case (nits) Created 4 years, 8 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
« no previous file with comments | « no previous file | chrome/app/chrome_main_delegate.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/display/display_info.h" 9 #include "ash/display/display_info.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
11 #include "ash/shell_init_params.h" 11 #include "ash/shell_init_params.h"
12 #include "ash/test/ash_test_views_delegate.h" 12 #include "ash/test/ash_test_views_delegate.h"
13 #include "ash/test/content/test_shell_content_state.h" 13 #include "ash/test/content/test_shell_content_state.h"
14 #include "ash/test/display_manager_test_api.h" 14 #include "ash/test/display_manager_test_api.h"
15 #include "ash/test/shell_test_api.h" 15 #include "ash/test/shell_test_api.h"
16 #include "ash/test/test_screenshot_delegate.h" 16 #include "ash/test/test_screenshot_delegate.h"
17 #include "ash/test/test_session_state_delegate.h" 17 #include "ash/test/test_session_state_delegate.h"
18 #include "ash/test/test_shell_delegate.h" 18 #include "ash/test/test_shell_delegate.h"
19 #include "ash/test/test_system_tray_delegate.h" 19 #include "ash/test/test_system_tray_delegate.h"
20 #include "base/run_loop.h" 20 #include "base/run_loop.h"
21 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
22 #include "ui/aura/env.h" 22 #include "ui/aura/env.h"
23 #include "ui/aura/input_state_lookup.h" 23 #include "ui/aura/input_state_lookup.h"
24 #include "ui/aura/test/env_test_helper.h" 24 #include "ui/aura/test/env_test_helper.h"
25 #include "ui/aura/test/event_generator_delegate_aura.h" 25 #include "ui/aura/test/event_generator_delegate_aura.h"
26 #include "ui/base/ime/input_method_initializer.h" 26 #include "ui/base/ime/input_method_initializer.h"
27 #include "ui/base/material_design/material_design_controller.h"
28 #include "ui/base/test/material_design_controller_test_api.h"
27 #include "ui/compositor/scoped_animation_duration_scale_mode.h" 29 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
28 #include "ui/compositor/test/context_factories_for_test.h" 30 #include "ui/compositor/test/context_factories_for_test.h"
29 #include "ui/message_center/message_center.h" 31 #include "ui/message_center/message_center.h"
30 #include "ui/wm/core/capture_controller.h" 32 #include "ui/wm/core/capture_controller.h"
31 #include "ui/wm/core/cursor_manager.h" 33 #include "ui/wm/core/cursor_manager.h"
32 34
33 #if defined(OS_CHROMEOS) 35 #if defined(OS_CHROMEOS)
34 #include "chromeos/audio/cras_audio_handler.h" 36 #include "chromeos/audio/cras_audio_handler.h"
35 #include "chromeos/dbus/dbus_thread_manager.h" 37 #include "chromeos/dbus/dbus_thread_manager.h"
36 #include "device/bluetooth/dbus/bluez_dbus_manager.h" 38 #include "device/bluetooth/dbus/bluez_dbus_manager.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 if (!content_state) { 113 if (!content_state) {
112 test_shell_content_state_ = new TestShellContentState; 114 test_shell_content_state_ = new TestShellContentState;
113 content_state = test_shell_content_state_; 115 content_state = test_shell_content_state_;
114 } 116 }
115 ShellContentState::SetInstance(content_state); 117 ShellContentState::SetInstance(content_state);
116 118
117 // Reset the global state for the cursor manager. This includes the 119 // Reset the global state for the cursor manager. This includes the
118 // last cursor visibility state, etc. 120 // last cursor visibility state, etc.
119 wm::CursorManager::ResetCursorVisibilityStateForTest(); 121 wm::CursorManager::ResetCursorVisibilityStateForTest();
120 122
123 // ContentTestSuiteBase might have already initialized
124 // MaterialDesignController in unit_tests suite.
125 ui::test::MaterialDesignControllerTestAPI::Uninitialize();
126 ui::MaterialDesignController::Initialize();
121 ShellInitParams init_params; 127 ShellInitParams init_params;
122 init_params.delegate = test_shell_delegate_; 128 init_params.delegate = test_shell_delegate_;
123 init_params.context_factory = context_factory; 129 init_params.context_factory = context_factory;
124 init_params.blocking_pool = content::BrowserThread::GetBlockingPool(); 130 init_params.blocking_pool = content::BrowserThread::GetBlockingPool();
125 ash::Shell::CreateInstance(init_params); 131 ash::Shell::CreateInstance(init_params);
126 aura::test::EnvTestHelper(aura::Env::GetInstance()) 132 aura::test::EnvTestHelper(aura::Env::GetInstance())
127 .SetInputStateLookup(std::unique_ptr<aura::InputStateLookup>()); 133 .SetInputStateLookup(std::unique_ptr<aura::InputStateLookup>());
128 134
129 Shell* shell = Shell::GetInstance(); 135 Shell* shell = Shell::GetInstance();
130 if (start_session) { 136 if (start_session) {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 bool AshTestHelper::SupportsHostWindowResize() { 215 bool AshTestHelper::SupportsHostWindowResize() {
210 #if defined(OS_WIN) 216 #if defined(OS_WIN)
211 return false; 217 return false;
212 #else 218 #else
213 return true; 219 return true;
214 #endif 220 #endif
215 } 221 }
216 222
217 } // namespace test 223 } // namespace test
218 } // namespace ash 224 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | chrome/app/chrome_main_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698