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

Side by Side Diff: ui/aura/test/aura_test_base.cc

Issue 2499933003: Expand aura::PropertyConverter support. (Closed)
Patch Set: Fix the other new unit test. Created 4 years, 1 month 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 | « ui/aura/test/aura_test_base.h ('k') | ui/aura/window_property.h » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/aura/test/aura_test_base.h" 5 #include "ui/aura/test/aura_test_base.h"
6 6
7 #include "ui/aura/client/window_parenting_client.h" 7 #include "ui/aura/client/window_parenting_client.h"
8 #include "ui/aura/mus/property_converter.h"
9 #include "ui/aura/mus/window_tree_client.h" 8 #include "ui/aura/mus/window_tree_client.h"
10 #include "ui/aura/mus/window_tree_host_mus.h" 9 #include "ui/aura/mus/window_tree_host_mus.h"
11 #include "ui/aura/test/test_window_delegate.h" 10 #include "ui/aura/test/test_window_delegate.h"
12 #include "ui/aura/window.h" 11 #include "ui/aura/window.h"
13 #include "ui/base/ime/input_method_initializer.h" 12 #include "ui/base/ime/input_method_initializer.h"
14 #include "ui/base/material_design/material_design_controller.h" 13 #include "ui/base/material_design/material_design_controller.h"
15 #include "ui/base/test/material_design_controller_test_api.h" 14 #include "ui/base/test/material_design_controller_test_api.h"
16 #include "ui/compositor/test/context_factories_for_test.h" 15 #include "ui/compositor/test/context_factories_for_test.h"
17 #include "ui/events/event_dispatcher.h" 16 #include "ui/events/event_dispatcher.h"
18 #include "ui/events/event_processor.h" 17 #include "ui/events/event_processor.h"
19 #include "ui/events/gesture_detection/gesture_configuration.h" 18 #include "ui/events/gesture_detection/gesture_configuration.h"
20 19
21 namespace aura { 20 namespace aura {
22 namespace test { 21 namespace test {
23 22
24 AuraTestBase::AuraTestBase() 23 AuraTestBase::AuraTestBase()
25 : window_manager_delegate_(this), window_tree_client_delegate_(this) {} 24 : window_manager_delegate_(this), window_tree_client_delegate_(this) {}
26 25
27 AuraTestBase::~AuraTestBase() { 26 AuraTestBase::~AuraTestBase() {
28 CHECK(setup_called_) 27 CHECK(setup_called_)
29 << "You have overridden SetUp but never called super class's SetUp"; 28 << "You have overridden SetUp but never called super class's SetUp";
30 CHECK(teardown_called_) 29 CHECK(teardown_called_)
31 << "You have overridden TearDown but never called super class's TearDown"; 30 << "You have overridden TearDown but never called super class's TearDown";
32 } 31 }
33 32
34 void AuraTestBase::SetUp() { 33 void AuraTestBase::SetUp() {
35 setup_called_ = true; 34 setup_called_ = true;
36 testing::Test::SetUp(); 35 testing::Test::SetUp();
37 if (!property_converter_)
38 property_converter_ = base::MakeUnique<PropertyConverter>();
39 // ContentTestSuiteBase might have already initialized 36 // ContentTestSuiteBase might have already initialized
40 // MaterialDesignController in unit_tests suite. 37 // MaterialDesignController in unit_tests suite.
41 ui::test::MaterialDesignControllerTestAPI::Uninitialize(); 38 ui::test::MaterialDesignControllerTestAPI::Uninitialize();
42 ui::MaterialDesignController::Initialize(); 39 ui::MaterialDesignController::Initialize();
43 ui::InitializeInputMethodForTesting(); 40 ui::InitializeInputMethodForTesting();
44 ui::GestureConfiguration* gesture_config = 41 ui::GestureConfiguration* gesture_config =
45 ui::GestureConfiguration::GetInstance(); 42 ui::GestureConfiguration::GetInstance();
46 // Changing the parameters for gesture recognition shouldn't cause 43 // Changing the parameters for gesture recognition shouldn't cause
47 // tests to fail, so we use a separate set of parameters for unit 44 // tests to fail, so we use a separate set of parameters for unit
48 // testing. 45 // testing.
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 ui::EventDispatchDetails details = 132 ui::EventDispatchDetails details =
136 event_processor()->OnEventFromSource(event); 133 event_processor()->OnEventFromSource(event);
137 CHECK(!details.dispatcher_destroyed); 134 CHECK(!details.dispatcher_destroyed);
138 return event->handled(); 135 return event->handled();
139 } 136 }
140 137
141 ui::mojom::WindowTreeClient* AuraTestBase::window_tree_client() { 138 ui::mojom::WindowTreeClient* AuraTestBase::window_tree_client() {
142 return helper_->window_tree_client(); 139 return helper_->window_tree_client();
143 } 140 }
144 141
145 void AuraTestBase::SetPropertyConverter(
146 std::unique_ptr<PropertyConverter> helper) {
147 property_converter_ = std::move(helper);
148 }
149
150 void AuraTestBase::OnEmbed( 142 void AuraTestBase::OnEmbed(
151 std::unique_ptr<WindowTreeHostMus> window_tree_host) {} 143 std::unique_ptr<WindowTreeHostMus> window_tree_host) {}
152 144
153 void AuraTestBase::OnUnembed(Window* root) {} 145 void AuraTestBase::OnUnembed(Window* root) {}
154 146
155 void AuraTestBase::OnEmbedRootDestroyed(Window* root) {} 147 void AuraTestBase::OnEmbedRootDestroyed(Window* root) {}
156 148
157 void AuraTestBase::OnLostConnection(WindowTreeClient* client) {} 149 void AuraTestBase::OnLostConnection(WindowTreeClient* client) {}
158 150
159 void AuraTestBase::OnPointerEventObserved(const ui::PointerEvent& event, 151 void AuraTestBase::OnPointerEventObserved(const ui::PointerEvent& event,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 const gfx::Point& cursor_location, 195 const gfx::Point& cursor_location,
204 const base::Callback<void(bool)>& on_done) {} 196 const base::Callback<void(bool)>& on_done) {}
205 197
206 void AuraTestBase::OnWmCancelMoveLoop(Window* window) {} 198 void AuraTestBase::OnWmCancelMoveLoop(Window* window) {}
207 199
208 client::CaptureClient* AuraTestBase::GetCaptureClient() { 200 client::CaptureClient* AuraTestBase::GetCaptureClient() {
209 return helper_->capture_client(); 201 return helper_->capture_client();
210 } 202 }
211 203
212 PropertyConverter* AuraTestBase::GetPropertyConverter() { 204 PropertyConverter* AuraTestBase::GetPropertyConverter() {
213 return property_converter_.get(); 205 return &property_converter_;
214 } 206 }
215 207
216 AuraTestBaseWithType::AuraTestBaseWithType() {} 208 AuraTestBaseWithType::AuraTestBaseWithType() {}
217 209
218 AuraTestBaseWithType::~AuraTestBaseWithType() { 210 AuraTestBaseWithType::~AuraTestBaseWithType() {
219 DCHECK(setup_called_); 211 DCHECK(setup_called_);
220 } 212 }
221 213
222 void AuraTestBaseWithType::SetUp() { 214 void AuraTestBaseWithType::SetUp() {
223 DCHECK(!setup_called_); 215 DCHECK(!setup_called_);
224 setup_called_ = true; 216 setup_called_ = true;
225 ConfigureBackend(GetParam()); 217 ConfigureBackend(GetParam());
226 AuraTestBase::SetUp(); 218 AuraTestBase::SetUp();
227 } 219 }
228 220
229 } // namespace test 221 } // namespace test
230 } // namespace aura 222 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/test/aura_test_base.h ('k') | ui/aura/window_property.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698