| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_MUS_WS_TEST_CHANGE_TRACKER_H_ | 5 #ifndef COMPONENTS_MUS_WS_TEST_CHANGE_TRACKER_H_ |
| 6 #define COMPONENTS_MUS_WS_TEST_CHANGE_TRACKER_H_ | 6 #define COMPONENTS_MUS_WS_TEST_CHANGE_TRACKER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 // Returns a string description of this. | 52 // Returns a string description of this. |
| 53 std::string ToString() const; | 53 std::string ToString() const; |
| 54 | 54 |
| 55 // Returns a string description that includes visible and drawn. | 55 // Returns a string description that includes visible and drawn. |
| 56 std::string ToString2() const; | 56 std::string ToString2() const; |
| 57 | 57 |
| 58 Id parent_id; | 58 Id parent_id; |
| 59 Id window_id; | 59 Id window_id; |
| 60 bool visible; | 60 bool visible; |
| 61 bool drawn; | |
| 62 std::map<std::string, std::vector<uint8_t>> properties; | 61 std::map<std::string, std::vector<uint8_t>> properties; |
| 63 }; | 62 }; |
| 64 | 63 |
| 65 // Tracks a call to WindowTreeClient. See the individual functions for the | 64 // Tracks a call to WindowTreeClient. See the individual functions for the |
| 66 // fields that are used. | 65 // fields that are used. |
| 67 struct Change { | 66 struct Change { |
| 68 Change(); | 67 Change(); |
| 69 Change(const Change& other); | 68 Change(const Change& other); |
| 70 ~Change(); | 69 ~Change(); |
| 71 | 70 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 87 uint32_t change_id; | 86 uint32_t change_id; |
| 88 }; | 87 }; |
| 89 | 88 |
| 90 // Converts Changes to string descriptions. | 89 // Converts Changes to string descriptions. |
| 91 std::vector<std::string> ChangesToDescription1( | 90 std::vector<std::string> ChangesToDescription1( |
| 92 const std::vector<Change>& changes); | 91 const std::vector<Change>& changes); |
| 93 | 92 |
| 94 // Convenience for returning the description of the first item in |changes|. | 93 // Convenience for returning the description of the first item in |changes|. |
| 95 // Returns an empty string if |changes| has something other than one entry. | 94 // Returns an empty string if |changes| has something other than one entry. |
| 96 std::string SingleChangeToDescription(const std::vector<Change>& changes); | 95 std::string SingleChangeToDescription(const std::vector<Change>& changes); |
| 96 std::string SingleChangeToDescription2(const std::vector<Change>& changes); |
| 97 | 97 |
| 98 // Convenience for returning the description of the first item in |windows|. | 98 // Convenience for returning the description of the first item in |windows|. |
| 99 // Returns an empty string if |windows| has something other than one entry. | 99 // Returns an empty string if |windows| has something other than one entry. |
| 100 std::string SingleWindowDescription(const std::vector<TestWindow>& windows); | 100 std::string SingleWindowDescription(const std::vector<TestWindow>& windows); |
| 101 | 101 |
| 102 // Returns a string description of |changes[0].windows|. Returns an empty string | 102 // Returns a string description of |changes[0].windows|. Returns an empty string |
| 103 // if change.size() != 1. | 103 // if change.size() != 1. |
| 104 std::string ChangeWindowDescription(const std::vector<Change>& changes); | 104 std::string ChangeWindowDescription(const std::vector<Change>& changes); |
| 105 | 105 |
| 106 // Converts WindowDatas to TestWindows. | 106 // Converts WindowDatas to TestWindows. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 123 | 123 |
| 124 TestChangeTracker(); | 124 TestChangeTracker(); |
| 125 ~TestChangeTracker(); | 125 ~TestChangeTracker(); |
| 126 | 126 |
| 127 void set_delegate(Delegate* delegate) { delegate_ = delegate; } | 127 void set_delegate(Delegate* delegate) { delegate_ = delegate; } |
| 128 | 128 |
| 129 std::vector<Change>* changes() { return &changes_; } | 129 std::vector<Change>* changes() { return &changes_; } |
| 130 | 130 |
| 131 // Each of these functions generate a Change. There is one per | 131 // Each of these functions generate a Change. There is one per |
| 132 // WindowTreeClient function. | 132 // WindowTreeClient function. |
| 133 void OnEmbed(ConnectionSpecificId connection_id, mojom::WindowDataPtr root); | 133 void OnEmbed(ConnectionSpecificId connection_id, |
| 134 mojom::WindowDataPtr root, |
| 135 bool drawn); |
| 134 void OnEmbeddedAppDisconnected(Id window_id); | 136 void OnEmbeddedAppDisconnected(Id window_id); |
| 135 void OnUnembed(Id window_id); | 137 void OnUnembed(Id window_id); |
| 136 void OnLostCapture(Id window_id); | 138 void OnLostCapture(Id window_id); |
| 137 void OnTransientWindowAdded(Id window_id, Id transient_window_id); | 139 void OnTransientWindowAdded(Id window_id, Id transient_window_id); |
| 138 void OnTransientWindowRemoved(Id window_id, Id transient_window_id); | 140 void OnTransientWindowRemoved(Id window_id, Id transient_window_id); |
| 139 void OnWindowBoundsChanged(Id window_id, | 141 void OnWindowBoundsChanged(Id window_id, |
| 140 mojo::RectPtr old_bounds, | 142 mojo::RectPtr old_bounds, |
| 141 mojo::RectPtr new_bounds); | 143 mojo::RectPtr new_bounds); |
| 142 void OnWindowViewportMetricsChanged(mojom::ViewportMetricsPtr old_bounds, | 144 void OnWindowViewportMetricsChanged(mojom::ViewportMetricsPtr old_bounds, |
| 143 mojom::ViewportMetricsPtr new_bounds); | 145 mojom::ViewportMetricsPtr new_bounds); |
| 144 void OnWindowHierarchyChanged(Id window_id, | 146 void OnWindowHierarchyChanged(Id window_id, |
| 145 Id new_parent_id, | 147 Id new_parent_id, |
| 146 Id old_parent_id, | 148 Id old_parent_id, |
| 147 mojo::Array<mojom::WindowDataPtr> windows); | 149 mojo::Array<mojom::WindowDataPtr> windows); |
| 148 void OnWindowReordered(Id window_id, | 150 void OnWindowReordered(Id window_id, |
| 149 Id relative_window_id, | 151 Id relative_window_id, |
| 150 mojom::OrderDirection direction); | 152 mojom::OrderDirection direction); |
| 151 void OnWindowDeleted(Id window_id); | 153 void OnWindowDeleted(Id window_id); |
| 152 void OnWindowVisibilityChanged(Id window_id, bool visible); | 154 void OnWindowVisibilityChanged(Id window_id, bool visible); |
| 153 void OnWindowDrawnStateChanged(Id window_id, bool drawn); | 155 void OnWindowParentDrawnStateChanged(Id window_id, bool drawn); |
| 154 void OnWindowInputEvent(Id window_id, mojom::EventPtr event); | 156 void OnWindowInputEvent(Id window_id, mojom::EventPtr event); |
| 155 void OnWindowSharedPropertyChanged(Id window_id, | 157 void OnWindowSharedPropertyChanged(Id window_id, |
| 156 mojo::String name, | 158 mojo::String name, |
| 157 mojo::Array<uint8_t> data); | 159 mojo::Array<uint8_t> data); |
| 158 void OnWindowFocused(Id window_id); | 160 void OnWindowFocused(Id window_id); |
| 159 void OnWindowPredefinedCursorChanged(Id window_id, mojom::Cursor cursor_id); | 161 void OnWindowPredefinedCursorChanged(Id window_id, mojom::Cursor cursor_id); |
| 160 void OnChangeCompleted(uint32_t change_id, bool success); | 162 void OnChangeCompleted(uint32_t change_id, bool success); |
| 161 void OnTopLevelCreated(uint32_t change_id, mojom::WindowDataPtr window_data); | 163 void OnTopLevelCreated(uint32_t change_id, |
| 164 mojom::WindowDataPtr window_data, |
| 165 bool drawn); |
| 162 | 166 |
| 163 private: | 167 private: |
| 164 void AddChange(const Change& change); | 168 void AddChange(const Change& change); |
| 165 | 169 |
| 166 Delegate* delegate_; | 170 Delegate* delegate_; |
| 167 std::vector<Change> changes_; | 171 std::vector<Change> changes_; |
| 168 | 172 |
| 169 DISALLOW_COPY_AND_ASSIGN(TestChangeTracker); | 173 DISALLOW_COPY_AND_ASSIGN(TestChangeTracker); |
| 170 }; | 174 }; |
| 171 | 175 |
| 172 } // namespace ws | 176 } // namespace ws |
| 173 | 177 |
| 174 } // namespace mus | 178 } // namespace mus |
| 175 | 179 |
| 176 #endif // COMPONENTS_MUS_WS_TEST_CHANGE_TRACKER_H_ | 180 #endif // COMPONENTS_MUS_WS_TEST_CHANGE_TRACKER_H_ |
| OLD | NEW |