| 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_parenting_client.h" | 7 #include "ui/aura/client/window_parenting_client.h" |
| 8 #include "ui/aura/mus/property_converter.h" | 8 #include "ui/aura/mus/property_converter.h" |
| 9 #include "ui/aura/mus/window_tree_client.h" | 9 #include "ui/aura/mus/window_tree_client.h" |
| 10 #include "ui/aura/mus/window_tree_host_mus.h" | 10 #include "ui/aura/mus/window_tree_host_mus.h" |
| 11 #include "ui/aura/test/test_window_delegate.h" | 11 #include "ui/aura/test/test_window_delegate.h" |
| 12 #include "ui/aura/window.h" | 12 #include "ui/aura/window.h" |
| 13 #include "ui/base/ime/input_method_initializer.h" | 13 #include "ui/base/ime/input_method_initializer.h" |
| 14 #include "ui/base/material_design/material_design_controller.h" | 14 #include "ui/base/material_design/material_design_controller.h" |
| 15 #include "ui/base/test/material_design_controller_test_api.h" | 15 #include "ui/base/test/material_design_controller_test_api.h" |
| 16 #include "ui/compositor/test/context_factories_for_test.h" | 16 #include "ui/compositor/test/context_factories_for_test.h" |
| 17 #include "ui/events/event_dispatcher.h" | 17 #include "ui/events/event_dispatcher.h" |
| 18 #include "ui/events/event_processor.h" | 18 #include "ui/events/event_processor.h" |
| 19 #include "ui/events/gesture_detection/gesture_configuration.h" | 19 #include "ui/events/gesture_detection/gesture_configuration.h" |
| 20 | 20 |
| 21 namespace aura { | 21 namespace aura { |
| 22 namespace test { | 22 namespace test { |
| 23 namespace { | |
| 24 | |
| 25 class TestPropertyConverter : public PropertyConverter { | |
| 26 public: | |
| 27 TestPropertyConverter() {} | |
| 28 ~TestPropertyConverter() override {} | |
| 29 | |
| 30 // PropertyConverter: | |
| 31 bool ConvertPropertyForTransport( | |
| 32 Window* window, | |
| 33 const void* key, | |
| 34 std::string* server_property_name, | |
| 35 std::unique_ptr<std::vector<uint8_t>>* server_property_value) override { | |
| 36 return false; | |
| 37 } | |
| 38 | |
| 39 std::string GetTransportNameForPropertyKey(const void* key) override { | |
| 40 return std::string(); | |
| 41 } | |
| 42 | |
| 43 void SetPropertyFromTransportValue( | |
| 44 Window* window, | |
| 45 const std::string& server_property_name, | |
| 46 const std::vector<uint8_t>* data) override {} | |
| 47 | |
| 48 private: | |
| 49 DISALLOW_COPY_AND_ASSIGN(TestPropertyConverter); | |
| 50 }; | |
| 51 | |
| 52 } // namespace | |
| 53 | 23 |
| 54 AuraTestBase::AuraTestBase() | 24 AuraTestBase::AuraTestBase() |
| 55 : window_manager_delegate_(this), window_tree_client_delegate_(this) {} | 25 : window_manager_delegate_(this), window_tree_client_delegate_(this) {} |
| 56 | 26 |
| 57 AuraTestBase::~AuraTestBase() { | 27 AuraTestBase::~AuraTestBase() { |
| 58 CHECK(setup_called_) | 28 CHECK(setup_called_) |
| 59 << "You have overridden SetUp but never called super class's SetUp"; | 29 << "You have overridden SetUp but never called super class's SetUp"; |
| 60 CHECK(teardown_called_) | 30 CHECK(teardown_called_) |
| 61 << "You have overridden TearDown but never called super class's TearDown"; | 31 << "You have overridden TearDown but never called super class's TearDown"; |
| 62 } | 32 } |
| 63 | 33 |
| 64 void AuraTestBase::SetUp() { | 34 void AuraTestBase::SetUp() { |
| 65 setup_called_ = true; | 35 setup_called_ = true; |
| 66 testing::Test::SetUp(); | 36 testing::Test::SetUp(); |
| 67 if (!property_converter_) | 37 if (!property_converter_) |
| 68 property_converter_ = base::MakeUnique<TestPropertyConverter>(); | 38 property_converter_ = base::MakeUnique<PropertyConverter>(); |
| 69 // ContentTestSuiteBase might have already initialized | 39 // ContentTestSuiteBase might have already initialized |
| 70 // MaterialDesignController in unit_tests suite. | 40 // MaterialDesignController in unit_tests suite. |
| 71 ui::test::MaterialDesignControllerTestAPI::Uninitialize(); | 41 ui::test::MaterialDesignControllerTestAPI::Uninitialize(); |
| 72 ui::MaterialDesignController::Initialize(); | 42 ui::MaterialDesignController::Initialize(); |
| 73 ui::InitializeInputMethodForTesting(); | 43 ui::InitializeInputMethodForTesting(); |
| 74 ui::GestureConfiguration* gesture_config = | 44 ui::GestureConfiguration* gesture_config = |
| 75 ui::GestureConfiguration::GetInstance(); | 45 ui::GestureConfiguration::GetInstance(); |
| 76 // Changing the parameters for gesture recognition shouldn't cause | 46 // Changing the parameters for gesture recognition shouldn't cause |
| 77 // tests to fail, so we use a separate set of parameters for unit | 47 // tests to fail, so we use a separate set of parameters for unit |
| 78 // testing. | 48 // testing. |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 | 218 |
| 249 void AuraTestBaseWithType::SetUp() { | 219 void AuraTestBaseWithType::SetUp() { |
| 250 DCHECK(!setup_called_); | 220 DCHECK(!setup_called_); |
| 251 setup_called_ = true; | 221 setup_called_ = true; |
| 252 ConfigureBackend(GetParam()); | 222 ConfigureBackend(GetParam()); |
| 253 AuraTestBase::SetUp(); | 223 AuraTestBase::SetUp(); |
| 254 } | 224 } |
| 255 | 225 |
| 256 } // namespace test | 226 } // namespace test |
| 257 } // namespace aura | 227 } // namespace aura |
| OLD | NEW |