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 #include "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "components/view_manager/ids.h" | 9 #include "components/view_manager/ids.h" |
10 #include "components/view_manager/public/interfaces/view_manager.mojom.h" | |
11 #include "components/view_manager/public/interfaces/view_manager_root.mojom.h" | 10 #include "components/view_manager/public/interfaces/view_manager_root.mojom.h" |
| 11 #include "components/view_manager/public/interfaces/view_tree.mojom.h" |
12 #include "components/view_manager/test_change_tracker.h" | 12 #include "components/view_manager/test_change_tracker.h" |
13 #include "mojo/application/public/cpp/application_delegate.h" | 13 #include "mojo/application/public/cpp/application_delegate.h" |
14 #include "mojo/application/public/cpp/application_impl.h" | 14 #include "mojo/application/public/cpp/application_impl.h" |
15 #include "mojo/application/public/cpp/application_test_base.h" | 15 #include "mojo/application/public/cpp/application_test_base.h" |
16 | 16 |
17 using mojo::ApplicationConnection; | 17 using mojo::ApplicationConnection; |
18 using mojo::ApplicationDelegate; | 18 using mojo::ApplicationDelegate; |
19 using mojo::Array; | 19 using mojo::Array; |
20 using mojo::Callback; | 20 using mojo::Callback; |
21 using mojo::ConnectionSpecificId; | 21 using mojo::ConnectionSpecificId; |
22 using mojo::ERROR_CODE_NONE; | 22 using mojo::ERROR_CODE_NONE; |
23 using mojo::ErrorCode; | 23 using mojo::ErrorCode; |
24 using mojo::EventPtr; | 24 using mojo::EventPtr; |
25 using mojo::Id; | 25 using mojo::Id; |
26 using mojo::InterfaceRequest; | 26 using mojo::InterfaceRequest; |
27 using mojo::ORDER_DIRECTION_ABOVE; | 27 using mojo::ORDER_DIRECTION_ABOVE; |
28 using mojo::ORDER_DIRECTION_BELOW; | 28 using mojo::ORDER_DIRECTION_BELOW; |
29 using mojo::OrderDirection; | 29 using mojo::OrderDirection; |
30 using mojo::RectPtr; | 30 using mojo::RectPtr; |
31 using mojo::ServiceProvider; | 31 using mojo::ServiceProvider; |
32 using mojo::ServiceProviderPtr; | 32 using mojo::ServiceProviderPtr; |
33 using mojo::String; | 33 using mojo::String; |
34 using mojo::ViewDataPtr; | 34 using mojo::ViewDataPtr; |
35 using mojo::ViewManagerClient; | 35 using mojo::ViewTree; |
36 using mojo::ViewManagerService; | 36 using mojo::ViewTreeClient; |
37 using mojo::ViewportMetricsPtr; | 37 using mojo::ViewportMetricsPtr; |
38 | 38 |
39 namespace view_manager { | 39 namespace view_manager { |
40 | 40 |
41 // Creates an id used for transport from the specified parameters. | 41 // Creates an id used for transport from the specified parameters. |
42 Id BuildViewId(ConnectionSpecificId connection_id, | 42 Id BuildViewId(ConnectionSpecificId connection_id, |
43 ConnectionSpecificId view_id) { | 43 ConnectionSpecificId view_id) { |
44 return (connection_id << 16) | view_id; | 44 return (connection_id << 16) | view_id; |
45 } | 45 } |
46 | 46 |
47 // Callback function from ViewManagerService functions. ------------------------ | 47 // Callback function from ViewTree functions. ---------------------------------- |
48 | 48 |
49 void BoolResultCallback(base::RunLoop* run_loop, | 49 void BoolResultCallback(base::RunLoop* run_loop, |
50 bool* result_cache, | 50 bool* result_cache, |
51 bool result) { | 51 bool result) { |
52 *result_cache = result; | 52 *result_cache = result; |
53 run_loop->Quit(); | 53 run_loop->Quit(); |
54 } | 54 } |
55 | 55 |
56 void ErrorCodeResultCallback(base::RunLoop* run_loop, | 56 void ErrorCodeResultCallback(base::RunLoop* run_loop, |
57 ErrorCode* result_cache, | 57 ErrorCode* result_cache, |
58 ErrorCode result) { | 58 ErrorCode result) { |
59 *result_cache = result; | 59 *result_cache = result; |
60 run_loop->Quit(); | 60 run_loop->Quit(); |
61 } | 61 } |
62 | 62 |
63 void ViewTreeResultCallback(base::RunLoop* run_loop, | 63 void ViewTreeResultCallback(base::RunLoop* run_loop, |
64 std::vector<TestView>* views, | 64 std::vector<TestView>* views, |
65 Array<ViewDataPtr> results) { | 65 Array<ViewDataPtr> results) { |
66 ViewDatasToTestViews(results, views); | 66 ViewDatasToTestViews(results, views); |
67 run_loop->Quit(); | 67 run_loop->Quit(); |
68 } | 68 } |
69 | 69 |
70 // ----------------------------------------------------------------------------- | 70 // ----------------------------------------------------------------------------- |
71 | 71 |
72 bool EmbedUrl(mojo::ApplicationImpl* app, | 72 bool EmbedUrl(mojo::ApplicationImpl* app, |
73 ViewManagerService* vm, | 73 ViewTree* vm, |
74 const String& url, | 74 const String& url, |
75 Id root_id) { | 75 Id root_id) { |
76 bool result = false; | 76 bool result = false; |
77 base::RunLoop run_loop; | 77 base::RunLoop run_loop; |
78 { | 78 { |
79 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 79 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
80 request->url = mojo::String::From(url); | 80 request->url = mojo::String::From(url); |
81 scoped_ptr<ApplicationConnection> connection = | 81 scoped_ptr<ApplicationConnection> connection = |
82 app->ConnectToApplication(request.Pass()); | 82 app->ConnectToApplication(request.Pass()); |
83 mojo::ViewManagerClientPtr client; | 83 mojo::ViewTreeClientPtr client; |
84 connection->ConnectToService(&client); | 84 connection->ConnectToService(&client); |
85 vm->Embed(root_id, client.Pass(), | 85 vm->Embed(root_id, client.Pass(), |
86 base::Bind(&BoolResultCallback, &run_loop, &result)); | 86 base::Bind(&BoolResultCallback, &run_loop, &result)); |
87 } | 87 } |
88 run_loop.Run(); | 88 run_loop.Run(); |
89 return result; | 89 return result; |
90 } | 90 } |
91 | 91 |
92 bool EmbedAllowingReembed(mojo::ApplicationImpl* app, | 92 bool EmbedAllowingReembed(mojo::ApplicationImpl* app, |
93 ViewManagerService* vm, | 93 ViewTree* vm, |
94 const String& url, | 94 const String& url, |
95 Id root_id) { | 95 Id root_id) { |
96 bool result = false; | 96 bool result = false; |
97 base::RunLoop run_loop; | 97 base::RunLoop run_loop; |
98 { | 98 { |
99 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 99 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
100 request->url = mojo::String::From(url); | 100 request->url = mojo::String::From(url); |
101 vm->EmbedAllowingReembed( | 101 vm->EmbedAllowingReembed( |
102 root_id, request.Pass(), | 102 root_id, request.Pass(), |
103 base::Bind(&BoolResultCallback, &run_loop, &result)); | 103 base::Bind(&BoolResultCallback, &run_loop, &result)); |
104 } | 104 } |
105 run_loop.Run(); | 105 run_loop.Run(); |
106 return result; | 106 return result; |
107 } | 107 } |
108 | 108 |
109 bool Embed(ViewManagerService* vm, | 109 bool Embed(ViewTree* vm, Id root_id, mojo::ViewTreeClientPtr client) { |
110 Id root_id, | |
111 mojo::ViewManagerClientPtr client) { | |
112 bool result = false; | 110 bool result = false; |
113 base::RunLoop run_loop; | 111 base::RunLoop run_loop; |
114 { | 112 { |
115 vm->Embed(root_id, client.Pass(), | 113 vm->Embed(root_id, client.Pass(), |
116 base::Bind(&BoolResultCallback, &run_loop, &result)); | 114 base::Bind(&BoolResultCallback, &run_loop, &result)); |
117 } | 115 } |
118 run_loop.Run(); | 116 run_loop.Run(); |
119 return result; | 117 return result; |
120 } | 118 } |
121 | 119 |
122 ErrorCode CreateViewWithErrorCode(ViewManagerService* vm, Id view_id) { | 120 ErrorCode CreateViewWithErrorCode(ViewTree* vm, Id view_id) { |
123 ErrorCode result = ERROR_CODE_NONE; | 121 ErrorCode result = ERROR_CODE_NONE; |
124 base::RunLoop run_loop; | 122 base::RunLoop run_loop; |
125 vm->CreateView(view_id, | 123 vm->CreateView(view_id, |
126 base::Bind(&ErrorCodeResultCallback, &run_loop, &result)); | 124 base::Bind(&ErrorCodeResultCallback, &run_loop, &result)); |
127 run_loop.Run(); | 125 run_loop.Run(); |
128 return result; | 126 return result; |
129 } | 127 } |
130 | 128 |
131 bool AddView(ViewManagerService* vm, Id parent, Id child) { | 129 bool AddView(ViewTree* vm, Id parent, Id child) { |
132 bool result = false; | 130 bool result = false; |
133 base::RunLoop run_loop; | 131 base::RunLoop run_loop; |
134 vm->AddView(parent, child, | 132 vm->AddView(parent, child, |
135 base::Bind(&BoolResultCallback, &run_loop, &result)); | 133 base::Bind(&BoolResultCallback, &run_loop, &result)); |
136 run_loop.Run(); | 134 run_loop.Run(); |
137 return result; | 135 return result; |
138 } | 136 } |
139 | 137 |
140 bool RemoveViewFromParent(ViewManagerService* vm, Id view_id) { | 138 bool RemoveViewFromParent(ViewTree* vm, Id view_id) { |
141 bool result = false; | 139 bool result = false; |
142 base::RunLoop run_loop; | 140 base::RunLoop run_loop; |
143 vm->RemoveViewFromParent(view_id, | 141 vm->RemoveViewFromParent(view_id, |
144 base::Bind(&BoolResultCallback, &run_loop, &result)); | 142 base::Bind(&BoolResultCallback, &run_loop, &result)); |
145 run_loop.Run(); | 143 run_loop.Run(); |
146 return result; | 144 return result; |
147 } | 145 } |
148 | 146 |
149 bool ReorderView(ViewManagerService* vm, | 147 bool ReorderView(ViewTree* vm, |
150 Id view_id, | 148 Id view_id, |
151 Id relative_view_id, | 149 Id relative_view_id, |
152 OrderDirection direction) { | 150 OrderDirection direction) { |
153 bool result = false; | 151 bool result = false; |
154 base::RunLoop run_loop; | 152 base::RunLoop run_loop; |
155 vm->ReorderView(view_id, relative_view_id, direction, | 153 vm->ReorderView(view_id, relative_view_id, direction, |
156 base::Bind(&BoolResultCallback, &run_loop, &result)); | 154 base::Bind(&BoolResultCallback, &run_loop, &result)); |
157 run_loop.Run(); | 155 run_loop.Run(); |
158 return result; | 156 return result; |
159 } | 157 } |
160 | 158 |
161 void GetViewTree(ViewManagerService* vm, | 159 void GetViewTree(ViewTree* vm, |
162 Id view_id, | 160 Id view_id, |
163 std::vector<TestView>* views) { | 161 std::vector<TestView>* views) { |
164 base::RunLoop run_loop; | 162 base::RunLoop run_loop; |
165 vm->GetViewTree(view_id, | 163 vm->GetViewTree(view_id, |
166 base::Bind(&ViewTreeResultCallback, &run_loop, views)); | 164 base::Bind(&ViewTreeResultCallback, &run_loop, views)); |
167 run_loop.Run(); | 165 run_loop.Run(); |
168 } | 166 } |
169 | 167 |
170 bool DeleteView(ViewManagerService* vm, Id view_id) { | 168 bool DeleteView(ViewTree* vm, Id view_id) { |
171 base::RunLoop run_loop; | 169 base::RunLoop run_loop; |
172 bool result = false; | 170 bool result = false; |
173 vm->DeleteView(view_id, base::Bind(&BoolResultCallback, &run_loop, &result)); | 171 vm->DeleteView(view_id, base::Bind(&BoolResultCallback, &run_loop, &result)); |
174 run_loop.Run(); | 172 run_loop.Run(); |
175 return result; | 173 return result; |
176 } | 174 } |
177 | 175 |
178 bool SetViewBounds(ViewManagerService* vm, | 176 bool SetViewBounds(ViewTree* vm, |
179 Id view_id, | 177 Id view_id, |
180 int x, | 178 int x, |
181 int y, | 179 int y, |
182 int w, | 180 int w, |
183 int h) { | 181 int h) { |
184 base::RunLoop run_loop; | 182 base::RunLoop run_loop; |
185 bool result = false; | 183 bool result = false; |
186 RectPtr rect(mojo::Rect::New()); | 184 RectPtr rect(mojo::Rect::New()); |
187 rect->x = x; | 185 rect->x = x; |
188 rect->y = y; | 186 rect->y = y; |
189 rect->width = w; | 187 rect->width = w; |
190 rect->height = h; | 188 rect->height = h; |
191 vm->SetViewBounds(view_id, rect.Pass(), | 189 vm->SetViewBounds(view_id, rect.Pass(), |
192 base::Bind(&BoolResultCallback, &run_loop, &result)); | 190 base::Bind(&BoolResultCallback, &run_loop, &result)); |
193 run_loop.Run(); | 191 run_loop.Run(); |
194 return result; | 192 return result; |
195 } | 193 } |
196 | 194 |
197 bool SetViewVisibility(ViewManagerService* vm, Id view_id, bool visible) { | 195 bool SetViewVisibility(ViewTree* vm, Id view_id, bool visible) { |
198 base::RunLoop run_loop; | 196 base::RunLoop run_loop; |
199 bool result = false; | 197 bool result = false; |
200 vm->SetViewVisibility(view_id, visible, | 198 vm->SetViewVisibility(view_id, visible, |
201 base::Bind(&BoolResultCallback, &run_loop, &result)); | 199 base::Bind(&BoolResultCallback, &run_loop, &result)); |
202 run_loop.Run(); | 200 run_loop.Run(); |
203 return result; | 201 return result; |
204 } | 202 } |
205 | 203 |
206 bool SetViewProperty(ViewManagerService* vm, | 204 bool SetViewProperty(ViewTree* vm, |
207 Id view_id, | 205 Id view_id, |
208 const std::string& name, | 206 const std::string& name, |
209 const std::vector<uint8_t>* data) { | 207 const std::vector<uint8_t>* data) { |
210 base::RunLoop run_loop; | 208 base::RunLoop run_loop; |
211 bool result = false; | 209 bool result = false; |
212 Array<uint8_t> mojo_data; | 210 Array<uint8_t> mojo_data; |
213 if (data) | 211 if (data) |
214 mojo_data = Array<uint8_t>::From(*data); | 212 mojo_data = Array<uint8_t>::From(*data); |
215 vm->SetViewProperty(view_id, name, mojo_data.Pass(), | 213 vm->SetViewProperty(view_id, name, mojo_data.Pass(), |
216 base::Bind(&BoolResultCallback, &run_loop, &result)); | 214 base::Bind(&BoolResultCallback, &run_loop, &result)); |
217 run_loop.Run(); | 215 run_loop.Run(); |
218 return result; | 216 return result; |
219 } | 217 } |
220 | 218 |
221 // Utility functions ----------------------------------------------------------- | 219 // Utility functions ----------------------------------------------------------- |
222 | 220 |
223 // Waits for all messages to be received by |vm|. This is done by attempting to | 221 // Waits for all messages to be received by |vm|. This is done by attempting to |
224 // create a bogus view. When we get the response we know all messages have been | 222 // create a bogus view. When we get the response we know all messages have been |
225 // processed. | 223 // processed. |
226 bool WaitForAllMessages(ViewManagerService* vm) { | 224 bool WaitForAllMessages(ViewTree* vm) { |
227 ErrorCode result = ERROR_CODE_NONE; | 225 ErrorCode result = ERROR_CODE_NONE; |
228 base::RunLoop run_loop; | 226 base::RunLoop run_loop; |
229 vm->CreateView(ViewIdToTransportId(InvalidViewId()), | 227 vm->CreateView(ViewIdToTransportId(InvalidViewId()), |
230 base::Bind(&ErrorCodeResultCallback, &run_loop, &result)); | 228 base::Bind(&ErrorCodeResultCallback, &run_loop, &result)); |
231 run_loop.Run(); | 229 run_loop.Run(); |
232 return result != ERROR_CODE_NONE; | 230 return result != ERROR_CODE_NONE; |
233 } | 231 } |
234 | 232 |
235 bool HasClonedView(const std::vector<TestView>& views) { | 233 bool HasClonedView(const std::vector<TestView>& views) { |
236 for (size_t i = 0; i < views.size(); ++i) | 234 for (size_t i = 0; i < views.size(); ++i) |
237 if (views[i].view_id == ViewIdToTransportId(ClonedViewId())) | 235 if (views[i].view_id == ViewIdToTransportId(ClonedViewId())) |
238 return true; | 236 return true; |
239 return false; | 237 return false; |
240 } | 238 } |
241 | 239 |
242 const Id kNullParentId = 0; | 240 const Id kNullParentId = 0; |
243 std::string IdToString(Id id) { | 241 std::string IdToString(Id id) { |
244 return (id == kNullParentId) | 242 return (id == kNullParentId) |
245 ? "null" | 243 ? "null" |
246 : base::StringPrintf("%d,%d", mojo::HiWord(id), mojo::LoWord(id)); | 244 : base::StringPrintf("%d,%d", mojo::HiWord(id), mojo::LoWord(id)); |
247 } | 245 } |
248 | 246 |
249 std::string ViewParentToString(Id view, Id parent) { | 247 std::string ViewParentToString(Id view, Id parent) { |
250 return base::StringPrintf("view=%s parent=%s", IdToString(view).c_str(), | 248 return base::StringPrintf("view=%s parent=%s", IdToString(view).c_str(), |
251 IdToString(parent).c_str()); | 249 IdToString(parent).c_str()); |
252 } | 250 } |
253 | 251 |
254 // ----------------------------------------------------------------------------- | 252 // ----------------------------------------------------------------------------- |
255 | 253 |
256 // A ViewManagerClient implementation that logs all changes to a tracker. | 254 // A ViewTreeClient implementation that logs all changes to a tracker. |
257 class ViewManagerClientImpl : public mojo::ViewManagerClient, | 255 class ViewTreeClientImpl : public mojo::ViewTreeClient, |
258 public TestChangeTracker::Delegate { | 256 public TestChangeTracker::Delegate { |
259 public: | 257 public: |
260 explicit ViewManagerClientImpl(mojo::ApplicationImpl* app) | 258 explicit ViewTreeClientImpl(mojo::ApplicationImpl* app) |
261 : binding_(this), app_(app), connection_id_(0), root_view_id_(0) { | 259 : binding_(this), app_(app), connection_id_(0), root_view_id_(0) { |
262 tracker_.set_delegate(this); | 260 tracker_.set_delegate(this); |
263 } | 261 } |
264 | 262 |
265 void Bind(mojo::InterfaceRequest<mojo::ViewManagerClient> request) { | 263 void Bind(mojo::InterfaceRequest<mojo::ViewTreeClient> request) { |
266 binding_.Bind(request.Pass()); | 264 binding_.Bind(request.Pass()); |
267 } | 265 } |
268 | 266 |
269 mojo::ViewManagerService* service() { return service_.get(); } | 267 mojo::ViewTree* tree() { return tree_.get(); } |
270 TestChangeTracker* tracker() { return &tracker_; } | 268 TestChangeTracker* tracker() { return &tracker_; } |
271 | 269 |
272 // Runs a nested MessageLoop until |count| changes (calls to | 270 // Runs a nested MessageLoop until |count| changes (calls to |
273 // ViewManagerClient functions) have been received. | 271 // ViewTreeClient functions) have been received. |
274 void WaitForChangeCount(size_t count) { | 272 void WaitForChangeCount(size_t count) { |
275 if (count == tracker_.changes()->size()) | 273 if (count == tracker_.changes()->size()) |
276 return; | 274 return; |
277 | 275 |
278 ASSERT_TRUE(wait_state_.get() == nullptr); | 276 ASSERT_TRUE(wait_state_.get() == nullptr); |
279 wait_state_.reset(new WaitState); | 277 wait_state_.reset(new WaitState); |
280 wait_state_->change_count = count; | 278 wait_state_->change_count = count; |
281 wait_state_->run_loop.Run(); | 279 wait_state_->run_loop.Run(); |
282 wait_state_.reset(); | 280 wait_state_.reset(); |
283 } | 281 } |
284 | 282 |
285 // Runs a nested MessageLoop until OnEmbed() has been encountered. | 283 // Runs a nested MessageLoop until OnEmbed() has been encountered. |
286 void WaitForOnEmbed() { | 284 void WaitForOnEmbed() { |
287 if (service_) | 285 if (tree_) |
288 return; | 286 return; |
289 embed_run_loop_.reset(new base::RunLoop); | 287 embed_run_loop_.reset(new base::RunLoop); |
290 embed_run_loop_->Run(); | 288 embed_run_loop_->Run(); |
291 embed_run_loop_.reset(); | 289 embed_run_loop_.reset(); |
292 } | 290 } |
293 | 291 |
294 bool WaitForIncomingMethodCall() { | 292 bool WaitForIncomingMethodCall() { |
295 return binding_.WaitForIncomingMethodCall(); | 293 return binding_.WaitForIncomingMethodCall(); |
296 } | 294 } |
297 | 295 |
298 Id CreateView(ConnectionSpecificId view_id) { | 296 Id CreateView(ConnectionSpecificId view_id) { |
299 ErrorCode result = ERROR_CODE_NONE; | 297 ErrorCode result = ERROR_CODE_NONE; |
300 base::RunLoop run_loop; | 298 base::RunLoop run_loop; |
301 Id id = BuildViewId(connection_id_, view_id); | 299 Id id = BuildViewId(connection_id_, view_id); |
302 service()->CreateView( | 300 tree()->CreateView( |
303 id, base::Bind(&ErrorCodeResultCallback, &run_loop, &result)); | 301 id, base::Bind(&ErrorCodeResultCallback, &run_loop, &result)); |
304 run_loop.Run(); | 302 run_loop.Run(); |
305 return result == ERROR_CODE_NONE ? id : 0; | 303 return result == ERROR_CODE_NONE ? id : 0; |
306 } | 304 } |
307 | 305 |
308 void set_root_view(Id root_view_id) { root_view_id_ = root_view_id; } | 306 void set_root_view(Id root_view_id) { root_view_id_ = root_view_id; } |
309 | 307 |
310 private: | 308 private: |
311 // Used when running a nested MessageLoop. | 309 // Used when running a nested MessageLoop. |
312 struct WaitState { | 310 struct WaitState { |
313 WaitState() : change_count(0) {} | 311 WaitState() : change_count(0) {} |
314 | 312 |
315 // Number of changes waiting for. | 313 // Number of changes waiting for. |
316 size_t change_count; | 314 size_t change_count; |
317 base::RunLoop run_loop; | 315 base::RunLoop run_loop; |
318 }; | 316 }; |
319 | 317 |
320 // TestChangeTracker::Delegate: | 318 // TestChangeTracker::Delegate: |
321 void OnChangeAdded() override { | 319 void OnChangeAdded() override { |
322 if (wait_state_.get() && | 320 if (wait_state_.get() && |
323 wait_state_->change_count == tracker_.changes()->size()) { | 321 wait_state_->change_count == tracker_.changes()->size()) { |
324 wait_state_->run_loop.Quit(); | 322 wait_state_->run_loop.Quit(); |
325 } | 323 } |
326 } | 324 } |
327 | 325 |
328 // ViewManagerClient: | 326 // ViewTreeClient: |
329 void OnEmbed(ConnectionSpecificId connection_id, | 327 void OnEmbed(ConnectionSpecificId connection_id, |
330 ViewDataPtr root, | 328 ViewDataPtr root, |
331 mojo::ViewManagerServicePtr view_manager_service, | 329 mojo::ViewTreePtr tree, |
332 mojo::Id focused_view_id) override { | 330 mojo::Id focused_view_id) override { |
333 // TODO(sky): add coverage of |focused_view_id|. | 331 // TODO(sky): add coverage of |focused_view_id|. |
334 service_ = view_manager_service.Pass(); | 332 tree_ = tree.Pass(); |
335 connection_id_ = connection_id; | 333 connection_id_ = connection_id; |
336 tracker()->OnEmbed(connection_id, root.Pass()); | 334 tracker()->OnEmbed(connection_id, root.Pass()); |
337 if (embed_run_loop_) | 335 if (embed_run_loop_) |
338 embed_run_loop_->Quit(); | 336 embed_run_loop_->Quit(); |
339 } | 337 } |
340 void OnEmbedForDescendant( | 338 void OnEmbedForDescendant( |
341 uint32_t view, | 339 uint32_t view, |
342 mojo::URLRequestPtr request, | 340 mojo::URLRequestPtr request, |
343 const OnEmbedForDescendantCallback& callback) override { | 341 const OnEmbedForDescendantCallback& callback) override { |
344 tracker()->OnEmbedForDescendant(view); | 342 tracker()->OnEmbedForDescendant(view); |
345 mojo::ViewManagerClientPtr client; | 343 mojo::ViewTreeClientPtr client; |
346 scoped_ptr<ApplicationConnection> connection = | 344 scoped_ptr<ApplicationConnection> connection = |
347 app_->ConnectToApplication(request.Pass()); | 345 app_->ConnectToApplication(request.Pass()); |
348 connection->ConnectToService(&client); | 346 connection->ConnectToService(&client); |
349 callback.Run(client.Pass()); | 347 callback.Run(client.Pass()); |
350 } | 348 } |
351 void OnEmbeddedAppDisconnected(Id view_id) override { | 349 void OnEmbeddedAppDisconnected(Id view_id) override { |
352 tracker()->OnEmbeddedAppDisconnected(view_id); | 350 tracker()->OnEmbeddedAppDisconnected(view_id); |
353 } | 351 } |
354 void OnUnembed() override { tracker()->OnUnembed(); } | 352 void OnUnembed() override { tracker()->OnUnembed(); } |
355 void OnViewBoundsChanged(Id view_id, | 353 void OnViewBoundsChanged(Id view_id, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 void OnViewSharedPropertyChanged(uint32_t view, | 394 void OnViewSharedPropertyChanged(uint32_t view, |
397 const String& name, | 395 const String& name, |
398 Array<uint8_t> new_data) override { | 396 Array<uint8_t> new_data) override { |
399 tracker_.OnViewSharedPropertyChanged(view, name, new_data.Pass()); | 397 tracker_.OnViewSharedPropertyChanged(view, name, new_data.Pass()); |
400 } | 398 } |
401 // TODO(sky): add testing coverage. | 399 // TODO(sky): add testing coverage. |
402 void OnViewFocused(uint32_t focused_view_id) override {} | 400 void OnViewFocused(uint32_t focused_view_id) override {} |
403 | 401 |
404 TestChangeTracker tracker_; | 402 TestChangeTracker tracker_; |
405 | 403 |
406 mojo::ViewManagerServicePtr service_; | 404 mojo::ViewTreePtr tree_; |
407 | 405 |
408 // If non-null we're waiting for OnEmbed() using this RunLoop. | 406 // If non-null we're waiting for OnEmbed() using this RunLoop. |
409 scoped_ptr<base::RunLoop> embed_run_loop_; | 407 scoped_ptr<base::RunLoop> embed_run_loop_; |
410 | 408 |
411 // If non-null we're waiting for a certain number of change notifications to | 409 // If non-null we're waiting for a certain number of change notifications to |
412 // be encountered. | 410 // be encountered. |
413 scoped_ptr<WaitState> wait_state_; | 411 scoped_ptr<WaitState> wait_state_; |
414 | 412 |
415 mojo::Binding<ViewManagerClient> binding_; | 413 mojo::Binding<ViewTreeClient> binding_; |
416 mojo::ApplicationImpl* app_; | 414 mojo::ApplicationImpl* app_; |
417 Id connection_id_; | 415 Id connection_id_; |
418 Id root_view_id_; | 416 Id root_view_id_; |
419 | 417 |
420 DISALLOW_COPY_AND_ASSIGN(ViewManagerClientImpl); | 418 DISALLOW_COPY_AND_ASSIGN(ViewTreeClientImpl); |
421 }; | 419 }; |
422 | 420 |
423 // ----------------------------------------------------------------------------- | 421 // ----------------------------------------------------------------------------- |
424 | 422 |
425 // InterfaceFactory for vending ViewManagerClientImpls. | 423 // InterfaceFactory for vending ViewTreeClientImpls. |
426 class ViewManagerClientFactory | 424 class ViewTreeClientFactory : public mojo::InterfaceFactory<ViewTreeClient> { |
427 : public mojo::InterfaceFactory<ViewManagerClient> { | |
428 public: | 425 public: |
429 explicit ViewManagerClientFactory(mojo::ApplicationImpl* app) : app_(app) {} | 426 explicit ViewTreeClientFactory(mojo::ApplicationImpl* app) : app_(app) {} |
430 ~ViewManagerClientFactory() override {} | 427 ~ViewTreeClientFactory() override {} |
431 | 428 |
432 // Runs a nested MessageLoop until a new instance has been created. | 429 // Runs a nested MessageLoop until a new instance has been created. |
433 scoped_ptr<ViewManagerClientImpl> WaitForInstance() { | 430 scoped_ptr<ViewTreeClientImpl> WaitForInstance() { |
434 if (!client_impl_.get()) { | 431 if (!client_impl_.get()) { |
435 DCHECK(!run_loop_.get()); | 432 DCHECK(!run_loop_.get()); |
436 run_loop_.reset(new base::RunLoop); | 433 run_loop_.reset(new base::RunLoop); |
437 run_loop_->Run(); | 434 run_loop_->Run(); |
438 run_loop_.reset(); | 435 run_loop_.reset(); |
439 } | 436 } |
440 return client_impl_.Pass(); | 437 return client_impl_.Pass(); |
441 } | 438 } |
442 | 439 |
443 private: | 440 private: |
444 // InterfaceFactory<ViewManagerClient>: | 441 // InterfaceFactory<ViewTreeClient>: |
445 void Create(ApplicationConnection* connection, | 442 void Create(ApplicationConnection* connection, |
446 InterfaceRequest<ViewManagerClient> request) override { | 443 InterfaceRequest<ViewTreeClient> request) override { |
447 client_impl_.reset(new ViewManagerClientImpl(app_)); | 444 client_impl_.reset(new ViewTreeClientImpl(app_)); |
448 client_impl_->Bind(request.Pass()); | 445 client_impl_->Bind(request.Pass()); |
449 if (run_loop_.get()) | 446 if (run_loop_.get()) |
450 run_loop_->Quit(); | 447 run_loop_->Quit(); |
451 } | 448 } |
452 | 449 |
453 mojo::ApplicationImpl* app_; | 450 mojo::ApplicationImpl* app_; |
454 scoped_ptr<ViewManagerClientImpl> client_impl_; | 451 scoped_ptr<ViewTreeClientImpl> client_impl_; |
455 scoped_ptr<base::RunLoop> run_loop_; | 452 scoped_ptr<base::RunLoop> run_loop_; |
456 | 453 |
457 DISALLOW_COPY_AND_ASSIGN(ViewManagerClientFactory); | 454 DISALLOW_COPY_AND_ASSIGN(ViewTreeClientFactory); |
458 }; | 455 }; |
459 | 456 |
460 class ViewManagerServiceAppTest : public mojo::test::ApplicationTestBase, | 457 class ViewTreeAppTest : public mojo::test::ApplicationTestBase, |
461 public ApplicationDelegate { | 458 public ApplicationDelegate { |
462 public: | 459 public: |
463 ViewManagerServiceAppTest() | 460 ViewTreeAppTest() |
464 : connection_id_1_(0), connection_id_2_(0), root_view_id_(0) {} | 461 : connection_id_1_(0), connection_id_2_(0), root_view_id_(0) {} |
465 ~ViewManagerServiceAppTest() override {} | 462 ~ViewTreeAppTest() override {} |
466 | 463 |
467 protected: | 464 protected: |
468 enum class EmbedType { | 465 enum class EmbedType { |
469 ALLOW_REEMBED, | 466 ALLOW_REEMBED, |
470 NO_REEMBED, | 467 NO_REEMBED, |
471 }; | 468 }; |
472 | 469 |
473 // Returns the changes from the various connections. | 470 // Returns the changes from the various connections. |
474 std::vector<Change>* changes1() { return vm_client1_->tracker()->changes(); } | 471 std::vector<Change>* changes1() { return vm_client1_->tracker()->changes(); } |
475 std::vector<Change>* changes2() { return vm_client2_->tracker()->changes(); } | 472 std::vector<Change>* changes2() { return vm_client2_->tracker()->changes(); } |
476 std::vector<Change>* changes3() { return vm_client3_->tracker()->changes(); } | 473 std::vector<Change>* changes3() { return vm_client3_->tracker()->changes(); } |
477 | 474 |
478 // Various connections. |vm1()|, being the first connection, has special | 475 // Various connections. |vm1()|, being the first connection, has special |
479 // permissions (it's treated as the window manager). | 476 // permissions (it's treated as the window manager). |
480 ViewManagerService* vm1() { return vm_client1_->service(); } | 477 ViewTree* vm1() { return vm_client1_->tree(); } |
481 ViewManagerService* vm2() { return vm_client2_->service(); } | 478 ViewTree* vm2() { return vm_client2_->tree(); } |
482 ViewManagerService* vm3() { return vm_client3_->service(); } | 479 ViewTree* vm3() { return vm_client3_->tree(); } |
483 | 480 |
484 ViewManagerClientImpl* vm_client1() { return vm_client1_.get(); } | 481 ViewTreeClientImpl* vm_client1() { return vm_client1_.get(); } |
485 ViewManagerClientImpl* vm_client2() { return vm_client2_.get(); } | 482 ViewTreeClientImpl* vm_client2() { return vm_client2_.get(); } |
486 ViewManagerClientImpl* vm_client3() { return vm_client3_.get(); } | 483 ViewTreeClientImpl* vm_client3() { return vm_client3_.get(); } |
487 | 484 |
488 Id root_view_id() const { return root_view_id_; } | 485 Id root_view_id() const { return root_view_id_; } |
489 | 486 |
490 int connection_id_1() const { return connection_id_1_; } | 487 int connection_id_1() const { return connection_id_1_; } |
491 int connection_id_2() const { return connection_id_2_; } | 488 int connection_id_2() const { return connection_id_2_; } |
492 | 489 |
493 void EstablishSecondConnectionWithRoot(Id root_id) { | 490 void EstablishSecondConnectionWithRoot(Id root_id) { |
494 ASSERT_TRUE(vm_client2_.get() == nullptr); | 491 ASSERT_TRUE(vm_client2_.get() == nullptr); |
495 vm_client2_ = EstablishConnectionViaEmbed( | 492 vm_client2_ = EstablishConnectionViaEmbed( |
496 vm1(), root_id, EmbedType::NO_REEMBED, &connection_id_2_); | 493 vm1(), root_id, EmbedType::NO_REEMBED, &connection_id_2_); |
(...skipping 10 matching lines...) Expand all Loading... |
507 } | 504 } |
508 ASSERT_NO_FATAL_FAILURE( | 505 ASSERT_NO_FATAL_FAILURE( |
509 EstablishSecondConnectionWithRoot(BuildViewId(connection_id_1(), 1))); | 506 EstablishSecondConnectionWithRoot(BuildViewId(connection_id_1(), 1))); |
510 | 507 |
511 if (create_initial_view) { | 508 if (create_initial_view) { |
512 EXPECT_EQ("[" + ViewParentToString(view_1_1, kNullParentId) + "]", | 509 EXPECT_EQ("[" + ViewParentToString(view_1_1, kNullParentId) + "]", |
513 ChangeViewDescription(*changes2())); | 510 ChangeViewDescription(*changes2())); |
514 } | 511 } |
515 } | 512 } |
516 | 513 |
517 void EstablishThirdConnection(ViewManagerService* owner, Id root_id) { | 514 void EstablishThirdConnection(ViewTree* owner, Id root_id) { |
518 ASSERT_TRUE(vm_client3_.get() == nullptr); | 515 ASSERT_TRUE(vm_client3_.get() == nullptr); |
519 vm_client3_ = EstablishConnectionViaEmbed(owner, root_id, | 516 vm_client3_ = EstablishConnectionViaEmbed(owner, root_id, |
520 EmbedType::NO_REEMBED, nullptr); | 517 EmbedType::NO_REEMBED, nullptr); |
521 ASSERT_TRUE(vm_client3_.get() != nullptr); | 518 ASSERT_TRUE(vm_client3_.get() != nullptr); |
522 vm_client3_->set_root_view(root_view_id_); | 519 vm_client3_->set_root_view(root_view_id_); |
523 } | 520 } |
524 | 521 |
525 // Establishes a new connection by way of Embed() on the specified | 522 // Establishes a new connection by way of Embed() on the specified |
526 // ViewManagerService. | 523 // ViewTree. |
527 scoped_ptr<ViewManagerClientImpl> EstablishConnectionViaEmbed( | 524 scoped_ptr<ViewTreeClientImpl> EstablishConnectionViaEmbed( |
528 ViewManagerService* owner, | 525 ViewTree* owner, |
529 Id root_id, | 526 Id root_id, |
530 EmbedType embed_type, | 527 EmbedType embed_type, |
531 int* connection_id) { | 528 int* connection_id) { |
532 if (embed_type == EmbedType::NO_REEMBED && | 529 if (embed_type == EmbedType::NO_REEMBED && |
533 !EmbedUrl(application_impl(), owner, application_impl()->url(), | 530 !EmbedUrl(application_impl(), owner, application_impl()->url(), |
534 root_id)) { | 531 root_id)) { |
535 ADD_FAILURE() << "Embed() failed"; | 532 ADD_FAILURE() << "Embed() failed"; |
536 return nullptr; | 533 return nullptr; |
537 } else if (embed_type == EmbedType::ALLOW_REEMBED && | 534 } else if (embed_type == EmbedType::ALLOW_REEMBED && |
538 !EmbedAllowingReembed(application_impl(), owner, | 535 !EmbedAllowingReembed(application_impl(), owner, |
539 application_impl()->url(), root_id)) { | 536 application_impl()->url(), root_id)) { |
540 ADD_FAILURE() << "Embed() failed"; | 537 ADD_FAILURE() << "Embed() failed"; |
541 return nullptr; | 538 return nullptr; |
542 } | 539 } |
543 scoped_ptr<ViewManagerClientImpl> client = | 540 scoped_ptr<ViewTreeClientImpl> client = |
544 client_factory_->WaitForInstance(); | 541 client_factory_->WaitForInstance(); |
545 if (!client.get()) { | 542 if (!client.get()) { |
546 ADD_FAILURE() << "WaitForInstance failed"; | 543 ADD_FAILURE() << "WaitForInstance failed"; |
547 return nullptr; | 544 return nullptr; |
548 } | 545 } |
549 client->WaitForOnEmbed(); | 546 client->WaitForOnEmbed(); |
550 | 547 |
551 EXPECT_EQ("OnEmbed", | 548 EXPECT_EQ("OnEmbed", |
552 SingleChangeToDescription(*client->tracker()->changes())); | 549 SingleChangeToDescription(*client->tracker()->changes())); |
553 if (connection_id) | 550 if (connection_id) |
554 *connection_id = (*client->tracker()->changes())[0].connection_id; | 551 *connection_id = (*client->tracker()->changes())[0].connection_id; |
555 return client.Pass(); | 552 return client.Pass(); |
556 } | 553 } |
557 | 554 |
558 // ApplicationTestBase: | 555 // ApplicationTestBase: |
559 ApplicationDelegate* GetApplicationDelegate() override { return this; } | 556 ApplicationDelegate* GetApplicationDelegate() override { return this; } |
560 void SetUp() override { | 557 void SetUp() override { |
561 ApplicationTestBase::SetUp(); | 558 ApplicationTestBase::SetUp(); |
562 client_factory_.reset(new ViewManagerClientFactory(application_impl())); | 559 client_factory_.reset(new ViewTreeClientFactory(application_impl())); |
563 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 560 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
564 request->url = mojo::String::From("mojo:view_manager"); | 561 request->url = mojo::String::From("mojo:view_manager"); |
565 scoped_ptr<ApplicationConnection> vm_connection = | 562 scoped_ptr<ApplicationConnection> vm_connection = |
566 application_impl()->ConnectToApplication(request.Pass()); | 563 application_impl()->ConnectToApplication(request.Pass()); |
567 vm_connection->AddService(client_factory_.get()); | 564 vm_connection->AddService(client_factory_.get()); |
568 vm_connection->ConnectToService(&view_manager_root_); | 565 vm_connection->ConnectToService(&view_manager_root_); |
569 vm_client1_ = client_factory_->WaitForInstance(); | 566 vm_client1_ = client_factory_->WaitForInstance(); |
570 ASSERT_TRUE(vm_client1_); | 567 ASSERT_TRUE(vm_client1_); |
571 // Next we should get an embed call on the "window manager" client. | 568 // Next we should get an embed call on the "window manager" client. |
572 vm_client1_->WaitForIncomingMethodCall(); | 569 vm_client1_->WaitForIncomingMethodCall(); |
573 ASSERT_EQ(1u, changes1()->size()); | 570 ASSERT_EQ(1u, changes1()->size()); |
574 EXPECT_EQ(CHANGE_TYPE_EMBED, (*changes1())[0].type); | 571 EXPECT_EQ(CHANGE_TYPE_EMBED, (*changes1())[0].type); |
575 // All these tests assume 1 for the client id. The only real assertion here | 572 // All these tests assume 1 for the client id. The only real assertion here |
576 // is the client id is not zero, but adding this as rest of code here | 573 // is the client id is not zero, but adding this as rest of code here |
577 // assumes 1. | 574 // assumes 1. |
578 ASSERT_GT((*changes1())[0].connection_id, 0); | 575 ASSERT_GT((*changes1())[0].connection_id, 0); |
579 connection_id_1_ = (*changes1())[0].connection_id; | 576 connection_id_1_ = (*changes1())[0].connection_id; |
580 ASSERT_FALSE((*changes1())[0].views.empty()); | 577 ASSERT_FALSE((*changes1())[0].views.empty()); |
581 root_view_id_ = (*changes1())[0].views[0].view_id; | 578 root_view_id_ = (*changes1())[0].views[0].view_id; |
582 vm_client1_->set_root_view(root_view_id_); | 579 vm_client1_->set_root_view(root_view_id_); |
583 changes1()->clear(); | 580 changes1()->clear(); |
584 } | 581 } |
585 | 582 |
586 // ApplicationDelegate implementation. | 583 // ApplicationDelegate implementation. |
587 bool ConfigureIncomingConnection(ApplicationConnection* connection) override { | 584 bool ConfigureIncomingConnection(ApplicationConnection* connection) override { |
588 connection->AddService(client_factory_.get()); | 585 connection->AddService(client_factory_.get()); |
589 return true; | 586 return true; |
590 } | 587 } |
591 | 588 |
592 scoped_ptr<ViewManagerClientImpl> vm_client1_; | 589 scoped_ptr<ViewTreeClientImpl> vm_client1_; |
593 scoped_ptr<ViewManagerClientImpl> vm_client2_; | 590 scoped_ptr<ViewTreeClientImpl> vm_client2_; |
594 scoped_ptr<ViewManagerClientImpl> vm_client3_; | 591 scoped_ptr<ViewTreeClientImpl> vm_client3_; |
595 | 592 |
596 mojo::ViewManagerRootPtr view_manager_root_; | 593 mojo::ViewManagerRootPtr view_manager_root_; |
597 | 594 |
598 private: | 595 private: |
599 scoped_ptr<ViewManagerClientFactory> client_factory_; | 596 scoped_ptr<ViewTreeClientFactory> client_factory_; |
600 int connection_id_1_; | 597 int connection_id_1_; |
601 int connection_id_2_; | 598 int connection_id_2_; |
602 Id root_view_id_; | 599 Id root_view_id_; |
603 | 600 |
604 MOJO_DISALLOW_COPY_AND_ASSIGN(ViewManagerServiceAppTest); | 601 MOJO_DISALLOW_COPY_AND_ASSIGN(ViewTreeAppTest); |
605 }; | 602 }; |
606 | 603 |
607 // Verifies two clients/connections get different ids. | 604 // Verifies two clients/connections get different ids. |
608 TEST_F(ViewManagerServiceAppTest, TwoClientsGetDifferentConnectionIds) { | 605 TEST_F(ViewTreeAppTest, TwoClientsGetDifferentConnectionIds) { |
609 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); | 606 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); |
610 | 607 |
611 ASSERT_EQ(1u, changes2()->size()); | 608 ASSERT_EQ(1u, changes2()->size()); |
612 ASSERT_NE(connection_id_1(), connection_id_2()); | 609 ASSERT_NE(connection_id_1(), connection_id_2()); |
613 } | 610 } |
614 | 611 |
615 // Verifies when Embed() is invoked any child views are removed. | 612 // Verifies when Embed() is invoked any child views are removed. |
616 TEST_F(ViewManagerServiceAppTest, ViewsRemovedWhenEmbedding) { | 613 TEST_F(ViewTreeAppTest, ViewsRemovedWhenEmbedding) { |
617 // Two views 1 and 2. 2 is parented to 1. | 614 // Two views 1 and 2. 2 is parented to 1. |
618 Id view_1_1 = vm_client1()->CreateView(1); | 615 Id view_1_1 = vm_client1()->CreateView(1); |
619 ASSERT_TRUE(view_1_1); | 616 ASSERT_TRUE(view_1_1); |
620 ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); | 617 ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); |
621 | 618 |
622 Id view_1_2 = vm_client1()->CreateView(2); | 619 Id view_1_2 = vm_client1()->CreateView(2); |
623 ASSERT_TRUE(view_1_2); | 620 ASSERT_TRUE(view_1_2); |
624 ASSERT_TRUE(AddView(vm1(), view_1_1, view_1_2)); | 621 ASSERT_TRUE(AddView(vm1(), view_1_1, view_1_2)); |
625 | 622 |
626 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(false)); | 623 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(false)); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 { | 674 { |
678 std::vector<TestView> views; | 675 std::vector<TestView> views; |
679 GetViewTree(vm3(), view_2_3, &views); | 676 GetViewTree(vm3(), view_2_3, &views); |
680 EXPECT_EQ(ViewParentToString(view_2_3, kNullParentId), | 677 EXPECT_EQ(ViewParentToString(view_2_3, kNullParentId), |
681 SingleViewDescription(views)); | 678 SingleViewDescription(views)); |
682 } | 679 } |
683 } | 680 } |
684 | 681 |
685 // Verifies once Embed() has been invoked the parent connection can't see any | 682 // Verifies once Embed() has been invoked the parent connection can't see any |
686 // children. | 683 // children. |
687 TEST_F(ViewManagerServiceAppTest, CantAccessChildrenOfEmbeddedView) { | 684 TEST_F(ViewTreeAppTest, CantAccessChildrenOfEmbeddedView) { |
688 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); | 685 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); |
689 | 686 |
690 Id view_1_1 = BuildViewId(connection_id_1(), 1); | 687 Id view_1_1 = BuildViewId(connection_id_1(), 1); |
691 Id view_2_2 = vm_client2()->CreateView(2); | 688 Id view_2_2 = vm_client2()->CreateView(2); |
692 ASSERT_TRUE(view_2_2); | 689 ASSERT_TRUE(view_2_2); |
693 ASSERT_TRUE(AddView(vm2(), view_1_1, view_2_2)); | 690 ASSERT_TRUE(AddView(vm2(), view_1_1, view_2_2)); |
694 | 691 |
695 ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(vm2(), view_2_2)); | 692 ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(vm2(), view_2_2)); |
696 | 693 |
697 Id view_3_3 = vm_client3()->CreateView(3); | 694 Id view_3_3 = vm_client3()->CreateView(3); |
(...skipping 21 matching lines...) Expand all Loading... |
719 std::vector<TestView> views; | 716 std::vector<TestView> views; |
720 GetViewTree(vm1(), view_1_1, &views); | 717 GetViewTree(vm1(), view_1_1, &views); |
721 ASSERT_EQ(3u, views.size()); | 718 ASSERT_EQ(3u, views.size()); |
722 EXPECT_EQ(ViewParentToString(view_1_1, kNullParentId), views[0].ToString()); | 719 EXPECT_EQ(ViewParentToString(view_1_1, kNullParentId), views[0].ToString()); |
723 EXPECT_EQ(ViewParentToString(view_2_2, view_1_1), views[1].ToString()); | 720 EXPECT_EQ(ViewParentToString(view_2_2, view_1_1), views[1].ToString()); |
724 EXPECT_EQ(ViewParentToString(view_3_3, view_2_2), views[2].ToString()); | 721 EXPECT_EQ(ViewParentToString(view_3_3, view_2_2), views[2].ToString()); |
725 } | 722 } |
726 } | 723 } |
727 | 724 |
728 // Verifies once Embed() has been invoked the parent can't mutate the children. | 725 // Verifies once Embed() has been invoked the parent can't mutate the children. |
729 TEST_F(ViewManagerServiceAppTest, CantModifyChildrenOfEmbeddedView) { | 726 TEST_F(ViewTreeAppTest, CantModifyChildrenOfEmbeddedView) { |
730 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); | 727 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); |
731 | 728 |
732 Id view_1_1 = BuildViewId(connection_id_1(), 1); | 729 Id view_1_1 = BuildViewId(connection_id_1(), 1); |
733 Id view_2_2 = vm_client2()->CreateView(2); | 730 Id view_2_2 = vm_client2()->CreateView(2); |
734 ASSERT_TRUE(view_2_2); | 731 ASSERT_TRUE(view_2_2); |
735 ASSERT_TRUE(AddView(vm2(), view_1_1, view_2_2)); | 732 ASSERT_TRUE(AddView(vm2(), view_1_1, view_2_2)); |
736 | 733 |
737 ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(vm2(), view_2_2)); | 734 ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(vm2(), view_2_2)); |
738 | 735 |
739 Id view_2_3 = vm_client2()->CreateView(3); | 736 Id view_2_3 = vm_client2()->CreateView(3); |
740 ASSERT_TRUE(view_2_3); | 737 ASSERT_TRUE(view_2_3); |
741 // Connection 2 shouldn't be able to add anything to the view anymore. | 738 // Connection 2 shouldn't be able to add anything to the view anymore. |
742 ASSERT_FALSE(AddView(vm2(), view_2_2, view_2_3)); | 739 ASSERT_FALSE(AddView(vm2(), view_2_2, view_2_3)); |
743 | 740 |
744 // Create view 3 in connection 3 and add it to view 3. | 741 // Create view 3 in connection 3 and add it to view 3. |
745 Id view_3_3 = vm_client3()->CreateView(3); | 742 Id view_3_3 = vm_client3()->CreateView(3); |
746 ASSERT_TRUE(view_3_3); | 743 ASSERT_TRUE(view_3_3); |
747 ASSERT_TRUE(AddView(vm3(), view_2_2, view_3_3)); | 744 ASSERT_TRUE(AddView(vm3(), view_2_2, view_3_3)); |
748 | 745 |
749 // Connection 2 shouldn't be able to remove view 3. | 746 // Connection 2 shouldn't be able to remove view 3. |
750 ASSERT_FALSE(RemoveViewFromParent(vm2(), view_3_3)); | 747 ASSERT_FALSE(RemoveViewFromParent(vm2(), view_3_3)); |
751 } | 748 } |
752 | 749 |
753 // Verifies client gets a valid id. | 750 // Verifies client gets a valid id. |
754 TEST_F(ViewManagerServiceAppTest, CreateView) { | 751 TEST_F(ViewTreeAppTest, CreateView) { |
755 Id view_1_1 = vm_client1()->CreateView(1); | 752 Id view_1_1 = vm_client1()->CreateView(1); |
756 ASSERT_TRUE(view_1_1); | 753 ASSERT_TRUE(view_1_1); |
757 EXPECT_TRUE(changes1()->empty()); | 754 EXPECT_TRUE(changes1()->empty()); |
758 | 755 |
759 // Can't create a view with the same id. | 756 // Can't create a view with the same id. |
760 ASSERT_EQ(mojo::ERROR_CODE_VALUE_IN_USE, | 757 ASSERT_EQ(mojo::ERROR_CODE_VALUE_IN_USE, |
761 CreateViewWithErrorCode(vm1(), view_1_1)); | 758 CreateViewWithErrorCode(vm1(), view_1_1)); |
762 EXPECT_TRUE(changes1()->empty()); | 759 EXPECT_TRUE(changes1()->empty()); |
763 | 760 |
764 // Can't create a view with a bogus connection id. | 761 // Can't create a view with a bogus connection id. |
765 EXPECT_EQ( | 762 EXPECT_EQ( |
766 mojo::ERROR_CODE_ILLEGAL_ARGUMENT, | 763 mojo::ERROR_CODE_ILLEGAL_ARGUMENT, |
767 CreateViewWithErrorCode(vm1(), BuildViewId(connection_id_1() + 1, 1))); | 764 CreateViewWithErrorCode(vm1(), BuildViewId(connection_id_1() + 1, 1))); |
768 EXPECT_TRUE(changes1()->empty()); | 765 EXPECT_TRUE(changes1()->empty()); |
769 } | 766 } |
770 | 767 |
771 // Verifies AddView fails when view is already in position. | 768 // Verifies AddView fails when view is already in position. |
772 TEST_F(ViewManagerServiceAppTest, AddViewWithNoChange) { | 769 TEST_F(ViewTreeAppTest, AddViewWithNoChange) { |
773 Id view_1_2 = vm_client1()->CreateView(2); | 770 Id view_1_2 = vm_client1()->CreateView(2); |
774 Id view_1_3 = vm_client1()->CreateView(3); | 771 Id view_1_3 = vm_client1()->CreateView(3); |
775 ASSERT_TRUE(view_1_2); | 772 ASSERT_TRUE(view_1_2); |
776 ASSERT_TRUE(view_1_3); | 773 ASSERT_TRUE(view_1_3); |
777 | 774 |
778 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); | 775 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); |
779 | 776 |
780 // Make 3 a child of 2. | 777 // Make 3 a child of 2. |
781 ASSERT_TRUE(AddView(vm1(), view_1_2, view_1_3)); | 778 ASSERT_TRUE(AddView(vm1(), view_1_2, view_1_3)); |
782 | 779 |
783 // Try again, this should fail. | 780 // Try again, this should fail. |
784 EXPECT_FALSE(AddView(vm1(), view_1_2, view_1_3)); | 781 EXPECT_FALSE(AddView(vm1(), view_1_2, view_1_3)); |
785 } | 782 } |
786 | 783 |
787 // Verifies AddView fails when view is already in position. | 784 // Verifies AddView fails when view is already in position. |
788 TEST_F(ViewManagerServiceAppTest, AddAncestorFails) { | 785 TEST_F(ViewTreeAppTest, AddAncestorFails) { |
789 Id view_1_2 = vm_client1()->CreateView(2); | 786 Id view_1_2 = vm_client1()->CreateView(2); |
790 Id view_1_3 = vm_client1()->CreateView(3); | 787 Id view_1_3 = vm_client1()->CreateView(3); |
791 ASSERT_TRUE(view_1_2); | 788 ASSERT_TRUE(view_1_2); |
792 ASSERT_TRUE(view_1_3); | 789 ASSERT_TRUE(view_1_3); |
793 | 790 |
794 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); | 791 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); |
795 | 792 |
796 // Make 3 a child of 2. | 793 // Make 3 a child of 2. |
797 ASSERT_TRUE(AddView(vm1(), view_1_2, view_1_3)); | 794 ASSERT_TRUE(AddView(vm1(), view_1_2, view_1_3)); |
798 | 795 |
799 // Try to make 2 a child of 3, this should fail since 2 is an ancestor of 3. | 796 // Try to make 2 a child of 3, this should fail since 2 is an ancestor of 3. |
800 EXPECT_FALSE(AddView(vm1(), view_1_3, view_1_2)); | 797 EXPECT_FALSE(AddView(vm1(), view_1_3, view_1_2)); |
801 } | 798 } |
802 | 799 |
803 // Verifies adding to root sends right notifications. | 800 // Verifies adding to root sends right notifications. |
804 TEST_F(ViewManagerServiceAppTest, AddToRoot) { | 801 TEST_F(ViewTreeAppTest, AddToRoot) { |
805 Id view_1_21 = vm_client1()->CreateView(21); | 802 Id view_1_21 = vm_client1()->CreateView(21); |
806 Id view_1_3 = vm_client1()->CreateView(3); | 803 Id view_1_3 = vm_client1()->CreateView(3); |
807 ASSERT_TRUE(view_1_21); | 804 ASSERT_TRUE(view_1_21); |
808 ASSERT_TRUE(view_1_3); | 805 ASSERT_TRUE(view_1_3); |
809 | 806 |
810 Id view_1_1 = BuildViewId(connection_id_1(), 1); | 807 Id view_1_1 = BuildViewId(connection_id_1(), 1); |
811 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); | 808 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); |
812 changes2()->clear(); | 809 changes2()->clear(); |
813 | 810 |
814 // Make 3 a child of 21. | 811 // Make 3 a child of 21. |
815 ASSERT_TRUE(AddView(vm1(), view_1_21, view_1_3)); | 812 ASSERT_TRUE(AddView(vm1(), view_1_21, view_1_3)); |
816 | 813 |
817 // Make 21 a child of 1. | 814 // Make 21 a child of 1. |
818 ASSERT_TRUE(AddView(vm1(), view_1_1, view_1_21)); | 815 ASSERT_TRUE(AddView(vm1(), view_1_1, view_1_21)); |
819 | 816 |
820 // Connection 2 should not be told anything (because the view is from a | 817 // Connection 2 should not be told anything (because the view is from a |
821 // different connection). Create a view to ensure we got a response from | 818 // different connection). Create a view to ensure we got a response from |
822 // the server. | 819 // the server. |
823 ASSERT_TRUE(vm_client2()->CreateView(100)); | 820 ASSERT_TRUE(vm_client2()->CreateView(100)); |
824 EXPECT_TRUE(changes2()->empty()); | 821 EXPECT_TRUE(changes2()->empty()); |
825 } | 822 } |
826 | 823 |
827 // Verifies HierarchyChanged is correctly sent for various adds/removes. | 824 // Verifies HierarchyChanged is correctly sent for various adds/removes. |
828 TEST_F(ViewManagerServiceAppTest, ViewHierarchyChangedViews) { | 825 TEST_F(ViewTreeAppTest, ViewHierarchyChangedViews) { |
829 // 1,2->1,11. | 826 // 1,2->1,11. |
830 Id view_1_2 = vm_client1()->CreateView(2); | 827 Id view_1_2 = vm_client1()->CreateView(2); |
831 ASSERT_TRUE(view_1_2); | 828 ASSERT_TRUE(view_1_2); |
832 ASSERT_TRUE(SetViewVisibility(vm1(), view_1_2, true)); | 829 ASSERT_TRUE(SetViewVisibility(vm1(), view_1_2, true)); |
833 Id view_1_11 = vm_client1()->CreateView(11); | 830 Id view_1_11 = vm_client1()->CreateView(11); |
834 ASSERT_TRUE(view_1_11); | 831 ASSERT_TRUE(view_1_11); |
835 ASSERT_TRUE(SetViewVisibility(vm1(), view_1_11, true)); | 832 ASSERT_TRUE(SetViewVisibility(vm1(), view_1_11, true)); |
836 ASSERT_TRUE(AddView(vm1(), view_1_2, view_1_11)); | 833 ASSERT_TRUE(AddView(vm1(), view_1_2, view_1_11)); |
837 | 834 |
838 Id view_1_1 = BuildViewId(connection_id_1(), 1); | 835 Id view_1_1 = BuildViewId(connection_id_1(), 1); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 // 0,1->1,1->1,2->1,11->1,111 | 882 // 0,1->1,1->1,2->1,11->1,111 |
886 { | 883 { |
887 changes2()->clear(); | 884 changes2()->clear(); |
888 ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); | 885 ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); |
889 vm_client2_->WaitForChangeCount(1); | 886 vm_client2_->WaitForChangeCount(1); |
890 EXPECT_EQ("DrawnStateChanged view=" + IdToString(view_1_1) + " drawn=true", | 887 EXPECT_EQ("DrawnStateChanged view=" + IdToString(view_1_1) + " drawn=true", |
891 SingleChangeToDescription(*changes2())); | 888 SingleChangeToDescription(*changes2())); |
892 } | 889 } |
893 } | 890 } |
894 | 891 |
895 TEST_F(ViewManagerServiceAppTest, ViewHierarchyChangedAddingKnownToUnknown) { | 892 TEST_F(ViewTreeAppTest, ViewHierarchyChangedAddingKnownToUnknown) { |
896 // Create the following structure: root -> 1 -> 11 and 2->21 (2 has no | 893 // Create the following structure: root -> 1 -> 11 and 2->21 (2 has no |
897 // parent). | 894 // parent). |
898 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); | 895 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); |
899 Id view_1_1 = BuildViewId(connection_id_1(), 1); | 896 Id view_1_1 = BuildViewId(connection_id_1(), 1); |
900 | 897 |
901 Id view_2_11 = vm_client2()->CreateView(11); | 898 Id view_2_11 = vm_client2()->CreateView(11); |
902 Id view_2_2 = vm_client2()->CreateView(2); | 899 Id view_2_2 = vm_client2()->CreateView(2); |
903 Id view_2_21 = vm_client2()->CreateView(21); | 900 Id view_2_21 = vm_client2()->CreateView(21); |
904 ASSERT_TRUE(view_2_11); | 901 ASSERT_TRUE(view_2_11); |
905 ASSERT_TRUE(view_2_2); | 902 ASSERT_TRUE(view_2_2); |
(...skipping 22 matching lines...) Expand all Loading... |
928 vm_client1_->WaitForChangeCount(1); | 925 vm_client1_->WaitForChangeCount(1); |
929 EXPECT_EQ("HierarchyChanged view=" + IdToString(view_2_2) + " new_parent=" + | 926 EXPECT_EQ("HierarchyChanged view=" + IdToString(view_2_2) + " new_parent=" + |
930 IdToString(view_1_1) + " old_parent=null", | 927 IdToString(view_1_1) + " old_parent=null", |
931 SingleChangeToDescription(*changes1())); | 928 SingleChangeToDescription(*changes1())); |
932 EXPECT_EQ("[" + ViewParentToString(view_2_2, view_1_1) + "],[" + | 929 EXPECT_EQ("[" + ViewParentToString(view_2_2, view_1_1) + "],[" + |
933 ViewParentToString(view_2_21, view_2_2) + "]", | 930 ViewParentToString(view_2_21, view_2_2) + "]", |
934 ChangeViewDescription(*changes1())); | 931 ChangeViewDescription(*changes1())); |
935 } | 932 } |
936 } | 933 } |
937 | 934 |
938 TEST_F(ViewManagerServiceAppTest, ReorderView) { | 935 TEST_F(ViewTreeAppTest, ReorderView) { |
939 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); | 936 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); |
940 | 937 |
941 Id view_2_1 = vm_client2()->CreateView(1); | 938 Id view_2_1 = vm_client2()->CreateView(1); |
942 Id view_2_2 = vm_client2()->CreateView(2); | 939 Id view_2_2 = vm_client2()->CreateView(2); |
943 Id view_2_3 = vm_client2()->CreateView(3); | 940 Id view_2_3 = vm_client2()->CreateView(3); |
944 Id view_1_4 = vm_client1()->CreateView(4); // Peer to 1,1 | 941 Id view_1_4 = vm_client1()->CreateView(4); // Peer to 1,1 |
945 Id view_1_5 = vm_client1()->CreateView(5); // Peer to 1,1 | 942 Id view_1_5 = vm_client1()->CreateView(5); // Peer to 1,1 |
946 Id view_2_6 = vm_client2()->CreateView(6); // Child of 1,2. | 943 Id view_2_6 = vm_client2()->CreateView(6); // Child of 1,2. |
947 Id view_2_7 = vm_client2()->CreateView(7); // Unparented. | 944 Id view_2_7 = vm_client2()->CreateView(7); // Unparented. |
948 Id view_2_8 = vm_client2()->CreateView(8); // Unparented. | 945 Id view_2_8 = vm_client2()->CreateView(8); // Unparented. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
994 // Non-existent view-ids | 991 // Non-existent view-ids |
995 EXPECT_FALSE(ReorderView(vm1(), BuildViewId(connection_id_1(), 27), | 992 EXPECT_FALSE(ReorderView(vm1(), BuildViewId(connection_id_1(), 27), |
996 BuildViewId(connection_id_1(), 28), | 993 BuildViewId(connection_id_1(), 28), |
997 ORDER_DIRECTION_ABOVE)); | 994 ORDER_DIRECTION_ABOVE)); |
998 | 995 |
999 // view7 & view8 are un-parented. | 996 // view7 & view8 are un-parented. |
1000 EXPECT_FALSE(ReorderView(vm1(), view_2_7, view_2_8, ORDER_DIRECTION_ABOVE)); | 997 EXPECT_FALSE(ReorderView(vm1(), view_2_7, view_2_8, ORDER_DIRECTION_ABOVE)); |
1001 } | 998 } |
1002 | 999 |
1003 // Verifies DeleteView works. | 1000 // Verifies DeleteView works. |
1004 TEST_F(ViewManagerServiceAppTest, DeleteView) { | 1001 TEST_F(ViewTreeAppTest, DeleteView) { |
1005 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); | 1002 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); |
1006 Id view_1_1 = BuildViewId(connection_id_1(), 1); | 1003 Id view_1_1 = BuildViewId(connection_id_1(), 1); |
1007 Id view_2_2 = vm_client2()->CreateView(2); | 1004 Id view_2_2 = vm_client2()->CreateView(2); |
1008 ASSERT_TRUE(view_2_2); | 1005 ASSERT_TRUE(view_2_2); |
1009 | 1006 |
1010 // Make 2 a child of 1. | 1007 // Make 2 a child of 1. |
1011 { | 1008 { |
1012 changes1()->clear(); | 1009 changes1()->clear(); |
1013 ASSERT_TRUE(AddView(vm2(), view_1_1, view_2_2)); | 1010 ASSERT_TRUE(AddView(vm2(), view_1_1, view_2_2)); |
1014 vm_client1_->WaitForChangeCount(1); | 1011 vm_client1_->WaitForChangeCount(1); |
1015 EXPECT_EQ("HierarchyChanged view=" + IdToString(view_2_2) + " new_parent=" + | 1012 EXPECT_EQ("HierarchyChanged view=" + IdToString(view_2_2) + " new_parent=" + |
1016 IdToString(view_1_1) + " old_parent=null", | 1013 IdToString(view_1_1) + " old_parent=null", |
1017 SingleChangeToDescription(*changes1())); | 1014 SingleChangeToDescription(*changes1())); |
1018 } | 1015 } |
1019 | 1016 |
1020 // Delete 2. | 1017 // Delete 2. |
1021 { | 1018 { |
1022 changes1()->clear(); | 1019 changes1()->clear(); |
1023 changes2()->clear(); | 1020 changes2()->clear(); |
1024 ASSERT_TRUE(DeleteView(vm2(), view_2_2)); | 1021 ASSERT_TRUE(DeleteView(vm2(), view_2_2)); |
1025 EXPECT_TRUE(changes2()->empty()); | 1022 EXPECT_TRUE(changes2()->empty()); |
1026 | 1023 |
1027 vm_client1_->WaitForChangeCount(1); | 1024 vm_client1_->WaitForChangeCount(1); |
1028 EXPECT_EQ("ViewDeleted view=" + IdToString(view_2_2), | 1025 EXPECT_EQ("ViewDeleted view=" + IdToString(view_2_2), |
1029 SingleChangeToDescription(*changes1())); | 1026 SingleChangeToDescription(*changes1())); |
1030 } | 1027 } |
1031 } | 1028 } |
1032 | 1029 |
1033 // Verifies DeleteView isn't allowed from a separate connection. | 1030 // Verifies DeleteView isn't allowed from a separate connection. |
1034 TEST_F(ViewManagerServiceAppTest, DeleteViewFromAnotherConnectionDisallowed) { | 1031 TEST_F(ViewTreeAppTest, DeleteViewFromAnotherConnectionDisallowed) { |
1035 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); | 1032 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); |
1036 EXPECT_FALSE(DeleteView(vm2(), BuildViewId(connection_id_1(), 1))); | 1033 EXPECT_FALSE(DeleteView(vm2(), BuildViewId(connection_id_1(), 1))); |
1037 } | 1034 } |
1038 | 1035 |
1039 // Verifies if a view was deleted and then reused that other clients are | 1036 // Verifies if a view was deleted and then reused that other clients are |
1040 // properly notified. | 1037 // properly notified. |
1041 TEST_F(ViewManagerServiceAppTest, ReuseDeletedViewId) { | 1038 TEST_F(ViewTreeAppTest, ReuseDeletedViewId) { |
1042 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); | 1039 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); |
1043 Id view_1_1 = BuildViewId(connection_id_1(), 1); | 1040 Id view_1_1 = BuildViewId(connection_id_1(), 1); |
1044 Id view_2_2 = vm_client2()->CreateView(2); | 1041 Id view_2_2 = vm_client2()->CreateView(2); |
1045 ASSERT_TRUE(view_2_2); | 1042 ASSERT_TRUE(view_2_2); |
1046 | 1043 |
1047 // Add 2 to 1. | 1044 // Add 2 to 1. |
1048 { | 1045 { |
1049 changes1()->clear(); | 1046 changes1()->clear(); |
1050 ASSERT_TRUE(AddView(vm2(), view_1_1, view_2_2)); | 1047 ASSERT_TRUE(AddView(vm2(), view_1_1, view_2_2)); |
1051 vm_client1_->WaitForChangeCount(1); | 1048 vm_client1_->WaitForChangeCount(1); |
(...skipping 24 matching lines...) Expand all Loading... |
1076 vm_client1_->WaitForChangeCount(1); | 1073 vm_client1_->WaitForChangeCount(1); |
1077 EXPECT_EQ("HierarchyChanged view=" + IdToString(view_2_2) + " new_parent=" + | 1074 EXPECT_EQ("HierarchyChanged view=" + IdToString(view_2_2) + " new_parent=" + |
1078 IdToString(view_1_1) + " old_parent=null", | 1075 IdToString(view_1_1) + " old_parent=null", |
1079 SingleChangeToDescription(*changes1())); | 1076 SingleChangeToDescription(*changes1())); |
1080 EXPECT_EQ("[" + ViewParentToString(view_2_2, view_1_1) + "]", | 1077 EXPECT_EQ("[" + ViewParentToString(view_2_2, view_1_1) + "]", |
1081 ChangeViewDescription(*changes1())); | 1078 ChangeViewDescription(*changes1())); |
1082 } | 1079 } |
1083 } | 1080 } |
1084 | 1081 |
1085 // Assertions for GetViewTree. | 1082 // Assertions for GetViewTree. |
1086 TEST_F(ViewManagerServiceAppTest, GetViewTree) { | 1083 TEST_F(ViewTreeAppTest, GetViewTree) { |
1087 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); | 1084 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); |
1088 Id view_1_1 = BuildViewId(connection_id_1(), 1); | 1085 Id view_1_1 = BuildViewId(connection_id_1(), 1); |
1089 | 1086 |
1090 // Create 11 in first connection and make it a child of 1. | 1087 // Create 11 in first connection and make it a child of 1. |
1091 Id view_1_11 = vm_client1()->CreateView(11); | 1088 Id view_1_11 = vm_client1()->CreateView(11); |
1092 ASSERT_TRUE(view_1_11); | 1089 ASSERT_TRUE(view_1_11); |
1093 ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); | 1090 ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); |
1094 ASSERT_TRUE(AddView(vm1(), view_1_1, view_1_11)); | 1091 ASSERT_TRUE(AddView(vm1(), view_1_1, view_1_11)); |
1095 | 1092 |
1096 // Create two views in second connection, 2 and 3, both children of 1. | 1093 // Create two views in second connection, 2 and 3, both children of 1. |
(...skipping 30 matching lines...) Expand all Loading... |
1127 } | 1124 } |
1128 | 1125 |
1129 // Connection 2 shouldn't be able to get the root tree. | 1126 // Connection 2 shouldn't be able to get the root tree. |
1130 { | 1127 { |
1131 std::vector<TestView> views; | 1128 std::vector<TestView> views; |
1132 GetViewTree(vm2(), root_view_id(), &views); | 1129 GetViewTree(vm2(), root_view_id(), &views); |
1133 ASSERT_EQ(0u, views.size()); | 1130 ASSERT_EQ(0u, views.size()); |
1134 } | 1131 } |
1135 } | 1132 } |
1136 | 1133 |
1137 TEST_F(ViewManagerServiceAppTest, SetViewBounds) { | 1134 TEST_F(ViewTreeAppTest, SetViewBounds) { |
1138 Id view_1_1 = vm_client1()->CreateView(1); | 1135 Id view_1_1 = vm_client1()->CreateView(1); |
1139 ASSERT_TRUE(view_1_1); | 1136 ASSERT_TRUE(view_1_1); |
1140 ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); | 1137 ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); |
1141 | 1138 |
1142 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(false)); | 1139 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(false)); |
1143 | 1140 |
1144 changes2()->clear(); | 1141 changes2()->clear(); |
1145 ASSERT_TRUE(SetViewBounds(vm1(), view_1_1, 0, 0, 100, 100)); | 1142 ASSERT_TRUE(SetViewBounds(vm1(), view_1_1, 0, 0, 100, 100)); |
1146 | 1143 |
1147 vm_client2_->WaitForChangeCount(1); | 1144 vm_client2_->WaitForChangeCount(1); |
1148 EXPECT_EQ("BoundsChanged view=" + IdToString(view_1_1) + | 1145 EXPECT_EQ("BoundsChanged view=" + IdToString(view_1_1) + |
1149 " old_bounds=0,0 0x0 new_bounds=0,0 100x100", | 1146 " old_bounds=0,0 0x0 new_bounds=0,0 100x100", |
1150 SingleChangeToDescription(*changes2())); | 1147 SingleChangeToDescription(*changes2())); |
1151 | 1148 |
1152 // Should not be possible to change the bounds of a view created by another | 1149 // Should not be possible to change the bounds of a view created by another |
1153 // connection. | 1150 // connection. |
1154 ASSERT_FALSE(SetViewBounds(vm2(), view_1_1, 0, 0, 0, 0)); | 1151 ASSERT_FALSE(SetViewBounds(vm2(), view_1_1, 0, 0, 0, 0)); |
1155 } | 1152 } |
1156 | 1153 |
1157 // Verify AddView fails when trying to manipulate views in other roots. | 1154 // Verify AddView fails when trying to manipulate views in other roots. |
1158 TEST_F(ViewManagerServiceAppTest, CantMoveViewsFromOtherRoot) { | 1155 TEST_F(ViewTreeAppTest, CantMoveViewsFromOtherRoot) { |
1159 // Create 1 and 2 in the first connection. | 1156 // Create 1 and 2 in the first connection. |
1160 Id view_1_1 = vm_client1()->CreateView(1); | 1157 Id view_1_1 = vm_client1()->CreateView(1); |
1161 Id view_1_2 = vm_client1()->CreateView(2); | 1158 Id view_1_2 = vm_client1()->CreateView(2); |
1162 ASSERT_TRUE(view_1_1); | 1159 ASSERT_TRUE(view_1_1); |
1163 ASSERT_TRUE(view_1_2); | 1160 ASSERT_TRUE(view_1_2); |
1164 | 1161 |
1165 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(false)); | 1162 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(false)); |
1166 | 1163 |
1167 // Try to move 2 to be a child of 1 from connection 2. This should fail as 2 | 1164 // Try to move 2 to be a child of 1 from connection 2. This should fail as 2 |
1168 // should not be able to access 1. | 1165 // should not be able to access 1. |
1169 ASSERT_FALSE(AddView(vm2(), view_1_1, view_1_2)); | 1166 ASSERT_FALSE(AddView(vm2(), view_1_1, view_1_2)); |
1170 | 1167 |
1171 // Try to reparent 1 to the root. A connection is not allowed to reparent its | 1168 // Try to reparent 1 to the root. A connection is not allowed to reparent its |
1172 // roots. | 1169 // roots. |
1173 ASSERT_FALSE(AddView(vm2(), root_view_id(), view_1_1)); | 1170 ASSERT_FALSE(AddView(vm2(), root_view_id(), view_1_1)); |
1174 } | 1171 } |
1175 | 1172 |
1176 // Verify RemoveViewFromParent fails for views that are descendants of the | 1173 // Verify RemoveViewFromParent fails for views that are descendants of the |
1177 // roots. | 1174 // roots. |
1178 TEST_F(ViewManagerServiceAppTest, CantRemoveViewsInOtherRoots) { | 1175 TEST_F(ViewTreeAppTest, CantRemoveViewsInOtherRoots) { |
1179 // Create 1 and 2 in the first connection and parent both to the root. | 1176 // Create 1 and 2 in the first connection and parent both to the root. |
1180 Id view_1_1 = vm_client1()->CreateView(1); | 1177 Id view_1_1 = vm_client1()->CreateView(1); |
1181 Id view_1_2 = vm_client1()->CreateView(2); | 1178 Id view_1_2 = vm_client1()->CreateView(2); |
1182 ASSERT_TRUE(view_1_1); | 1179 ASSERT_TRUE(view_1_1); |
1183 ASSERT_TRUE(view_1_2); | 1180 ASSERT_TRUE(view_1_2); |
1184 | 1181 |
1185 ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); | 1182 ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); |
1186 ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_2)); | 1183 ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_2)); |
1187 | 1184 |
1188 // Establish the second connection and give it the root 1. | 1185 // Establish the second connection and give it the root 1. |
(...skipping 22 matching lines...) Expand all Loading... |
1211 EXPECT_EQ(ViewParentToString(root_view_id(), kNullParentId), | 1208 EXPECT_EQ(ViewParentToString(root_view_id(), kNullParentId), |
1212 views[0].ToString()); | 1209 views[0].ToString()); |
1213 EXPECT_EQ(ViewParentToString(view_1_1, root_view_id()), | 1210 EXPECT_EQ(ViewParentToString(view_1_1, root_view_id()), |
1214 views[1].ToString()); | 1211 views[1].ToString()); |
1215 EXPECT_EQ(ViewParentToString(view_1_2, root_view_id()), | 1212 EXPECT_EQ(ViewParentToString(view_1_2, root_view_id()), |
1216 views[2].ToString()); | 1213 views[2].ToString()); |
1217 } | 1214 } |
1218 } | 1215 } |
1219 | 1216 |
1220 // Verify GetViewTree fails for views that are not descendants of the roots. | 1217 // Verify GetViewTree fails for views that are not descendants of the roots. |
1221 TEST_F(ViewManagerServiceAppTest, CantGetViewTreeOfOtherRoots) { | 1218 TEST_F(ViewTreeAppTest, CantGetViewTreeOfOtherRoots) { |
1222 // Create 1 and 2 in the first connection and parent both to the root. | 1219 // Create 1 and 2 in the first connection and parent both to the root. |
1223 Id view_1_1 = vm_client1()->CreateView(1); | 1220 Id view_1_1 = vm_client1()->CreateView(1); |
1224 Id view_1_2 = vm_client1()->CreateView(2); | 1221 Id view_1_2 = vm_client1()->CreateView(2); |
1225 ASSERT_TRUE(view_1_1); | 1222 ASSERT_TRUE(view_1_1); |
1226 ASSERT_TRUE(view_1_2); | 1223 ASSERT_TRUE(view_1_2); |
1227 | 1224 |
1228 ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); | 1225 ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); |
1229 ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_2)); | 1226 ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_2)); |
1230 | 1227 |
1231 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(false)); | 1228 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(false)); |
1232 | 1229 |
1233 std::vector<TestView> views; | 1230 std::vector<TestView> views; |
1234 | 1231 |
1235 // Should get nothing for the root. | 1232 // Should get nothing for the root. |
1236 GetViewTree(vm2(), root_view_id(), &views); | 1233 GetViewTree(vm2(), root_view_id(), &views); |
1237 ASSERT_TRUE(views.empty()); | 1234 ASSERT_TRUE(views.empty()); |
1238 | 1235 |
1239 // Should get nothing for view 2. | 1236 // Should get nothing for view 2. |
1240 GetViewTree(vm2(), view_1_2, &views); | 1237 GetViewTree(vm2(), view_1_2, &views); |
1241 ASSERT_TRUE(views.empty()); | 1238 ASSERT_TRUE(views.empty()); |
1242 | 1239 |
1243 // Should get view 1 if asked for. | 1240 // Should get view 1 if asked for. |
1244 GetViewTree(vm2(), view_1_1, &views); | 1241 GetViewTree(vm2(), view_1_1, &views); |
1245 ASSERT_EQ(1u, views.size()); | 1242 ASSERT_EQ(1u, views.size()); |
1246 EXPECT_EQ(ViewParentToString(view_1_1, kNullParentId), views[0].ToString()); | 1243 EXPECT_EQ(ViewParentToString(view_1_1, kNullParentId), views[0].ToString()); |
1247 } | 1244 } |
1248 | 1245 |
1249 TEST_F(ViewManagerServiceAppTest, EmbedWithSameViewId) { | 1246 TEST_F(ViewTreeAppTest, EmbedWithSameViewId) { |
1250 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); | 1247 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); |
1251 changes2()->clear(); | 1248 changes2()->clear(); |
1252 | 1249 |
1253 Id view_1_1 = BuildViewId(connection_id_1(), 1); | 1250 Id view_1_1 = BuildViewId(connection_id_1(), 1); |
1254 ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(vm1(), view_1_1)); | 1251 ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(vm1(), view_1_1)); |
1255 | 1252 |
1256 // Connection2 should have been told of the unembed and delete. | 1253 // Connection2 should have been told of the unembed and delete. |
1257 { | 1254 { |
1258 vm_client2_->WaitForChangeCount(2); | 1255 vm_client2_->WaitForChangeCount(2); |
1259 EXPECT_EQ("OnUnembed", ChangesToDescription1(*changes2())[0]); | 1256 EXPECT_EQ("OnUnembed", ChangesToDescription1(*changes2())[0]); |
1260 EXPECT_EQ("ViewDeleted view=" + IdToString(view_1_1), | 1257 EXPECT_EQ("ViewDeleted view=" + IdToString(view_1_1), |
1261 ChangesToDescription1(*changes2())[1]); | 1258 ChangesToDescription1(*changes2())[1]); |
1262 } | 1259 } |
1263 | 1260 |
1264 // Connection2 has no root. Verify it can't see view 1,1 anymore. | 1261 // Connection2 has no root. Verify it can't see view 1,1 anymore. |
1265 { | 1262 { |
1266 std::vector<TestView> views; | 1263 std::vector<TestView> views; |
1267 GetViewTree(vm2(), view_1_1, &views); | 1264 GetViewTree(vm2(), view_1_1, &views); |
1268 EXPECT_TRUE(views.empty()); | 1265 EXPECT_TRUE(views.empty()); |
1269 } | 1266 } |
1270 } | 1267 } |
1271 | 1268 |
1272 TEST_F(ViewManagerServiceAppTest, EmbedWithSameViewId2) { | 1269 TEST_F(ViewTreeAppTest, EmbedWithSameViewId2) { |
1273 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); | 1270 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); |
1274 Id view_1_1 = BuildViewId(connection_id_1(), 1); | 1271 Id view_1_1 = BuildViewId(connection_id_1(), 1); |
1275 changes2()->clear(); | 1272 changes2()->clear(); |
1276 | 1273 |
1277 ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(vm1(), view_1_1)); | 1274 ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(vm1(), view_1_1)); |
1278 | 1275 |
1279 // Connection2 should have been told about the unembed and delete. | 1276 // Connection2 should have been told about the unembed and delete. |
1280 vm_client2_->WaitForChangeCount(2); | 1277 vm_client2_->WaitForChangeCount(2); |
1281 changes2()->clear(); | 1278 changes2()->clear(); |
1282 | 1279 |
1283 // Create a view in the third connection and parent it to the root. | 1280 // Create a view in the third connection and parent it to the root. |
1284 Id view_3_1 = vm_client3()->CreateView(1); | 1281 Id view_3_1 = vm_client3()->CreateView(1); |
1285 ASSERT_TRUE(view_3_1); | 1282 ASSERT_TRUE(view_3_1); |
1286 ASSERT_TRUE(AddView(vm3(), view_1_1, view_3_1)); | 1283 ASSERT_TRUE(AddView(vm3(), view_1_1, view_3_1)); |
1287 | 1284 |
1288 // Connection 1 should have been told about the add (it owns the view). | 1285 // Connection 1 should have been told about the add (it owns the view). |
1289 { | 1286 { |
1290 vm_client1_->WaitForChangeCount(1); | 1287 vm_client1_->WaitForChangeCount(1); |
1291 EXPECT_EQ("HierarchyChanged view=" + IdToString(view_3_1) + " new_parent=" + | 1288 EXPECT_EQ("HierarchyChanged view=" + IdToString(view_3_1) + " new_parent=" + |
1292 IdToString(view_1_1) + " old_parent=null", | 1289 IdToString(view_1_1) + " old_parent=null", |
1293 SingleChangeToDescription(*changes1())); | 1290 SingleChangeToDescription(*changes1())); |
1294 } | 1291 } |
1295 | 1292 |
1296 // Embed 1,1 again. | 1293 // Embed 1,1 again. |
1297 { | 1294 { |
1298 changes3()->clear(); | 1295 changes3()->clear(); |
1299 | 1296 |
1300 // We should get a new connection for the new embedding. | 1297 // We should get a new connection for the new embedding. |
1301 scoped_ptr<ViewManagerClientImpl> connection4(EstablishConnectionViaEmbed( | 1298 scoped_ptr<ViewTreeClientImpl> connection4(EstablishConnectionViaEmbed( |
1302 vm1(), view_1_1, EmbedType::NO_REEMBED, nullptr)); | 1299 vm1(), view_1_1, EmbedType::NO_REEMBED, nullptr)); |
1303 ASSERT_TRUE(connection4.get()); | 1300 ASSERT_TRUE(connection4.get()); |
1304 EXPECT_EQ("[" + ViewParentToString(view_1_1, kNullParentId) + "]", | 1301 EXPECT_EQ("[" + ViewParentToString(view_1_1, kNullParentId) + "]", |
1305 ChangeViewDescription(*connection4->tracker()->changes())); | 1302 ChangeViewDescription(*connection4->tracker()->changes())); |
1306 | 1303 |
1307 // And 3 should get an unembed and delete. | 1304 // And 3 should get an unembed and delete. |
1308 vm_client3_->WaitForChangeCount(2); | 1305 vm_client3_->WaitForChangeCount(2); |
1309 EXPECT_EQ("OnUnembed", ChangesToDescription1(*changes3())[0]); | 1306 EXPECT_EQ("OnUnembed", ChangesToDescription1(*changes3())[0]); |
1310 EXPECT_EQ("ViewDeleted view=" + IdToString(view_1_1), | 1307 EXPECT_EQ("ViewDeleted view=" + IdToString(view_1_1), |
1311 ChangesToDescription1(*changes3())[1]); | 1308 ChangesToDescription1(*changes3())[1]); |
(...skipping 18 matching lines...) Expand all Loading... |
1330 // Verify vm3() can still see the view it created 3,1. | 1327 // Verify vm3() can still see the view it created 3,1. |
1331 { | 1328 { |
1332 std::vector<TestView> views; | 1329 std::vector<TestView> views; |
1333 GetViewTree(vm3(), view_3_1, &views); | 1330 GetViewTree(vm3(), view_3_1, &views); |
1334 ASSERT_EQ(1u, views.size()); | 1331 ASSERT_EQ(1u, views.size()); |
1335 EXPECT_EQ(ViewParentToString(view_3_1, kNullParentId), views[0].ToString()); | 1332 EXPECT_EQ(ViewParentToString(view_3_1, kNullParentId), views[0].ToString()); |
1336 } | 1333 } |
1337 } | 1334 } |
1338 | 1335 |
1339 // Assertions for SetViewVisibility. | 1336 // Assertions for SetViewVisibility. |
1340 TEST_F(ViewManagerServiceAppTest, SetViewVisibility) { | 1337 TEST_F(ViewTreeAppTest, SetViewVisibility) { |
1341 // Create 1 and 2 in the first connection and parent both to the root. | 1338 // Create 1 and 2 in the first connection and parent both to the root. |
1342 Id view_1_1 = vm_client1()->CreateView(1); | 1339 Id view_1_1 = vm_client1()->CreateView(1); |
1343 Id view_1_2 = vm_client1()->CreateView(2); | 1340 Id view_1_2 = vm_client1()->CreateView(2); |
1344 ASSERT_TRUE(view_1_1); | 1341 ASSERT_TRUE(view_1_1); |
1345 ASSERT_TRUE(view_1_2); | 1342 ASSERT_TRUE(view_1_2); |
1346 | 1343 |
1347 ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); | 1344 ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); |
1348 { | 1345 { |
1349 std::vector<TestView> views; | 1346 std::vector<TestView> views; |
1350 GetViewTree(vm1(), root_view_id(), &views); | 1347 GetViewTree(vm1(), root_view_id(), &views); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1406 EXPECT_EQ(ViewParentToString(view_1_1, root_view_id()) + | 1403 EXPECT_EQ(ViewParentToString(view_1_1, root_view_id()) + |
1407 " visible=true drawn=true", | 1404 " visible=true drawn=true", |
1408 views[0].ToString2()); | 1405 views[0].ToString2()); |
1409 EXPECT_EQ( | 1406 EXPECT_EQ( |
1410 ViewParentToString(view_1_2, view_1_1) + " visible=true drawn=true", | 1407 ViewParentToString(view_1_2, view_1_1) + " visible=true drawn=true", |
1411 views[1].ToString2()); | 1408 views[1].ToString2()); |
1412 } | 1409 } |
1413 } | 1410 } |
1414 | 1411 |
1415 // Assertions for SetViewVisibility sending notifications. | 1412 // Assertions for SetViewVisibility sending notifications. |
1416 TEST_F(ViewManagerServiceAppTest, SetViewVisibilityNotifications) { | 1413 TEST_F(ViewTreeAppTest, SetViewVisibilityNotifications) { |
1417 // Create 1,1 and 1,2. 1,2 is made a child of 1,1 and 1,1 a child of the root. | 1414 // Create 1,1 and 1,2. 1,2 is made a child of 1,1 and 1,1 a child of the root. |
1418 Id view_1_1 = vm_client1()->CreateView(1); | 1415 Id view_1_1 = vm_client1()->CreateView(1); |
1419 ASSERT_TRUE(view_1_1); | 1416 ASSERT_TRUE(view_1_1); |
1420 ASSERT_TRUE(SetViewVisibility(vm1(), view_1_1, true)); | 1417 ASSERT_TRUE(SetViewVisibility(vm1(), view_1_1, true)); |
1421 Id view_1_2 = vm_client1()->CreateView(2); | 1418 Id view_1_2 = vm_client1()->CreateView(2); |
1422 ASSERT_TRUE(view_1_2); | 1419 ASSERT_TRUE(view_1_2); |
1423 ASSERT_TRUE(SetViewVisibility(vm1(), view_1_2, true)); | 1420 ASSERT_TRUE(SetViewVisibility(vm1(), view_1_2, true)); |
1424 ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); | 1421 ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); |
1425 ASSERT_TRUE(AddView(vm1(), view_1_1, view_1_2)); | 1422 ASSERT_TRUE(AddView(vm1(), view_1_1, view_1_2)); |
1426 | 1423 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1494 changes2()->clear(); | 1491 changes2()->clear(); |
1495 // Add 1,1 back to the root, connection 2 should see drawn state changed. | 1492 // Add 1,1 back to the root, connection 2 should see drawn state changed. |
1496 ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); | 1493 ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); |
1497 { | 1494 { |
1498 vm_client2_->WaitForChangeCount(1); | 1495 vm_client2_->WaitForChangeCount(1); |
1499 EXPECT_EQ("DrawnStateChanged view=" + IdToString(view_1_2) + " drawn=true", | 1496 EXPECT_EQ("DrawnStateChanged view=" + IdToString(view_1_2) + " drawn=true", |
1500 SingleChangeToDescription(*changes2())); | 1497 SingleChangeToDescription(*changes2())); |
1501 } | 1498 } |
1502 } | 1499 } |
1503 | 1500 |
1504 TEST_F(ViewManagerServiceAppTest, SetViewProperty) { | 1501 TEST_F(ViewTreeAppTest, SetViewProperty) { |
1505 Id view_1_1 = vm_client1()->CreateView(1); | 1502 Id view_1_1 = vm_client1()->CreateView(1); |
1506 ASSERT_TRUE(view_1_1); | 1503 ASSERT_TRUE(view_1_1); |
1507 | 1504 |
1508 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(false)); | 1505 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(false)); |
1509 changes2()->clear(); | 1506 changes2()->clear(); |
1510 | 1507 |
1511 ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); | 1508 ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); |
1512 { | 1509 { |
1513 std::vector<TestView> views; | 1510 std::vector<TestView> views; |
1514 GetViewTree(vm1(), root_view_id(), &views); | 1511 GetViewTree(vm1(), root_view_id(), &views); |
(...skipping 27 matching lines...) Expand all Loading... |
1542 // Set back to null. | 1539 // Set back to null. |
1543 ASSERT_TRUE(SetViewProperty(vm1(), view_1_1, "one", NULL)); | 1540 ASSERT_TRUE(SetViewProperty(vm1(), view_1_1, "one", NULL)); |
1544 { | 1541 { |
1545 vm_client2_->WaitForChangeCount(1); | 1542 vm_client2_->WaitForChangeCount(1); |
1546 EXPECT_EQ( | 1543 EXPECT_EQ( |
1547 "PropertyChanged view=" + IdToString(view_1_1) + " key=one value=NULL", | 1544 "PropertyChanged view=" + IdToString(view_1_1) + " key=one value=NULL", |
1548 SingleChangeToDescription(*changes2())); | 1545 SingleChangeToDescription(*changes2())); |
1549 } | 1546 } |
1550 } | 1547 } |
1551 | 1548 |
1552 TEST_F(ViewManagerServiceAppTest, OnEmbeddedAppDisconnected) { | 1549 TEST_F(ViewTreeAppTest, OnEmbeddedAppDisconnected) { |
1553 // Create connection 2 and 3. | 1550 // Create connection 2 and 3. |
1554 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); | 1551 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); |
1555 Id view_1_1 = BuildViewId(connection_id_1(), 1); | 1552 Id view_1_1 = BuildViewId(connection_id_1(), 1); |
1556 Id view_2_2 = vm_client2()->CreateView(2); | 1553 Id view_2_2 = vm_client2()->CreateView(2); |
1557 ASSERT_TRUE(view_2_2); | 1554 ASSERT_TRUE(view_2_2); |
1558 ASSERT_TRUE(AddView(vm2(), view_1_1, view_2_2)); | 1555 ASSERT_TRUE(AddView(vm2(), view_1_1, view_2_2)); |
1559 changes2()->clear(); | 1556 changes2()->clear(); |
1560 ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(vm2(), view_2_2)); | 1557 ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(vm2(), view_2_2)); |
1561 | 1558 |
1562 // Close connection 3. Connection 2 (which had previously embedded 3) should | 1559 // Close connection 3. Connection 2 (which had previously embedded 3) should |
1563 // be notified of this. | 1560 // be notified of this. |
1564 vm_client3_.reset(); | 1561 vm_client3_.reset(); |
1565 vm_client2_->WaitForChangeCount(1); | 1562 vm_client2_->WaitForChangeCount(1); |
1566 EXPECT_EQ("OnEmbeddedAppDisconnected view=" + IdToString(view_2_2), | 1563 EXPECT_EQ("OnEmbeddedAppDisconnected view=" + IdToString(view_2_2), |
1567 SingleChangeToDescription(*changes2())); | 1564 SingleChangeToDescription(*changes2())); |
1568 } | 1565 } |
1569 | 1566 |
1570 // Verifies when the parent of an Embed() is destroyed the embedded app gets | 1567 // Verifies when the parent of an Embed() is destroyed the embedded app gets |
1571 // a ViewDeleted (and doesn't trigger a DCHECK). | 1568 // a ViewDeleted (and doesn't trigger a DCHECK). |
1572 TEST_F(ViewManagerServiceAppTest, OnParentOfEmbedDisconnects) { | 1569 TEST_F(ViewTreeAppTest, OnParentOfEmbedDisconnects) { |
1573 // Create connection 2 and 3. | 1570 // Create connection 2 and 3. |
1574 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); | 1571 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); |
1575 Id view_1_1 = BuildViewId(connection_id_1(), 1); | 1572 Id view_1_1 = BuildViewId(connection_id_1(), 1); |
1576 ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); | 1573 ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); |
1577 Id view_2_2 = vm_client2()->CreateView(2); | 1574 Id view_2_2 = vm_client2()->CreateView(2); |
1578 Id view_2_3 = vm_client2()->CreateView(3); | 1575 Id view_2_3 = vm_client2()->CreateView(3); |
1579 ASSERT_TRUE(view_2_2); | 1576 ASSERT_TRUE(view_2_2); |
1580 ASSERT_TRUE(view_2_3); | 1577 ASSERT_TRUE(view_2_3); |
1581 ASSERT_TRUE(AddView(vm2(), view_1_1, view_2_2)); | 1578 ASSERT_TRUE(AddView(vm2(), view_1_1, view_2_2)); |
1582 ASSERT_TRUE(AddView(vm2(), view_2_2, view_2_3)); | 1579 ASSERT_TRUE(AddView(vm2(), view_2_2, view_2_3)); |
1583 changes2()->clear(); | 1580 changes2()->clear(); |
1584 ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(vm2(), view_2_3)); | 1581 ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(vm2(), view_2_3)); |
1585 changes3()->clear(); | 1582 changes3()->clear(); |
1586 | 1583 |
1587 // Close connection 2. Connection 3 should get a delete (for its root). | 1584 // Close connection 2. Connection 3 should get a delete (for its root). |
1588 vm_client2_.reset(); | 1585 vm_client2_.reset(); |
1589 vm_client3_->WaitForChangeCount(1); | 1586 vm_client3_->WaitForChangeCount(1); |
1590 EXPECT_EQ("ViewDeleted view=" + IdToString(view_2_3), | 1587 EXPECT_EQ("ViewDeleted view=" + IdToString(view_2_3), |
1591 SingleChangeToDescription(*changes3())); | 1588 SingleChangeToDescription(*changes3())); |
1592 } | 1589 } |
1593 | 1590 |
1594 // Verifies ViewManagerServiceImpl doesn't incorrectly erase from its internal | 1591 // Verifies ViewTreeImpl doesn't incorrectly erase from its internal |
1595 // map when a view from another connection with the same view_id is removed. | 1592 // map when a view from another connection with the same view_id is removed. |
1596 TEST_F(ViewManagerServiceAppTest, DontCleanMapOnDestroy) { | 1593 TEST_F(ViewTreeAppTest, DontCleanMapOnDestroy) { |
1597 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); | 1594 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); |
1598 Id view_1_1 = BuildViewId(connection_id_1(), 1); | 1595 Id view_1_1 = BuildViewId(connection_id_1(), 1); |
1599 ASSERT_TRUE(vm_client2()->CreateView(1)); | 1596 ASSERT_TRUE(vm_client2()->CreateView(1)); |
1600 changes1()->clear(); | 1597 changes1()->clear(); |
1601 vm_client2_.reset(); | 1598 vm_client2_.reset(); |
1602 vm_client1_->WaitForChangeCount(1); | 1599 vm_client1_->WaitForChangeCount(1); |
1603 EXPECT_EQ("OnEmbeddedAppDisconnected view=" + IdToString(view_1_1), | 1600 EXPECT_EQ("OnEmbeddedAppDisconnected view=" + IdToString(view_1_1), |
1604 SingleChangeToDescription(*changes1())); | 1601 SingleChangeToDescription(*changes1())); |
1605 std::vector<TestView> views; | 1602 std::vector<TestView> views; |
1606 GetViewTree(vm1(), view_1_1, &views); | 1603 GetViewTree(vm1(), view_1_1, &views); |
1607 EXPECT_FALSE(views.empty()); | 1604 EXPECT_FALSE(views.empty()); |
1608 } | 1605 } |
1609 | 1606 |
1610 TEST_F(ViewManagerServiceAppTest, CloneAndAnimate) { | 1607 TEST_F(ViewTreeAppTest, CloneAndAnimate) { |
1611 // Create connection 2 and 3. | 1608 // Create connection 2 and 3. |
1612 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); | 1609 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); |
1613 Id view_1_1 = BuildViewId(connection_id_1(), 1); | 1610 Id view_1_1 = BuildViewId(connection_id_1(), 1); |
1614 ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); | 1611 ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); |
1615 Id view_2_2 = vm_client2()->CreateView(2); | 1612 Id view_2_2 = vm_client2()->CreateView(2); |
1616 Id view_2_3 = vm_client2()->CreateView(3); | 1613 Id view_2_3 = vm_client2()->CreateView(3); |
1617 ASSERT_TRUE(view_2_2); | 1614 ASSERT_TRUE(view_2_2); |
1618 ASSERT_TRUE(view_2_3); | 1615 ASSERT_TRUE(view_2_3); |
1619 ASSERT_TRUE(AddView(vm2(), view_1_1, view_2_2)); | 1616 ASSERT_TRUE(AddView(vm2(), view_1_1, view_2_2)); |
1620 ASSERT_TRUE(AddView(vm2(), view_2_2, view_2_3)); | 1617 ASSERT_TRUE(AddView(vm2(), view_2_2, view_2_3)); |
(...skipping 15 matching lines...) Expand all Loading... |
1636 // No one should be able to see the cloned tree. | 1633 // No one should be able to see the cloned tree. |
1637 std::vector<TestView> views; | 1634 std::vector<TestView> views; |
1638 GetViewTree(vm1(), view_1_1, &views); | 1635 GetViewTree(vm1(), view_1_1, &views); |
1639 EXPECT_FALSE(HasClonedView(views)); | 1636 EXPECT_FALSE(HasClonedView(views)); |
1640 views.clear(); | 1637 views.clear(); |
1641 | 1638 |
1642 GetViewTree(vm2(), view_1_1, &views); | 1639 GetViewTree(vm2(), view_1_1, &views); |
1643 EXPECT_FALSE(HasClonedView(views)); | 1640 EXPECT_FALSE(HasClonedView(views)); |
1644 } | 1641 } |
1645 | 1642 |
1646 // Verifies Embed() works when supplying a ViewManagerClient. | 1643 // Verifies Embed() works when supplying a ViewTreeClient. |
1647 TEST_F(ViewManagerServiceAppTest, EmbedSupplyingViewManagerClient) { | 1644 TEST_F(ViewTreeAppTest, EmbedSupplyingViewTreeClient) { |
1648 ASSERT_TRUE(vm_client1()->CreateView(1)); | 1645 ASSERT_TRUE(vm_client1()->CreateView(1)); |
1649 | 1646 |
1650 ViewManagerClientImpl client2(application_impl()); | 1647 ViewTreeClientImpl client2(application_impl()); |
1651 mojo::ViewManagerClientPtr client2_ptr; | 1648 mojo::ViewTreeClientPtr client2_ptr; |
1652 mojo::Binding<ViewManagerClient> client2_binding(&client2, &client2_ptr); | 1649 mojo::Binding<ViewTreeClient> client2_binding(&client2, &client2_ptr); |
1653 ASSERT_TRUE( | 1650 ASSERT_TRUE( |
1654 Embed(vm1(), BuildViewId(connection_id_1(), 1), client2_ptr.Pass())); | 1651 Embed(vm1(), BuildViewId(connection_id_1(), 1), client2_ptr.Pass())); |
1655 client2.WaitForOnEmbed(); | 1652 client2.WaitForOnEmbed(); |
1656 EXPECT_EQ("OnEmbed", | 1653 EXPECT_EQ("OnEmbed", |
1657 SingleChangeToDescription(*client2.tracker()->changes())); | 1654 SingleChangeToDescription(*client2.tracker()->changes())); |
1658 } | 1655 } |
1659 | 1656 |
1660 TEST_F(ViewManagerServiceAppTest, OnWillEmbed) { | 1657 TEST_F(ViewTreeAppTest, OnWillEmbed) { |
1661 // Create connections 2 and 3, marking 2 as an embed root. | 1658 // Create connections 2 and 3, marking 2 as an embed root. |
1662 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); | 1659 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); |
1663 Id view_1_1 = BuildViewId(connection_id_1(), 1); | 1660 Id view_1_1 = BuildViewId(connection_id_1(), 1); |
1664 ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); | 1661 ASSERT_TRUE(AddView(vm1(), root_view_id(), view_1_1)); |
1665 Id view_2_2 = vm_client2()->CreateView(2); | 1662 Id view_2_2 = vm_client2()->CreateView(2); |
1666 ASSERT_TRUE(view_2_2); | 1663 ASSERT_TRUE(view_2_2); |
1667 ASSERT_TRUE(AddView(vm2(), view_1_1, view_2_2)); | 1664 ASSERT_TRUE(AddView(vm2(), view_1_1, view_2_2)); |
1668 ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(vm2(), view_2_2)); | 1665 ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(vm2(), view_2_2)); |
1669 Id view_3_3 = vm_client3()->CreateView(3); | 1666 Id view_3_3 = vm_client3()->CreateView(3); |
1670 ASSERT_TRUE(view_3_3); | 1667 ASSERT_TRUE(view_3_3); |
1671 ASSERT_TRUE(AddView(vm3(), view_2_2, view_3_3)); | 1668 ASSERT_TRUE(AddView(vm3(), view_2_2, view_3_3)); |
1672 vm2()->SetEmbedRoot(); | 1669 vm2()->SetEmbedRoot(); |
1673 // Make sure the viewmanager processed the SetEmbedRoot() call. | 1670 // Make sure the viewmanager processed the SetEmbedRoot() call. |
1674 ASSERT_TRUE(WaitForAllMessages(vm2())); | 1671 ASSERT_TRUE(WaitForAllMessages(vm2())); |
1675 changes2()->clear(); | 1672 changes2()->clear(); |
1676 | 1673 |
1677 // Embed 4 into 3, connection 2 should get the OnWillEmbed. | 1674 // Embed 4 into 3, connection 2 should get the OnWillEmbed. |
1678 scoped_ptr<ViewManagerClientImpl> connection4(EstablishConnectionViaEmbed( | 1675 scoped_ptr<ViewTreeClientImpl> connection4(EstablishConnectionViaEmbed( |
1679 vm3(), view_3_3, EmbedType::ALLOW_REEMBED, nullptr)); | 1676 vm3(), view_3_3, EmbedType::ALLOW_REEMBED, nullptr)); |
1680 ASSERT_TRUE(connection4.get()); | 1677 ASSERT_TRUE(connection4.get()); |
1681 EXPECT_EQ("OnEmbedForDescendant view=" + IdToString(view_3_3), | 1678 EXPECT_EQ("OnEmbedForDescendant view=" + IdToString(view_3_3), |
1682 SingleChangeToDescription(*changes2())); | 1679 SingleChangeToDescription(*changes2())); |
1683 | 1680 |
1684 // Mark 3 as an embed root. | 1681 // Mark 3 as an embed root. |
1685 vm3()->SetEmbedRoot(); | 1682 vm3()->SetEmbedRoot(); |
1686 // Make sure the viewmanager processed the SetEmbedRoot() call. | 1683 // Make sure the viewmanager processed the SetEmbedRoot() call. |
1687 ASSERT_TRUE(WaitForAllMessages(vm3())); | 1684 ASSERT_TRUE(WaitForAllMessages(vm3())); |
1688 changes2()->clear(); | 1685 changes2()->clear(); |
1689 changes3()->clear(); | 1686 changes3()->clear(); |
1690 | 1687 |
1691 // Embed 5 into 4. Only 3 should get the will embed. | 1688 // Embed 5 into 4. Only 3 should get the will embed. |
1692 Id view_4_4 = connection4->CreateView(4); | 1689 Id view_4_4 = connection4->CreateView(4); |
1693 ASSERT_TRUE(view_4_4); | 1690 ASSERT_TRUE(view_4_4); |
1694 ASSERT_TRUE(AddView(connection4->service(), view_3_3, view_4_4)); | 1691 ASSERT_TRUE(AddView(connection4->tree(), view_3_3, view_4_4)); |
1695 | 1692 |
1696 // vm3() and vm2() should see view_4_4 as they are embed roots. | 1693 // vm3() and vm2() should see view_4_4 as they are embed roots. |
1697 ASSERT_TRUE(WaitForAllMessages(vm3())); | 1694 ASSERT_TRUE(WaitForAllMessages(vm3())); |
1698 EXPECT_EQ("HierarchyChanged view=" + IdToString(view_4_4) + " new_parent=" + | 1695 EXPECT_EQ("HierarchyChanged view=" + IdToString(view_4_4) + " new_parent=" + |
1699 IdToString(view_3_3) + " old_parent=null", | 1696 IdToString(view_3_3) + " old_parent=null", |
1700 SingleChangeToDescription(*changes3())); | 1697 SingleChangeToDescription(*changes3())); |
1701 changes3()->clear(); | 1698 changes3()->clear(); |
1702 | 1699 |
1703 ASSERT_TRUE(WaitForAllMessages(vm2())); | 1700 ASSERT_TRUE(WaitForAllMessages(vm2())); |
1704 EXPECT_EQ("HierarchyChanged view=" + IdToString(view_4_4) + " new_parent=" + | 1701 EXPECT_EQ("HierarchyChanged view=" + IdToString(view_4_4) + " new_parent=" + |
1705 IdToString(view_3_3) + " old_parent=null", | 1702 IdToString(view_3_3) + " old_parent=null", |
1706 SingleChangeToDescription(*changes2())); | 1703 SingleChangeToDescription(*changes2())); |
1707 changes2()->clear(); | 1704 changes2()->clear(); |
1708 | 1705 |
1709 scoped_ptr<ViewManagerClientImpl> connection5(EstablishConnectionViaEmbed( | 1706 scoped_ptr<ViewTreeClientImpl> connection5(EstablishConnectionViaEmbed( |
1710 connection4->service(), view_4_4, EmbedType::ALLOW_REEMBED, nullptr)); | 1707 connection4->tree(), view_4_4, EmbedType::ALLOW_REEMBED, nullptr)); |
1711 ASSERT_TRUE(connection5.get()); | 1708 ASSERT_TRUE(connection5.get()); |
1712 EXPECT_EQ("OnEmbedForDescendant view=" + IdToString(view_4_4), | 1709 EXPECT_EQ("OnEmbedForDescendant view=" + IdToString(view_4_4), |
1713 SingleChangeToDescription(*changes3())); | 1710 SingleChangeToDescription(*changes3())); |
1714 ASSERT_TRUE(changes2()->empty()); | 1711 ASSERT_TRUE(changes2()->empty()); |
1715 } | 1712 } |
1716 | 1713 |
1717 TEST_F(ViewManagerServiceAppTest, EmbedFailsFromOtherConnection) { | 1714 TEST_F(ViewTreeAppTest, EmbedFailsFromOtherConnection) { |
1718 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); | 1715 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); |
1719 | 1716 |
1720 Id view_1_1 = BuildViewId(connection_id_1(), 1); | 1717 Id view_1_1 = BuildViewId(connection_id_1(), 1); |
1721 Id view_2_2 = vm_client2()->CreateView(2); | 1718 Id view_2_2 = vm_client2()->CreateView(2); |
1722 ASSERT_TRUE(view_2_2); | 1719 ASSERT_TRUE(view_2_2); |
1723 ASSERT_TRUE(AddView(vm2(), view_1_1, view_2_2)); | 1720 ASSERT_TRUE(AddView(vm2(), view_1_1, view_2_2)); |
1724 ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(vm2(), view_2_2)); | 1721 ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(vm2(), view_2_2)); |
1725 | 1722 |
1726 Id view_3_3 = vm_client3()->CreateView(3); | 1723 Id view_3_3 = vm_client3()->CreateView(3); |
1727 ASSERT_TRUE(view_3_3); | 1724 ASSERT_TRUE(view_3_3); |
1728 ASSERT_TRUE(AddView(vm3(), view_2_2, view_3_3)); | 1725 ASSERT_TRUE(AddView(vm3(), view_2_2, view_3_3)); |
1729 | 1726 |
1730 // 2 should not be able to embed in view_3_3 as view_3_3 was not created by | 1727 // 2 should not be able to embed in view_3_3 as view_3_3 was not created by |
1731 // 2. | 1728 // 2. |
1732 EXPECT_FALSE(EmbedUrl(application_impl(), vm2(), application_impl()->url(), | 1729 EXPECT_FALSE(EmbedUrl(application_impl(), vm2(), application_impl()->url(), |
1733 view_3_3)); | 1730 view_3_3)); |
1734 } | 1731 } |
1735 | 1732 |
1736 // Verifies Embed() from window manager on another connections view works. | 1733 // Verifies Embed() from window manager on another connections view works. |
1737 TEST_F(ViewManagerServiceAppTest, EmbedFromOtherConnection) { | 1734 TEST_F(ViewTreeAppTest, EmbedFromOtherConnection) { |
1738 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); | 1735 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); |
1739 | 1736 |
1740 Id view_1_1 = BuildViewId(connection_id_1(), 1); | 1737 Id view_1_1 = BuildViewId(connection_id_1(), 1); |
1741 Id view_2_2 = vm_client2()->CreateView(2); | 1738 Id view_2_2 = vm_client2()->CreateView(2); |
1742 ASSERT_TRUE(view_2_2); | 1739 ASSERT_TRUE(view_2_2); |
1743 ASSERT_TRUE(AddView(vm2(), view_1_1, view_2_2)); | 1740 ASSERT_TRUE(AddView(vm2(), view_1_1, view_2_2)); |
1744 | 1741 |
1745 changes2()->clear(); | 1742 changes2()->clear(); |
1746 | 1743 |
1747 // Establish a third connection in view_2_2. | 1744 // Establish a third connection in view_2_2. |
1748 ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(vm1(), view_2_2)); | 1745 ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(vm1(), view_2_2)); |
1749 | 1746 |
1750 WaitForAllMessages(vm2()); | 1747 WaitForAllMessages(vm2()); |
1751 EXPECT_EQ(std::string(), SingleChangeToDescription(*changes2())); | 1748 EXPECT_EQ(std::string(), SingleChangeToDescription(*changes2())); |
1752 } | 1749 } |
1753 | 1750 |
1754 // TODO(sky): need to better track changes to initial connection. For example, | 1751 // TODO(sky): need to better track changes to initial connection. For example, |
1755 // that SetBounsdViews/AddView and the like don't result in messages to the | 1752 // that SetBounsdViews/AddView and the like don't result in messages to the |
1756 // originating connection. | 1753 // originating connection. |
1757 | 1754 |
1758 // TODO(sky): make sure coverage of what was | 1755 // TODO(sky): make sure coverage of what was |
1759 // ViewManagerTest.SecondEmbedRoot_InitService and | 1756 // ViewManagerTest.SecondEmbedRoot_InitService and |
1760 // ViewManagerTest.MultipleEmbedRootsBeforeWTHReady gets added to window manager | 1757 // ViewManagerTest.MultipleEmbedRootsBeforeWTHReady gets added to window manager |
1761 // tests. | 1758 // tests. |
1762 | 1759 |
1763 } // namespace view_manager | 1760 } // namespace view_manager |
OLD | NEW |