Chromium Code Reviews| 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 NEW_TOP_LEVEL, | 24 NEW_TOP_LEVEL, |
| 23 NEW_WINDOW, | 25 NEW_WINDOW, |
| 24 PROPERTY, | 26 PROPERTY, |
| 27 REMOVE_TRANSIENT, | |
| 25 VISIBLE, | 28 VISIBLE, |
| 26 | 29 |
| 27 // This covers all cases that aren't used in tests. | 30 // This covers all cases that aren't used in tests. |
| 28 OTHER, | 31 OTHER, |
| 29 }; | 32 }; |
| 30 | 33 |
| 34 struct TransientData { | |
| 35 Id parent_id; | |
| 36 Id child_id; | |
| 37 }; | |
| 38 | |
| 31 // WindowTree implementation for tests. TestWindowTree maintains a list of all | 39 // WindowTree implementation for tests. TestWindowTree maintains a list of all |
| 32 // calls that take a change_id and are expected to be acked back to the client. | 40 // calls that take a change_id and are expected to be acked back to the client. |
| 33 // Various functions are provided to respond to the changes. | 41 // Various functions are provided to respond to the changes. |
| 34 class TestWindowTree : public ui::mojom::WindowTree { | 42 class TestWindowTree : public ui::mojom::WindowTree { |
| 35 public: | 43 public: |
| 36 TestWindowTree(); | 44 TestWindowTree(); |
| 37 ~TestWindowTree() override; | 45 ~TestWindowTree() override; |
| 38 | 46 |
| 39 void set_client(ui::mojom::WindowTreeClient* client) { client_ = client; } | 47 void set_client(ui::mojom::WindowTreeClient* client) { client_ = client; } |
| 40 | 48 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 61 // one change of the specified type. | 69 // one change of the specified type. |
| 62 bool AckFirstChangeOfType(WindowTreeChangeType type, bool result); | 70 bool AckFirstChangeOfType(WindowTreeChangeType type, bool result); |
| 63 | 71 |
| 64 void AckAllChangesOfType(WindowTreeChangeType type, bool result); | 72 void AckAllChangesOfType(WindowTreeChangeType type, bool result); |
| 65 | 73 |
| 66 bool GetAndRemoveFirstChangeOfType(WindowTreeChangeType type, | 74 bool GetAndRemoveFirstChangeOfType(WindowTreeChangeType type, |
| 67 uint32_t* change_id); | 75 uint32_t* change_id); |
| 68 | 76 |
| 69 size_t GetChangeCountForType(WindowTreeChangeType type); | 77 size_t GetChangeCountForType(WindowTreeChangeType type); |
| 70 | 78 |
| 79 // Data from most recent add/remove transient window. | |
|
msw
2016/10/27 23:46:10
nit: "the most recently added/removed"?
sky
2016/10/28 03:16:32
Done.
| |
| 80 const TransientData& transient_data() const { return transient_data_; } | |
| 81 | |
| 71 private: | 82 private: |
| 72 struct Change { | 83 struct Change { |
| 73 WindowTreeChangeType type; | 84 WindowTreeChangeType type; |
| 74 uint32_t id; | 85 uint32_t id; |
| 75 }; | 86 }; |
| 76 | 87 |
| 77 void OnChangeReceived( | 88 void OnChangeReceived( |
| 78 uint32_t change_id, | 89 uint32_t change_id, |
| 79 WindowTreeChangeType type = WindowTreeChangeType::OTHER); | 90 WindowTreeChangeType type = WindowTreeChangeType::OTHER); |
| 80 | 91 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 uint32_t window_id_ = 0u; | 180 uint32_t window_id_ = 0u; |
| 170 | 181 |
| 171 mojo::Array<uint8_t> last_property_value_; | 182 mojo::Array<uint8_t> last_property_value_; |
| 172 | 183 |
| 173 std::vector<Change> changes_; | 184 std::vector<Change> changes_; |
| 174 | 185 |
| 175 ui::mojom::WindowTreeClient* client_; | 186 ui::mojom::WindowTreeClient* client_; |
| 176 | 187 |
| 177 mojo::Map<mojo::String, mojo::Array<uint8_t>> last_new_window_properties_; | 188 mojo::Map<mojo::String, mojo::Array<uint8_t>> last_new_window_properties_; |
| 178 | 189 |
| 190 TransientData transient_data_; | |
| 191 | |
| 179 DISALLOW_COPY_AND_ASSIGN(TestWindowTree); | 192 DISALLOW_COPY_AND_ASSIGN(TestWindowTree); |
| 180 }; | 193 }; |
| 181 | 194 |
| 182 } // namespace aura | 195 } // namespace aura |
| 183 | 196 |
| 184 #endif // UI_AURA_TEST_MUS_TEST_WINDOW_TREE_H_ | 197 #endif // UI_AURA_TEST_MUS_TEST_WINDOW_TREE_H_ |
| OLD | NEW |