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

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

Issue 2692663002: Gut ash::MaterialDesignController, and remove the about:flags entry. (Closed)
Patch Set: yet another rebase Created 3 years, 10 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 | « ash/test/ash_test_helper.h ('k') | ash/test/ash_test_helper_unittest.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_delegate_aura.h" 7 #include "ash/accelerators/accelerator_controller_delegate_aura.h"
8 #include "ash/common/material_design/material_design_controller.h"
9 #include "ash/common/test/material_design_controller_test_api.h"
10 #include "ash/common/test/test_session_state_delegate.h" 8 #include "ash/common/test/test_session_state_delegate.h"
11 #include "ash/common/test/test_system_tray_delegate.h" 9 #include "ash/common/test/test_system_tray_delegate.h"
12 #include "ash/common/test/wm_shell_test_api.h" 10 #include "ash/common/test/wm_shell_test_api.h"
13 #include "ash/common/wm_shell.h" 11 #include "ash/common/wm_shell.h"
14 #include "ash/shell.h" 12 #include "ash/shell.h"
15 #include "ash/shell_init_params.h" 13 #include "ash/shell_init_params.h"
16 #include "ash/system/chromeos/screen_layout_observer.h" 14 #include "ash/system/chromeos/screen_layout_observer.h"
17 #include "ash/test/ash_test_environment.h" 15 #include "ash/test/ash_test_environment.h"
18 #include "ash/test/ash_test_views_delegate.h" 16 #include "ash/test/ash_test_views_delegate.h"
19 #include "ash/test/shell_test_api.h" 17 #include "ash/test/shell_test_api.h"
(...skipping 30 matching lines...) Expand all
50 test_shell_delegate_(nullptr), 48 test_shell_delegate_(nullptr),
51 test_screenshot_delegate_(nullptr), 49 test_screenshot_delegate_(nullptr),
52 dbus_thread_manager_initialized_(false), 50 dbus_thread_manager_initialized_(false),
53 bluez_dbus_manager_initialized_(false) { 51 bluez_dbus_manager_initialized_(false) {
54 ui::test::EnableTestConfigForPlatformWindows(); 52 ui::test::EnableTestConfigForPlatformWindows();
55 aura::test::InitializeAuraEventGeneratorDelegate(); 53 aura::test::InitializeAuraEventGeneratorDelegate();
56 } 54 }
57 55
58 AshTestHelper::~AshTestHelper() {} 56 AshTestHelper::~AshTestHelper() {}
59 57
60 void AshTestHelper::SetUp(bool start_session, 58 void AshTestHelper::SetUp(bool start_session) {
61 MaterialDesignController::Mode material_mode) {
62 display::ResetDisplayIdForTest(); 59 display::ResetDisplayIdForTest();
63 wm_state_ = base::MakeUnique<::wm::WMState>(); 60 wm_state_ = base::MakeUnique<::wm::WMState>();
64 views_delegate_ = ash_test_environment_->CreateViewsDelegate(); 61 views_delegate_ = ash_test_environment_->CreateViewsDelegate();
65 62
66 // Disable animations during tests. 63 // Disable animations during tests.
67 zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode( 64 zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode(
68 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)); 65 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION));
69 ui::InitializeInputMethodForTesting(); 66 ui::InitializeInputMethodForTesting();
70 67
71 bool enable_pixel_output = false; 68 bool enable_pixel_output = false;
(...skipping 30 matching lines...) Expand all
102 99
103 ash_test_environment_->SetUp(); 100 ash_test_environment_->SetUp();
104 // Reset the global state for the cursor manager. This includes the 101 // Reset the global state for the cursor manager. This includes the
105 // last cursor visibility state, etc. 102 // last cursor visibility state, etc.
106 ::wm::CursorManager::ResetCursorVisibilityStateForTest(); 103 ::wm::CursorManager::ResetCursorVisibilityStateForTest();
107 104
108 // ContentTestSuiteBase might have already initialized 105 // ContentTestSuiteBase might have already initialized
109 // MaterialDesignController in unit_tests suite. 106 // MaterialDesignController in unit_tests suite.
110 ui::test::MaterialDesignControllerTestAPI::Uninitialize(); 107 ui::test::MaterialDesignControllerTestAPI::Uninitialize();
111 ui::MaterialDesignController::Initialize(); 108 ui::MaterialDesignController::Initialize();
112 ash::MaterialDesignController::Initialize();
113 if (material_mode == MaterialDesignController::Mode::UNINITIALIZED)
114 material_mode = MaterialDesignController::GetMode();
115 material_design_state_.reset(
116 new test::MaterialDesignControllerTestAPI(material_mode));
117 109
118 ShellInitParams init_params; 110 ShellInitParams init_params;
119 init_params.delegate = test_shell_delegate_; 111 init_params.delegate = test_shell_delegate_;
120 init_params.context_factory = context_factory; 112 init_params.context_factory = context_factory;
121 init_params.context_factory_private = context_factory_private; 113 init_params.context_factory_private = context_factory_private;
122 init_params.blocking_pool = ash_test_environment_->GetBlockingPool(); 114 init_params.blocking_pool = ash_test_environment_->GetBlockingPool();
123 Shell::CreateInstance(init_params); 115 Shell::CreateInstance(init_params);
124 aura::test::EnvTestHelper(aura::Env::GetInstance()) 116 aura::test::EnvTestHelper(aura::Env::GetInstance())
125 .SetInputStateLookup(std::unique_ptr<aura::InputStateLookup>()); 117 .SetInputStateLookup(std::unique_ptr<aura::InputStateLookup>());
126 118
(...skipping 16 matching lines...) Expand all
143 std::unique_ptr<ScreenshotDelegate>(test_screenshot_delegate_)); 135 std::unique_ptr<ScreenshotDelegate>(test_screenshot_delegate_));
144 } 136 }
145 137
146 void AshTestHelper::TearDown() { 138 void AshTestHelper::TearDown() {
147 // Tear down the shell. 139 // Tear down the shell.
148 Shell::DeleteInstance(); 140 Shell::DeleteInstance();
149 141
150 // Suspend the tear down until all resources are returned via 142 // Suspend the tear down until all resources are returned via
151 // MojoCompositorFrameSinkClient::ReclaimResources() 143 // MojoCompositorFrameSinkClient::ReclaimResources()
152 RunAllPendingInMessageLoop(); 144 RunAllPendingInMessageLoop();
153 material_design_state_.reset();
154 test::MaterialDesignControllerTestAPI::Uninitialize();
155 ash_test_environment_->TearDown(); 145 ash_test_environment_->TearDown();
156 146
157 test_screenshot_delegate_ = NULL; 147 test_screenshot_delegate_ = NULL;
158 148
159 // Remove global message center state. 149 // Remove global message center state.
160 message_center::MessageCenter::Shutdown(); 150 message_center::MessageCenter::Shutdown();
161 151
162 chromeos::CrasAudioHandler::Shutdown(); 152 chromeos::CrasAudioHandler::Shutdown();
163 if (bluez_dbus_manager_initialized_) { 153 if (bluez_dbus_manager_initialized_) {
164 device::BluetoothAdapterFactory::Shutdown(); 154 device::BluetoothAdapterFactory::Shutdown();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 aura::Window* AshTestHelper::CurrentContext() { 186 aura::Window* AshTestHelper::CurrentContext() {
197 aura::Window* root_window = Shell::GetTargetRootWindow(); 187 aura::Window* root_window = Shell::GetTargetRootWindow();
198 if (!root_window) 188 if (!root_window)
199 root_window = Shell::GetPrimaryRootWindow(); 189 root_window = Shell::GetPrimaryRootWindow();
200 DCHECK(root_window); 190 DCHECK(root_window);
201 return root_window; 191 return root_window;
202 } 192 }
203 193
204 } // namespace test 194 } // namespace test
205 } // namespace ash 195 } // namespace ash
OLDNEW
« no previous file with comments | « ash/test/ash_test_helper.h ('k') | ash/test/ash_test_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698