| 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 "ui/aura/client/window_tree_client.h" | 7 #include "ui/aura/client/window_tree_client.h" |
| 8 #include "ui/aura/test/aura_test_helper.h" | 8 #include "ui/aura/test/aura_test_helper.h" |
| 9 #include "ui/aura/test/test_window_delegate.h" | 9 #include "ui/aura/test/test_window_delegate.h" |
| 10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
| 11 #include "ui/base/ime/input_method_initializer.h" | 11 #include "ui/base/ime/input_method_initializer.h" |
| 12 #include "ui/base/material_design/material_design_controller.h" | |
| 13 #include "ui/base/test/material_design_controller_test_api.h" | |
| 14 #include "ui/compositor/test/context_factories_for_test.h" | 12 #include "ui/compositor/test/context_factories_for_test.h" |
| 15 #include "ui/events/event_dispatcher.h" | 13 #include "ui/events/event_dispatcher.h" |
| 16 #include "ui/events/event_processor.h" | 14 #include "ui/events/event_processor.h" |
| 17 #include "ui/events/gesture_detection/gesture_configuration.h" | 15 #include "ui/events/gesture_detection/gesture_configuration.h" |
| 18 | 16 |
| 19 namespace aura { | 17 namespace aura { |
| 20 namespace test { | 18 namespace test { |
| 21 | 19 |
| 22 AuraTestBase::AuraTestBase() | 20 AuraTestBase::AuraTestBase() |
| 23 : setup_called_(false), | 21 : setup_called_(false), |
| 24 teardown_called_(false) { | 22 teardown_called_(false) { |
| 25 } | 23 } |
| 26 | 24 |
| 27 AuraTestBase::~AuraTestBase() { | 25 AuraTestBase::~AuraTestBase() { |
| 28 CHECK(setup_called_) | 26 CHECK(setup_called_) |
| 29 << "You have overridden SetUp but never called super class's SetUp"; | 27 << "You have overridden SetUp but never called super class's SetUp"; |
| 30 CHECK(teardown_called_) | 28 CHECK(teardown_called_) |
| 31 << "You have overridden TearDown but never called super class's TearDown"; | 29 << "You have overridden TearDown but never called super class's TearDown"; |
| 32 } | 30 } |
| 33 | 31 |
| 34 void AuraTestBase::SetUp() { | 32 void AuraTestBase::SetUp() { |
| 35 setup_called_ = true; | 33 setup_called_ = true; |
| 36 testing::Test::SetUp(); | 34 testing::Test::SetUp(); |
| 37 // ContentTestSuiteBase might have already initialized | |
| 38 // MaterialDesignController in unit_tests suite. | |
| 39 ui::test::MaterialDesignControllerTestAPI::UninitializeMode(); | |
| 40 ui::MaterialDesignController::Initialize(); | |
| 41 ui::InitializeInputMethodForTesting(); | 35 ui::InitializeInputMethodForTesting(); |
| 42 ui::GestureConfiguration* gesture_config = | 36 ui::GestureConfiguration* gesture_config = |
| 43 ui::GestureConfiguration::GetInstance(); | 37 ui::GestureConfiguration::GetInstance(); |
| 44 // Changing the parameters for gesture recognition shouldn't cause | 38 // Changing the parameters for gesture recognition shouldn't cause |
| 45 // tests to fail, so we use a separate set of parameters for unit | 39 // tests to fail, so we use a separate set of parameters for unit |
| 46 // testing. | 40 // testing. |
| 47 gesture_config->set_default_radius(0); | 41 gesture_config->set_default_radius(0); |
| 48 gesture_config->set_fling_max_cancel_to_down_time_in_ms(400); | 42 gesture_config->set_fling_max_cancel_to_down_time_in_ms(400); |
| 49 gesture_config->set_fling_max_tap_gap_time_in_ms(200); | 43 gesture_config->set_fling_max_tap_gap_time_in_ms(200); |
| 50 gesture_config->set_gesture_begin_end_types_enabled(true); | 44 gesture_config->set_gesture_begin_end_types_enabled(true); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 111 |
| 118 bool AuraTestBase::DispatchEventUsingWindowDispatcher(ui::Event* event) { | 112 bool AuraTestBase::DispatchEventUsingWindowDispatcher(ui::Event* event) { |
| 119 ui::EventDispatchDetails details = | 113 ui::EventDispatchDetails details = |
| 120 event_processor()->OnEventFromSource(event); | 114 event_processor()->OnEventFromSource(event); |
| 121 CHECK(!details.dispatcher_destroyed); | 115 CHECK(!details.dispatcher_destroyed); |
| 122 return event->handled(); | 116 return event->handled(); |
| 123 } | 117 } |
| 124 | 118 |
| 125 } // namespace test | 119 } // namespace test |
| 126 } // namespace aura | 120 } // namespace aura |
| OLD | NEW |