| OLD | NEW |
| 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 "base/memory/ptr_util.h" |
| 7 #include "ui/aura/client/window_parenting_client.h" | 8 #include "ui/aura/client/window_parenting_client.h" |
| 8 #include "ui/aura/mus/property_utils.h" | 9 #include "ui/aura/mus/property_utils.h" |
| 9 #include "ui/aura/mus/window_tree_client.h" | 10 #include "ui/aura/mus/window_tree_client.h" |
| 10 #include "ui/aura/mus/window_tree_host_mus.h" | 11 #include "ui/aura/mus/window_tree_host_mus.h" |
| 11 #include "ui/aura/test/test_window_delegate.h" | 12 #include "ui/aura/test/test_window_delegate.h" |
| 12 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
| 13 #include "ui/base/ime/input_method_initializer.h" | 14 #include "ui/base/ime/input_method_initializer.h" |
| 14 #include "ui/base/material_design/material_design_controller.h" | 15 #include "ui/base/material_design/material_design_controller.h" |
| 15 #include "ui/base/test/material_design_controller_test_api.h" | 16 #include "ui/base/test/material_design_controller_test_api.h" |
| 16 #include "ui/compositor/test/context_factories_for_test.h" | 17 #include "ui/compositor/test/context_factories_for_test.h" |
| 17 #include "ui/events/event_dispatcher.h" | 18 #include "ui/events/event_dispatcher.h" |
| 18 #include "ui/events/event_sink.h" | 19 #include "ui/events/event_sink.h" |
| 19 #include "ui/events/gesture_detection/gesture_configuration.h" | 20 #include "ui/events/gesture_detection/gesture_configuration.h" |
| 20 | 21 |
| 21 namespace aura { | 22 namespace aura { |
| 22 namespace test { | 23 namespace test { |
| 23 | 24 |
| 24 AuraTestBase::AuraTestBase() | 25 AuraTestBase::AuraTestBase() |
| 25 : window_manager_delegate_(this), window_tree_client_delegate_(this) {} | 26 : scoped_task_environment_( |
| 27 base::test::ScopedTaskEnvironment::MainThreadType::UI), |
| 28 window_manager_delegate_(this), |
| 29 window_tree_client_delegate_(this) {} |
| 26 | 30 |
| 27 AuraTestBase::~AuraTestBase() { | 31 AuraTestBase::~AuraTestBase() { |
| 28 CHECK(setup_called_) | 32 CHECK(setup_called_) |
| 29 << "You have overridden SetUp but never called super class's SetUp"; | 33 << "You have overridden SetUp but never called super class's SetUp"; |
| 30 CHECK(teardown_called_) | 34 CHECK(teardown_called_) |
| 31 << "You have overridden TearDown but never called super class's TearDown"; | 35 << "You have overridden TearDown but never called super class's TearDown"; |
| 32 } | 36 } |
| 33 | 37 |
| 34 void AuraTestBase::SetUp() { | 38 void AuraTestBase::SetUp() { |
| 35 setup_called_ = true; | 39 setup_called_ = true; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 gesture_config->set_velocity_tracker_strategy( | 76 gesture_config->set_velocity_tracker_strategy( |
| 73 ui::VelocityTracker::Strategy::LSQ2_RESTRICTED); | 77 ui::VelocityTracker::Strategy::LSQ2_RESTRICTED); |
| 74 | 78 |
| 75 // The ContextFactory must exist before any Compositors are created. | 79 // The ContextFactory must exist before any Compositors are created. |
| 76 bool enable_pixel_output = false; | 80 bool enable_pixel_output = false; |
| 77 ui::ContextFactory* context_factory = nullptr; | 81 ui::ContextFactory* context_factory = nullptr; |
| 78 ui::ContextFactoryPrivate* context_factory_private = nullptr; | 82 ui::ContextFactoryPrivate* context_factory_private = nullptr; |
| 79 ui::InitializeContextFactoryForTests(enable_pixel_output, &context_factory, | 83 ui::InitializeContextFactoryForTests(enable_pixel_output, &context_factory, |
| 80 &context_factory_private); | 84 &context_factory_private); |
| 81 | 85 |
| 82 helper_.reset(new AuraTestHelper(&message_loop_)); | 86 helper_ = base::MakeUnique<AuraTestHelper>(); |
| 83 if (use_mus_) { | 87 if (use_mus_) { |
| 84 helper_->EnableMusWithTestWindowTree(window_tree_client_delegate_, | 88 helper_->EnableMusWithTestWindowTree(window_tree_client_delegate_, |
| 85 window_manager_delegate_); | 89 window_manager_delegate_); |
| 86 } | 90 } |
| 87 helper_->SetUp(context_factory, context_factory_private); | 91 helper_->SetUp(context_factory, context_factory_private); |
| 88 } | 92 } |
| 89 | 93 |
| 90 void AuraTestBase::TearDown() { | 94 void AuraTestBase::TearDown() { |
| 91 teardown_called_ = true; | 95 teardown_called_ = true; |
| 92 | 96 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 | 256 |
| 253 AuraTestBaseMus::~AuraTestBaseMus() {} | 257 AuraTestBaseMus::~AuraTestBaseMus() {} |
| 254 | 258 |
| 255 void AuraTestBaseMus::SetUp() { | 259 void AuraTestBaseMus::SetUp() { |
| 256 ConfigureBackend(test::BackendType::MUS); | 260 ConfigureBackend(test::BackendType::MUS); |
| 257 AuraTestBase::SetUp(); | 261 AuraTestBase::SetUp(); |
| 258 } | 262 } |
| 259 | 263 |
| 260 } // namespace test | 264 } // namespace test |
| 261 } // namespace aura | 265 } // namespace aura |
| OLD | NEW |