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