| 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 #ifndef UI_AURA_TEST_AURA_TEST_BASE_H_ | 5 #ifndef UI_AURA_TEST_AURA_TEST_BASE_H_ |
| 6 #define UI_AURA_TEST_AURA_TEST_BASE_H_ | 6 #define UI_AURA_TEST_AURA_TEST_BASE_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "ui/aura/mus/property_converter.h" |
| 12 #include "ui/aura/mus/window_manager_delegate.h" | 13 #include "ui/aura/mus/window_manager_delegate.h" |
| 13 #include "ui/aura/mus/window_tree_client_delegate.h" | 14 #include "ui/aura/mus/window_tree_client_delegate.h" |
| 14 #include "ui/aura/test/aura_test_helper.h" | 15 #include "ui/aura/test/aura_test_helper.h" |
| 15 | 16 |
| 16 namespace ui { | 17 namespace ui { |
| 17 namespace mojom { | 18 namespace mojom { |
| 18 class WindowTreeClient; | 19 class WindowTreeClient; |
| 19 } | 20 } |
| 20 } | 21 } |
| 21 | 22 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 WindowTreeHost* host() { return helper_->host(); } | 77 WindowTreeHost* host() { return helper_->host(); } |
| 77 ui::EventProcessor* event_processor() { return helper_->event_processor(); } | 78 ui::EventProcessor* event_processor() { return helper_->event_processor(); } |
| 78 TestScreen* test_screen() { return helper_->test_screen(); } | 79 TestScreen* test_screen() { return helper_->test_screen(); } |
| 79 | 80 |
| 80 TestWindowTree* window_tree() { return helper_->window_tree(); } | 81 TestWindowTree* window_tree() { return helper_->window_tree(); } |
| 81 WindowTreeClient* window_tree_client_impl() { | 82 WindowTreeClient* window_tree_client_impl() { |
| 82 return helper_->window_tree_client(); | 83 return helper_->window_tree_client(); |
| 83 } | 84 } |
| 84 ui::mojom::WindowTreeClient* window_tree_client(); | 85 ui::mojom::WindowTreeClient* window_tree_client(); |
| 85 | 86 |
| 86 // Resets the PropertyConverter. | |
| 87 void SetPropertyConverter(std::unique_ptr<PropertyConverter> helper); | |
| 88 | |
| 89 // WindowTreeClientDelegate: | 87 // WindowTreeClientDelegate: |
| 90 void OnEmbed(std::unique_ptr<WindowTreeHostMus> window_tree_host) override; | 88 void OnEmbed(std::unique_ptr<WindowTreeHostMus> window_tree_host) override; |
| 91 void OnUnembed(Window* root) override; | 89 void OnUnembed(Window* root) override; |
| 92 void OnEmbedRootDestroyed(Window* root) override; | 90 void OnEmbedRootDestroyed(Window* root) override; |
| 93 void OnLostConnection(WindowTreeClient* client) override; | 91 void OnLostConnection(WindowTreeClient* client) override; |
| 94 void OnPointerEventObserved(const ui::PointerEvent& event, | 92 void OnPointerEventObserved(const ui::PointerEvent& event, |
| 95 Window* target) override; | 93 Window* target) override; |
| 96 | 94 |
| 97 // WindowManagerDelegate: | 95 // WindowManagerDelegate: |
| 98 void SetWindowManagerClient(WindowManagerClient* client) override; | 96 void SetWindowManagerClient(WindowManagerClient* client) override; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 121 | 119 |
| 122 private: | 120 private: |
| 123 // Only used for mus. Both are are initialized to this, but may be reset. | 121 // Only used for mus. Both are are initialized to this, but may be reset. |
| 124 WindowManagerDelegate* window_manager_delegate_; | 122 WindowManagerDelegate* window_manager_delegate_; |
| 125 WindowTreeClientDelegate* window_tree_client_delegate_; | 123 WindowTreeClientDelegate* window_tree_client_delegate_; |
| 126 | 124 |
| 127 bool use_mus_ = false; | 125 bool use_mus_ = false; |
| 128 bool setup_called_ = false; | 126 bool setup_called_ = false; |
| 129 bool teardown_called_ = false; | 127 bool teardown_called_ = false; |
| 130 base::MessageLoopForUI message_loop_; | 128 base::MessageLoopForUI message_loop_; |
| 131 std::unique_ptr<PropertyConverter> property_converter_; | 129 PropertyConverter property_converter_; |
| 132 std::unique_ptr<AuraTestHelper> helper_; | 130 std::unique_ptr<AuraTestHelper> helper_; |
| 133 std::unique_ptr<WindowTreeHostMus> window_tree_host_mus_; | 131 std::unique_ptr<WindowTreeHostMus> window_tree_host_mus_; |
| 134 | 132 |
| 135 DISALLOW_COPY_AND_ASSIGN(AuraTestBase); | 133 DISALLOW_COPY_AND_ASSIGN(AuraTestBase); |
| 136 }; | 134 }; |
| 137 | 135 |
| 138 // Use as a base class for tests that want to target both backends. | 136 // Use as a base class for tests that want to target both backends. |
| 139 class AuraTestBaseWithType : public AuraTestBase, | 137 class AuraTestBaseWithType : public AuraTestBase, |
| 140 public ::testing::WithParamInterface<BackendType> { | 138 public ::testing::WithParamInterface<BackendType> { |
| 141 public: | 139 public: |
| 142 AuraTestBaseWithType(); | 140 AuraTestBaseWithType(); |
| 143 ~AuraTestBaseWithType() override; | 141 ~AuraTestBaseWithType() override; |
| 144 | 142 |
| 145 // AuraTestBase: | 143 // AuraTestBase: |
| 146 void SetUp() override; | 144 void SetUp() override; |
| 147 | 145 |
| 148 private: | 146 private: |
| 149 bool setup_called_ = false; | 147 bool setup_called_ = false; |
| 150 | 148 |
| 151 DISALLOW_COPY_AND_ASSIGN(AuraTestBaseWithType); | 149 DISALLOW_COPY_AND_ASSIGN(AuraTestBaseWithType); |
| 152 }; | 150 }; |
| 153 | 151 |
| 154 } // namespace test | 152 } // namespace test |
| 155 } // namespace aura | 153 } // namespace aura |
| 156 | 154 |
| 157 #endif // UI_AURA_TEST_AURA_TEST_BASE_H_ | 155 #endif // UI_AURA_TEST_AURA_TEST_BASE_H_ |
| OLD | NEW |