| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_MUS_TEST_WINDOW_TREE_H_ | 5 #ifndef UI_AURA_TEST_MUS_TEST_WINDOW_TREE_H_ |
| 6 #define UI_AURA_TEST_MUS_TEST_WINDOW_TREE_H_ | 6 #define UI_AURA_TEST_MUS_TEST_WINDOW_TREE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "services/ui/public/interfaces/window_tree.mojom.h" | 13 #include "services/ui/public/interfaces/window_tree.mojom.h" |
| 14 #include "ui/aura/mus/mus_types.h" |
| 14 | 15 |
| 15 namespace aura { | 16 namespace aura { |
| 16 | 17 |
| 17 enum class WindowTreeChangeType { | 18 enum class WindowTreeChangeType { |
| 19 ADD_TRANSIENT, |
| 18 BOUNDS, | 20 BOUNDS, |
| 19 // Used for both set and release capture. | 21 // Used for both set and release capture. |
| 20 CAPTURE, | 22 CAPTURE, |
| 21 FOCUS, | 23 FOCUS, |
| 22 MODAL, | 24 MODAL, |
| 23 NEW_TOP_LEVEL, | 25 NEW_TOP_LEVEL, |
| 24 NEW_WINDOW, | 26 NEW_WINDOW, |
| 25 PROPERTY, | 27 PROPERTY, |
| 28 REMOVE_TRANSIENT, |
| 26 VISIBLE, | 29 VISIBLE, |
| 27 | 30 |
| 28 // This covers all cases that aren't used in tests. | 31 // This covers all cases that aren't used in tests. |
| 29 OTHER, | 32 OTHER, |
| 30 }; | 33 }; |
| 31 | 34 |
| 35 struct TransientData { |
| 36 Id parent_id; |
| 37 Id child_id; |
| 38 }; |
| 39 |
| 32 // WindowTree implementation for tests. TestWindowTree maintains a list of all | 40 // WindowTree implementation for tests. TestWindowTree maintains a list of all |
| 33 // calls that take a change_id and are expected to be acked back to the client. | 41 // calls that take a change_id and are expected to be acked back to the client. |
| 34 // Various functions are provided to respond to the changes. | 42 // Various functions are provided to respond to the changes. |
| 35 class TestWindowTree : public ui::mojom::WindowTree { | 43 class TestWindowTree : public ui::mojom::WindowTree { |
| 36 public: | 44 public: |
| 37 TestWindowTree(); | 45 TestWindowTree(); |
| 38 ~TestWindowTree() override; | 46 ~TestWindowTree() override; |
| 39 | 47 |
| 40 void set_client(ui::mojom::WindowTreeClient* client) { client_ = client; } | 48 void set_client(ui::mojom::WindowTreeClient* client) { client_ = client; } |
| 41 | 49 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 62 // one change of the specified type. | 70 // one change of the specified type. |
| 63 bool AckFirstChangeOfType(WindowTreeChangeType type, bool result); | 71 bool AckFirstChangeOfType(WindowTreeChangeType type, bool result); |
| 64 | 72 |
| 65 void AckAllChangesOfType(WindowTreeChangeType type, bool result); | 73 void AckAllChangesOfType(WindowTreeChangeType type, bool result); |
| 66 | 74 |
| 67 bool GetAndRemoveFirstChangeOfType(WindowTreeChangeType type, | 75 bool GetAndRemoveFirstChangeOfType(WindowTreeChangeType type, |
| 68 uint32_t* change_id); | 76 uint32_t* change_id); |
| 69 | 77 |
| 70 size_t GetChangeCountForType(WindowTreeChangeType type); | 78 size_t GetChangeCountForType(WindowTreeChangeType type); |
| 71 | 79 |
| 80 // Data from the most recently added/removed transient window. |
| 81 const TransientData& transient_data() const { return transient_data_; } |
| 82 |
| 72 private: | 83 private: |
| 73 struct Change { | 84 struct Change { |
| 74 WindowTreeChangeType type; | 85 WindowTreeChangeType type; |
| 75 uint32_t id; | 86 uint32_t id; |
| 76 }; | 87 }; |
| 77 | 88 |
| 78 void OnChangeReceived( | 89 void OnChangeReceived( |
| 79 uint32_t change_id, | 90 uint32_t change_id, |
| 80 WindowTreeChangeType type = WindowTreeChangeType::OTHER); | 91 WindowTreeChangeType type = WindowTreeChangeType::OTHER); |
| 81 | 92 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 uint32_t window_id_ = 0u; | 181 uint32_t window_id_ = 0u; |
| 171 | 182 |
| 172 mojo::Array<uint8_t> last_property_value_; | 183 mojo::Array<uint8_t> last_property_value_; |
| 173 | 184 |
| 174 std::vector<Change> changes_; | 185 std::vector<Change> changes_; |
| 175 | 186 |
| 176 ui::mojom::WindowTreeClient* client_; | 187 ui::mojom::WindowTreeClient* client_; |
| 177 | 188 |
| 178 mojo::Map<mojo::String, mojo::Array<uint8_t>> last_new_window_properties_; | 189 mojo::Map<mojo::String, mojo::Array<uint8_t>> last_new_window_properties_; |
| 179 | 190 |
| 191 TransientData transient_data_; |
| 192 |
| 180 DISALLOW_COPY_AND_ASSIGN(TestWindowTree); | 193 DISALLOW_COPY_AND_ASSIGN(TestWindowTree); |
| 181 }; | 194 }; |
| 182 | 195 |
| 183 } // namespace aura | 196 } // namespace aura |
| 184 | 197 |
| 185 #endif // UI_AURA_TEST_MUS_TEST_WINDOW_TREE_H_ | 198 #endif // UI_AURA_TEST_MUS_TEST_WINDOW_TREE_H_ |
| OLD | NEW |