Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: ui/aura/test/mus/test_window_tree.h

Issue 2511883006: Mojo C++ bindings: switch services/ui/public/interfaces mojom target to use STL types. (Closed)
Patch Set: . Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/aura/mus/window_tree_client_unittest.cc ('k') | ui/aura/test/mus/test_window_tree.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 public: 44 public:
45 TestWindowTree(); 45 TestWindowTree();
46 ~TestWindowTree() override; 46 ~TestWindowTree() override;
47 47
48 void set_client(ui::mojom::WindowTreeClient* client) { client_ = client; } 48 void set_client(ui::mojom::WindowTreeClient* client) { client_ = client; }
49 49
50 uint32_t window_id() const { return window_id_; } 50 uint32_t window_id() const { return window_id_; }
51 51
52 bool WasEventAcked(uint32_t event_id) const; 52 bool WasEventAcked(uint32_t event_id) const;
53 53
54 mojo::Array<uint8_t> GetLastPropertyValue(); 54 base::Optional<std::vector<uint8_t>> GetLastPropertyValue();
55 55
56 mojo::Map<mojo::String, mojo::Array<uint8_t>> GetLastNewWindowProperties(); 56 base::Optional<std::unordered_map<std::string, std::vector<uint8_t>>>
57 GetLastNewWindowProperties();
57 58
58 // True if at least one function has been called that takes a change id. 59 // True if at least one function has been called that takes a change id.
59 bool has_change() const { return !changes_.empty(); } 60 bool has_change() const { return !changes_.empty(); }
60 61
61 // Acks all changes with a value of true. 62 // Acks all changes with a value of true.
62 void AckAllChanges(); 63 void AckAllChanges();
63 64
64 // Returns false if there are no, or more than one, changes of the specified 65 // Returns false if there are no, or more than one, changes of the specified
65 // type. If there is only one of the matching type it is acked with a result 66 // type. If there is only one of the matching type it is acked with a result
66 // of |result| and true is returned. 67 // of |result| and true is returned.
(...skipping 17 matching lines...) Expand all
84 struct Change { 85 struct Change {
85 WindowTreeChangeType type; 86 WindowTreeChangeType type;
86 uint32_t id; 87 uint32_t id;
87 }; 88 };
88 89
89 void OnChangeReceived( 90 void OnChangeReceived(
90 uint32_t change_id, 91 uint32_t change_id,
91 WindowTreeChangeType type = WindowTreeChangeType::OTHER); 92 WindowTreeChangeType type = WindowTreeChangeType::OTHER);
92 93
93 // ui::mojom::WindowTree: 94 // ui::mojom::WindowTree:
94 void NewWindow( 95 void NewWindow(uint32_t change_id,
95 uint32_t change_id, 96 uint32_t window_id,
96 uint32_t window_id, 97 const base::Optional<
97 mojo::Map<mojo::String, mojo::Array<uint8_t>> properties) override; 98 std::unordered_map<std::string, std::vector<uint8_t>>>&
99 properties) override;
98 void NewTopLevelWindow( 100 void NewTopLevelWindow(
99 uint32_t change_id, 101 uint32_t change_id,
100 uint32_t window_id, 102 uint32_t window_id,
101 mojo::Map<mojo::String, mojo::Array<uint8_t>> properties) override; 103 const std::unordered_map<std::string, std::vector<uint8_t>>& properties)
104 override;
102 void DeleteWindow(uint32_t change_id, uint32_t window_id) override; 105 void DeleteWindow(uint32_t change_id, uint32_t window_id) override;
103 void SetWindowBounds(uint32_t change_id, 106 void SetWindowBounds(uint32_t change_id,
104 uint32_t window_id, 107 uint32_t window_id,
105 const gfx::Rect& bounds) override; 108 const gfx::Rect& bounds) override;
106 void SetClientArea(uint32_t window_id, 109 void SetClientArea(uint32_t window_id,
107 const gfx::Insets& insets, 110 const gfx::Insets& insets,
108 mojo::Array<gfx::Rect> additional_client_areas) override; 111 const base::Optional<std::vector<gfx::Rect>>&
112 additional_client_areas) override;
109 void SetHitTestMask(uint32_t window_id, 113 void SetHitTestMask(uint32_t window_id,
110 const base::Optional<gfx::Rect>& mask) override; 114 const base::Optional<gfx::Rect>& mask) override;
111 void SetCanAcceptDrops(uint32_t window_id, bool accepts_drags) override; 115 void SetCanAcceptDrops(uint32_t window_id, bool accepts_drags) override;
112 void SetWindowVisibility(uint32_t change_id, 116 void SetWindowVisibility(uint32_t change_id,
113 uint32_t window_id, 117 uint32_t window_id,
114 bool visible) override; 118 bool visible) override;
115 void SetWindowProperty(uint32_t change_id, 119 void SetWindowProperty(
116 uint32_t window_id, 120 uint32_t change_id,
117 const mojo::String& name, 121 uint32_t window_id,
118 mojo::Array<uint8_t> value) override; 122 const std::string& name,
123 const base::Optional<std::vector<uint8_t>>& value) override;
119 void SetWindowOpacity(uint32_t change_id, 124 void SetWindowOpacity(uint32_t change_id,
120 uint32_t window_id, 125 uint32_t window_id,
121 float opacity) override; 126 float opacity) override;
122 void AttachCompositorFrameSink( 127 void AttachCompositorFrameSink(
123 uint32_t window_id, 128 uint32_t window_id,
124 ui::mojom::CompositorFrameSinkType type, 129 ui::mojom::CompositorFrameSinkType type,
125 mojo::InterfaceRequest<cc::mojom::MojoCompositorFrameSink> surface, 130 mojo::InterfaceRequest<cc::mojom::MojoCompositorFrameSink> surface,
126 cc::mojom::MojoCompositorFrameSinkClientPtr client) override; 131 cc::mojom::MojoCompositorFrameSinkClientPtr client) override;
127 void AddWindow(uint32_t change_id, uint32_t parent, uint32_t child) override; 132 void AddWindow(uint32_t change_id, uint32_t parent, uint32_t child) override;
128 void RemoveWindowFromParent(uint32_t change_id, uint32_t window_id) override; 133 void RemoveWindowFromParent(uint32_t change_id, uint32_t window_id) override;
(...skipping 28 matching lines...) Expand all
157 void SetImeVisibility(uint32_t window_id, 162 void SetImeVisibility(uint32_t window_id,
158 bool visible, 163 bool visible,
159 mojo::TextInputStatePtr state) override; 164 mojo::TextInputStatePtr state) override;
160 void OnWindowInputEventAck(uint32_t event_id, 165 void OnWindowInputEventAck(uint32_t event_id,
161 ui::mojom::EventResult result) override; 166 ui::mojom::EventResult result) override;
162 void GetWindowManagerClient( 167 void GetWindowManagerClient(
163 mojo::AssociatedInterfaceRequest<ui::mojom::WindowManagerClient> internal) 168 mojo::AssociatedInterfaceRequest<ui::mojom::WindowManagerClient> internal)
164 override; 169 override;
165 void GetCursorLocationMemory( 170 void GetCursorLocationMemory(
166 const GetCursorLocationMemoryCallback& callback) override; 171 const GetCursorLocationMemoryCallback& callback) override;
167 void PerformDragDrop(uint32_t change_id, 172 void PerformDragDrop(
168 uint32_t source_window_id, 173 uint32_t change_id,
169 mojo::Map<mojo::String, mojo::Array<uint8_t>> drag_data, 174 uint32_t source_window_id,
170 uint32_t drag_operation) override; 175 const std::unordered_map<std::string, std::vector<uint8_t>>& drag_data,
176 uint32_t drag_operation) override;
171 void CancelDragDrop(uint32_t window_id) override; 177 void CancelDragDrop(uint32_t window_id) override;
172 void PerformWindowMove(uint32_t change_id, 178 void PerformWindowMove(uint32_t change_id,
173 uint32_t window_id, 179 uint32_t window_id,
174 ui::mojom::MoveLoopSource source, 180 ui::mojom::MoveLoopSource source,
175 const gfx::Point& cursor_location) override; 181 const gfx::Point& cursor_location) override;
176 void CancelWindowMove(uint32_t window_id) override; 182 void CancelWindowMove(uint32_t window_id) override;
177 183
178 std::set<uint32_t> acked_events_; 184 std::set<uint32_t> acked_events_;
179 uint32_t window_id_ = 0u; 185 uint32_t window_id_ = 0u;
180 186
181 mojo::Array<uint8_t> last_property_value_; 187 base::Optional<std::vector<uint8_t>> last_property_value_;
182 188
183 std::vector<Change> changes_; 189 std::vector<Change> changes_;
184 190
185 ui::mojom::WindowTreeClient* client_; 191 ui::mojom::WindowTreeClient* client_;
186 192
187 mojo::Map<mojo::String, mojo::Array<uint8_t>> last_new_window_properties_; 193 base::Optional<std::unordered_map<std::string, std::vector<uint8_t>>>
194 last_new_window_properties_;
188 195
189 TransientData transient_data_; 196 TransientData transient_data_;
190 197
191 DISALLOW_COPY_AND_ASSIGN(TestWindowTree); 198 DISALLOW_COPY_AND_ASSIGN(TestWindowTree);
192 }; 199 };
193 200
194 } // namespace aura 201 } // namespace aura
195 202
196 #endif // UI_AURA_TEST_MUS_TEST_WINDOW_TREE_H_ 203 #endif // UI_AURA_TEST_MUS_TEST_WINDOW_TREE_H_
OLDNEW
« no previous file with comments | « ui/aura/mus/window_tree_client_unittest.cc ('k') | ui/aura/test/mus/test_window_tree.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698