| 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 <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
| 13 #include "mojo/common/common_type_converters.h" | 13 #include "mojo/common/common_type_converters.h" |
| 14 #include "mojo/geometry/geometry_type_converters.h" | 14 #include "mojo/geometry/geometry_type_converters.h" |
| 15 #include "mojo/public/cpp/bindings/allocation_scope.h" | |
| 16 #include "mojo/public/cpp/environment/environment.h" | 15 #include "mojo/public/cpp/environment/environment.h" |
| 17 #include "mojo/public/cpp/shell/connect.h" | 16 #include "mojo/public/cpp/shell/connect.h" |
| 18 #include "mojo/services/public/cpp/view_manager/util.h" | 17 #include "mojo/services/public/cpp/view_manager/util.h" |
| 19 #include "mojo/services/public/cpp/view_manager/view_manager_types.h" | 18 #include "mojo/services/public/cpp/view_manager/view_manager_types.h" |
| 20 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" | 19 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" |
| 21 #include "mojo/shell/shell_test_helper.h" | 20 #include "mojo/shell/shell_test_helper.h" |
| 22 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 23 #include "ui/gfx/geometry/rect.h" | 22 #include "ui/gfx/geometry/rect.h" |
| 24 | 23 |
| 25 namespace mojo { | 24 namespace mojo { |
| 26 | |
| 27 // TODO(sky): remove this when Darin is done with cleanup. | |
| 28 template <typename T> | |
| 29 class MOJO_COMMON_EXPORT TypeConverter<T, T> { | |
| 30 public: | |
| 31 static T ConvertFrom(T input, Buffer* buf) { | |
| 32 return input; | |
| 33 } | |
| 34 static T ConvertTo(T input) { | |
| 35 return input; | |
| 36 } | |
| 37 | |
| 38 MOJO_ALLOW_IMPLICIT_TYPE_CONVERSION(); | |
| 39 }; | |
| 40 | |
| 41 namespace view_manager { | 25 namespace view_manager { |
| 42 namespace service { | 26 namespace service { |
| 43 | 27 |
| 44 namespace { | 28 namespace { |
| 45 | 29 |
| 46 base::RunLoop* current_run_loop = NULL; | 30 base::RunLoop* current_run_loop = NULL; |
| 47 | 31 |
| 48 // Sets |current_run_loop| and runs it. It is expected that someone else quits | 32 // Sets |current_run_loop| and runs it. It is expected that someone else quits |
| 49 // the loop. | 33 // the loop. |
| 50 void DoRunLoop() { | 34 void DoRunLoop() { |
| 51 DCHECK(!current_run_loop); | 35 DCHECK(!current_run_loop); |
| 52 | 36 |
| 53 base::RunLoop run_loop; | 37 base::RunLoop run_loop; |
| 54 current_run_loop = &run_loop; | 38 current_run_loop = &run_loop; |
| 55 current_run_loop->Run(); | 39 current_run_loop->Run(); |
| 56 current_run_loop = NULL; | 40 current_run_loop = NULL; |
| 57 } | 41 } |
| 58 | 42 |
| 59 // Converts |id| into a string. | 43 // Converts |id| into a string. |
| 60 std::string NodeIdToString(TransportNodeId id) { | 44 std::string NodeIdToString(TransportNodeId id) { |
| 61 return (id == 0) ? "null" : | 45 return (id == 0) ? "null" : |
| 62 base::StringPrintf("%d,%d", HiWord(id), LoWord(id)); | 46 base::StringPrintf("%d,%d", HiWord(id), LoWord(id)); |
| 63 } | 47 } |
| 64 | 48 |
| 65 // Converts |rect| into a string. | 49 // Converts |rect| into a string. |
| 66 std::string RectToString(const Rect& rect) { | 50 std::string RectToString(const RectPtr& rect) { |
| 67 return base::StringPrintf("%d,%d %dx%d", | 51 return base::StringPrintf("%d,%d %dx%d", |
| 68 rect.position().x(), | 52 rect->position->x, |
| 69 rect.position().y(), | 53 rect->position->y, |
| 70 rect.size().width(), | 54 rect->size->width, |
| 71 rect.size().height()); | 55 rect->size->height); |
| 72 } | 56 } |
| 73 | 57 |
| 74 // Boolean callback. Sets |result_cache| to the value of |result| and quits | 58 // Boolean callback. Sets |result_cache| to the value of |result| and quits |
| 75 // the run loop. | 59 // the run loop. |
| 76 void BooleanCallback(bool* result_cache, bool result) { | 60 void BooleanCallback(bool* result_cache, bool result) { |
| 77 *result_cache = result; | 61 *result_cache = result; |
| 78 current_run_loop->Quit(); | 62 current_run_loop->Quit(); |
| 79 } | 63 } |
| 80 | 64 |
| 81 struct TestNode { | 65 struct TestNode { |
| 82 std::string ToString() const { | 66 std::string ToString() const { |
| 83 return base::StringPrintf("node=%s parent=%s view=%s", | 67 return base::StringPrintf("node=%s parent=%s view=%s", |
| 84 NodeIdToString(node_id).c_str(), | 68 NodeIdToString(node_id).c_str(), |
| 85 NodeIdToString(parent_id).c_str(), | 69 NodeIdToString(parent_id).c_str(), |
| 86 NodeIdToString(view_id).c_str()); | 70 NodeIdToString(view_id).c_str()); |
| 87 } | 71 } |
| 88 | 72 |
| 89 TransportNodeId parent_id; | 73 TransportNodeId parent_id; |
| 90 TransportNodeId node_id; | 74 TransportNodeId node_id; |
| 91 TransportNodeId view_id; | 75 TransportNodeId view_id; |
| 92 }; | 76 }; |
| 93 | 77 |
| 94 void INodesToTestNodes(const mojo::Array<INode>& data, | 78 void INodesToTestNodes(const mojo::Array<INodePtr>& data, |
| 95 std::vector<TestNode>* test_nodes) { | 79 std::vector<TestNode>* test_nodes) { |
| 96 for (size_t i = 0; i < data.size(); ++i) { | 80 for (size_t i = 0; i < data.size(); ++i) { |
| 97 TestNode node; | 81 TestNode node; |
| 98 node.parent_id = data[i].parent_id(); | 82 node.parent_id = data[i]->parent_id; |
| 99 node.node_id = data[i].node_id(); | 83 node.node_id = data[i]->node_id; |
| 100 node.view_id = data[i].view_id(); | 84 node.view_id = data[i]->view_id; |
| 101 test_nodes->push_back(node); | 85 test_nodes->push_back(node); |
| 102 } | 86 } |
| 103 } | 87 } |
| 104 | 88 |
| 105 // Callback that results in a vector of INodes. The INodes are converted to | 89 // Callback that results in a vector of INodes. The INodes are converted to |
| 106 // TestNodes. | 90 // TestNodes. |
| 107 void INodesCallback(std::vector<TestNode>* test_nodes, | 91 void INodesCallback(std::vector<TestNode>* test_nodes, |
| 108 const mojo::Array<INode>& data) { | 92 mojo::Array<INodePtr> data) { |
| 109 INodesToTestNodes(data, test_nodes); | 93 INodesToTestNodes(data, test_nodes); |
| 110 current_run_loop->Quit(); | 94 current_run_loop->Quit(); |
| 111 } | 95 } |
| 112 | 96 |
| 113 // Creates an id used for transport from the specified parameters. | 97 // Creates an id used for transport from the specified parameters. |
| 114 TransportNodeId CreateNodeId(TransportConnectionId connection_id, | 98 TransportNodeId CreateNodeId(TransportConnectionId connection_id, |
| 115 TransportConnectionSpecificNodeId node_id) { | 99 TransportConnectionSpecificNodeId node_id) { |
| 116 return (connection_id << 16) | node_id; | 100 return (connection_id << 16) | node_id; |
| 117 } | 101 } |
| 118 | 102 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 147 bool result = false; | 131 bool result = false; |
| 148 view_manager->DeleteView(view_id, base::Bind(&BooleanCallback, &result)); | 132 view_manager->DeleteView(view_id, base::Bind(&BooleanCallback, &result)); |
| 149 DoRunLoop(); | 133 DoRunLoop(); |
| 150 return result; | 134 return result; |
| 151 } | 135 } |
| 152 | 136 |
| 153 bool SetNodeBounds(IViewManager* view_manager, | 137 bool SetNodeBounds(IViewManager* view_manager, |
| 154 TransportNodeId node_id, | 138 TransportNodeId node_id, |
| 155 const gfx::Rect& bounds) { | 139 const gfx::Rect& bounds) { |
| 156 bool result = false; | 140 bool result = false; |
| 157 view_manager->SetNodeBounds(node_id, bounds, | 141 view_manager->SetNodeBounds(node_id, Rect::From(bounds), |
| 158 base::Bind(&BooleanCallback, &result)); | 142 base::Bind(&BooleanCallback, &result)); |
| 159 DoRunLoop(); | 143 DoRunLoop(); |
| 160 return result; | 144 return result; |
| 161 } | 145 } |
| 162 | 146 |
| 163 // Adds a node, blocking until done. | 147 // Adds a node, blocking until done. |
| 164 bool AddNode(IViewManager* view_manager, | 148 bool AddNode(IViewManager* view_manager, |
| 165 TransportNodeId parent, | 149 TransportNodeId parent, |
| 166 TransportNodeId child, | 150 TransportNodeId child, |
| 167 TransportChangeId server_change_id) { | 151 TransportChangeId server_change_id) { |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 return; | 252 return; |
| 269 quit_count_ = count - changes_.size(); | 253 quit_count_ = count - changes_.size(); |
| 270 DoRunLoop(); | 254 DoRunLoop(); |
| 271 } | 255 } |
| 272 | 256 |
| 273 private: | 257 private: |
| 274 // IViewManagerClient overrides: | 258 // IViewManagerClient overrides: |
| 275 virtual void OnViewManagerConnectionEstablished( | 259 virtual void OnViewManagerConnectionEstablished( |
| 276 TransportConnectionId connection_id, | 260 TransportConnectionId connection_id, |
| 277 TransportChangeId next_server_change_id, | 261 TransportChangeId next_server_change_id, |
| 278 const mojo::Array<INode>& nodes) OVERRIDE { | 262 mojo::Array<INodePtr> nodes) OVERRIDE { |
| 279 id_ = connection_id; | 263 id_ = connection_id; |
| 280 next_server_change_id_ = next_server_change_id; | 264 next_server_change_id_ = next_server_change_id; |
| 281 initial_nodes_.clear(); | 265 initial_nodes_.clear(); |
| 282 INodesToTestNodes(nodes, &initial_nodes_); | 266 INodesToTestNodes(nodes, &initial_nodes_); |
| 283 changes_.push_back("OnConnectionEstablished"); | 267 changes_.push_back("OnConnectionEstablished"); |
| 284 QuitIfNecessary(); | 268 QuitIfNecessary(); |
| 285 } | 269 } |
| 286 virtual void OnServerChangeIdAdvanced( | 270 virtual void OnServerChangeIdAdvanced( |
| 287 uint32_t next_server_change_id) OVERRIDE { | 271 uint32_t next_server_change_id) OVERRIDE { |
| 288 changes_.push_back( | 272 changes_.push_back( |
| 289 base::StringPrintf( | 273 base::StringPrintf( |
| 290 "ServerChangeIdAdvanced %d", | 274 "ServerChangeIdAdvanced %d", |
| 291 static_cast<int>(next_server_change_id))); | 275 static_cast<int>(next_server_change_id))); |
| 292 QuitIfNecessary(); | 276 QuitIfNecessary(); |
| 293 } | 277 } |
| 294 virtual void OnNodeBoundsChanged(TransportNodeId node_id, | 278 virtual void OnNodeBoundsChanged(TransportNodeId node_id, |
| 295 const Rect& old_bounds, | 279 RectPtr old_bounds, |
| 296 const Rect& new_bounds) OVERRIDE { | 280 RectPtr new_bounds) OVERRIDE { |
| 297 changes_.push_back( | 281 changes_.push_back( |
| 298 base::StringPrintf( | 282 base::StringPrintf( |
| 299 "BoundsChanged node=%s old_bounds=%s new_bounds=%s", | 283 "BoundsChanged node=%s old_bounds=%s new_bounds=%s", |
| 300 NodeIdToString(node_id).c_str(), | 284 NodeIdToString(node_id).c_str(), |
| 301 RectToString(old_bounds).c_str(), | 285 RectToString(old_bounds).c_str(), |
| 302 RectToString(new_bounds).c_str())); | 286 RectToString(new_bounds).c_str())); |
| 303 QuitIfNecessary(); | 287 QuitIfNecessary(); |
| 304 } | 288 } |
| 305 virtual void OnNodeHierarchyChanged( | 289 virtual void OnNodeHierarchyChanged( |
| 306 TransportNodeId node, | 290 TransportNodeId node, |
| 307 TransportNodeId new_parent, | 291 TransportNodeId new_parent, |
| 308 TransportNodeId old_parent, | 292 TransportNodeId old_parent, |
| 309 TransportChangeId server_change_id, | 293 TransportChangeId server_change_id, |
| 310 const mojo::Array<INode>& nodes) OVERRIDE { | 294 mojo::Array<INodePtr> nodes) OVERRIDE { |
| 311 changes_.push_back( | 295 changes_.push_back( |
| 312 base::StringPrintf( | 296 base::StringPrintf( |
| 313 "HierarchyChanged change_id=%d node=%s new_parent=%s old_parent=%s", | 297 "HierarchyChanged change_id=%d node=%s new_parent=%s old_parent=%s", |
| 314 static_cast<int>(server_change_id), | 298 static_cast<int>(server_change_id), |
| 315 NodeIdToString(node).c_str(), | 299 NodeIdToString(node).c_str(), |
| 316 NodeIdToString(new_parent).c_str(), | 300 NodeIdToString(new_parent).c_str(), |
| 317 NodeIdToString(old_parent).c_str())); | 301 NodeIdToString(old_parent).c_str())); |
| 318 hierarchy_changed_nodes_.clear(); | 302 hierarchy_changed_nodes_.clear(); |
| 319 INodesToTestNodes(nodes, &hierarchy_changed_nodes_); | 303 INodesToTestNodes(nodes, &hierarchy_changed_nodes_); |
| 320 QuitIfNecessary(); | 304 QuitIfNecessary(); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 view_manager2_.set_client(&client2_); | 374 view_manager2_.set_client(&client2_); |
| 391 | 375 |
| 392 client2_.WaitForId(); | 376 client2_.WaitForId(); |
| 393 client2_.GetAndClearChanges(); | 377 client2_.GetAndClearChanges(); |
| 394 } | 378 } |
| 395 | 379 |
| 396 void EstablishSecondConnectionWithRoot(TransportNodeId root_id) { | 380 void EstablishSecondConnectionWithRoot(TransportNodeId root_id) { |
| 397 EstablishSecondConnection(); | 381 EstablishSecondConnection(); |
| 398 client2_.ClearId(); | 382 client2_.ClearId(); |
| 399 | 383 |
| 400 AllocationScope scope; | |
| 401 std::vector<uint32_t> roots; | 384 std::vector<uint32_t> roots; |
| 402 roots.push_back(root_id); | 385 roots.push_back(root_id); |
| 403 ASSERT_TRUE(SetRoots(view_manager_.get(), 2, roots)); | 386 ASSERT_TRUE(SetRoots(view_manager_.get(), 2, roots)); |
| 404 client2_.DoRunLoopUntilChangesCount(1); | 387 client2_.DoRunLoopUntilChangesCount(1); |
| 405 Changes changes(client2_.GetAndClearChanges()); | 388 Changes changes(client2_.GetAndClearChanges()); |
| 406 ASSERT_EQ(1u, changes.size()); | 389 ASSERT_EQ(1u, changes.size()); |
| 407 EXPECT_EQ("OnConnectionEstablished", changes[0]); | 390 EXPECT_EQ("OnConnectionEstablished", changes[0]); |
| 408 ASSERT_NE(0u, client2_.id()); | 391 ASSERT_NE(0u, client2_.id()); |
| 409 const std::vector<TestNode>& nodes(client2_.initial_nodes()); | 392 const std::vector<TestNode>& nodes(client2_.initial_nodes()); |
| 410 ASSERT_EQ(1u, nodes.size()); | 393 ASSERT_EQ(1u, nodes.size()); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 1)); | 448 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 1)); |
| 466 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 2)); | 449 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 2)); |
| 467 | 450 |
| 468 EXPECT_TRUE(client_.GetAndClearChanges().empty()); | 451 EXPECT_TRUE(client_.GetAndClearChanges().empty()); |
| 469 | 452 |
| 470 EstablishSecondConnection(); | 453 EstablishSecondConnection(); |
| 471 EXPECT_TRUE(client2_.GetAndClearChanges().empty()); | 454 EXPECT_TRUE(client2_.GetAndClearChanges().empty()); |
| 472 | 455 |
| 473 // Make 2 a child of 1. | 456 // Make 2 a child of 1. |
| 474 { | 457 { |
| 475 AllocationScope scope; | |
| 476 ASSERT_TRUE(AddNode(view_manager_.get(), | 458 ASSERT_TRUE(AddNode(view_manager_.get(), |
| 477 CreateNodeId(client_.id(), 1), | 459 CreateNodeId(client_.id(), 1), |
| 478 CreateNodeId(client_.id(), 2), | 460 CreateNodeId(client_.id(), 2), |
| 479 1)); | 461 1)); |
| 480 Changes changes(client_.GetAndClearChanges()); | 462 Changes changes(client_.GetAndClearChanges()); |
| 481 ASSERT_TRUE(changes.empty()); | 463 ASSERT_TRUE(changes.empty()); |
| 482 | 464 |
| 483 client2_.DoRunLoopUntilChangesCount(1); | 465 client2_.DoRunLoopUntilChangesCount(1); |
| 484 changes = client2_.GetAndClearChanges(); | 466 changes = client2_.GetAndClearChanges(); |
| 485 ASSERT_EQ(1u, changes.size()); | 467 ASSERT_EQ(1u, changes.size()); |
| 486 EXPECT_EQ("ServerChangeIdAdvanced 2", changes[0]); | 468 EXPECT_EQ("ServerChangeIdAdvanced 2", changes[0]); |
| 487 } | 469 } |
| 488 | 470 |
| 489 // Remove 2 from its parent. | 471 // Remove 2 from its parent. |
| 490 { | 472 { |
| 491 AllocationScope scope; | |
| 492 ASSERT_TRUE(RemoveNodeFromParent(view_manager_.get(), | 473 ASSERT_TRUE(RemoveNodeFromParent(view_manager_.get(), |
| 493 CreateNodeId(client_.id(), 2), | 474 CreateNodeId(client_.id(), 2), |
| 494 2)); | 475 2)); |
| 495 Changes changes(client_.GetAndClearChanges()); | 476 Changes changes(client_.GetAndClearChanges()); |
| 496 ASSERT_TRUE(changes.empty()); | 477 ASSERT_TRUE(changes.empty()); |
| 497 | 478 |
| 498 client2_.DoRunLoopUntilChangesCount(1); | 479 client2_.DoRunLoopUntilChangesCount(1); |
| 499 changes = client2_.GetAndClearChanges(); | 480 changes = client2_.GetAndClearChanges(); |
| 500 ASSERT_EQ(1u, changes.size()); | 481 ASSERT_EQ(1u, changes.size()); |
| 501 EXPECT_EQ("ServerChangeIdAdvanced 3", changes[0]); | 482 EXPECT_EQ("ServerChangeIdAdvanced 3", changes[0]); |
| 502 } | 483 } |
| 503 } | 484 } |
| 504 | 485 |
| 505 // Verifies AddNode fails when node is already in position. | 486 // Verifies AddNode fails when node is already in position. |
| 506 TEST_F(ViewManagerConnectionTest, AddNodeWithNoChange) { | 487 TEST_F(ViewManagerConnectionTest, AddNodeWithNoChange) { |
| 507 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 1)); | 488 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 1)); |
| 508 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 2)); | 489 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 2)); |
| 509 | 490 |
| 510 EXPECT_TRUE(client_.GetAndClearChanges().empty()); | 491 EXPECT_TRUE(client_.GetAndClearChanges().empty()); |
| 511 | 492 |
| 512 EstablishSecondConnection(); | 493 EstablishSecondConnection(); |
| 513 EXPECT_TRUE(client2_.GetAndClearChanges().empty()); | 494 EXPECT_TRUE(client2_.GetAndClearChanges().empty()); |
| 514 | 495 |
| 515 // Make 2 a child of 1. | 496 // Make 2 a child of 1. |
| 516 { | 497 { |
| 517 AllocationScope scope; | |
| 518 ASSERT_TRUE(AddNode(view_manager_.get(), | 498 ASSERT_TRUE(AddNode(view_manager_.get(), |
| 519 CreateNodeId(client_.id(), 1), | 499 CreateNodeId(client_.id(), 1), |
| 520 CreateNodeId(client_.id(), 2), | 500 CreateNodeId(client_.id(), 2), |
| 521 1)); | 501 1)); |
| 522 Changes changes(client_.GetAndClearChanges()); | 502 Changes changes(client_.GetAndClearChanges()); |
| 523 ASSERT_TRUE(changes.empty()); | 503 ASSERT_TRUE(changes.empty()); |
| 524 | 504 |
| 525 client2_.DoRunLoopUntilChangesCount(1); | 505 client2_.DoRunLoopUntilChangesCount(1); |
| 526 changes = client2_.GetAndClearChanges(); | 506 changes = client2_.GetAndClearChanges(); |
| 527 ASSERT_EQ(1u, changes.size()); | 507 ASSERT_EQ(1u, changes.size()); |
| 528 EXPECT_EQ("ServerChangeIdAdvanced 2", changes[0]); | 508 EXPECT_EQ("ServerChangeIdAdvanced 2", changes[0]); |
| 529 } | 509 } |
| 530 | 510 |
| 531 // Try again, this should fail. | 511 // Try again, this should fail. |
| 532 { | 512 { |
| 533 AllocationScope scope; | |
| 534 EXPECT_FALSE(AddNode(view_manager_.get(), | 513 EXPECT_FALSE(AddNode(view_manager_.get(), |
| 535 CreateNodeId(client_.id(), 1), | 514 CreateNodeId(client_.id(), 1), |
| 536 CreateNodeId(client_.id(), 2), | 515 CreateNodeId(client_.id(), 2), |
| 537 2)); | 516 2)); |
| 538 Changes changes(client_.GetAndClearChanges()); | 517 Changes changes(client_.GetAndClearChanges()); |
| 539 EXPECT_TRUE(changes.empty()); | 518 EXPECT_TRUE(changes.empty()); |
| 540 } | 519 } |
| 541 } | 520 } |
| 542 | 521 |
| 543 // Verifies AddNode fails when node is already in position. | 522 // Verifies AddNode fails when node is already in position. |
| 544 TEST_F(ViewManagerConnectionTest, AddAncestorFails) { | 523 TEST_F(ViewManagerConnectionTest, AddAncestorFails) { |
| 545 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 1)); | 524 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 1)); |
| 546 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 2)); | 525 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 2)); |
| 547 | 526 |
| 548 EXPECT_TRUE(client_.GetAndClearChanges().empty()); | 527 EXPECT_TRUE(client_.GetAndClearChanges().empty()); |
| 549 | 528 |
| 550 EstablishSecondConnection(); | 529 EstablishSecondConnection(); |
| 551 EXPECT_TRUE(client2_.GetAndClearChanges().empty()); | 530 EXPECT_TRUE(client2_.GetAndClearChanges().empty()); |
| 552 | 531 |
| 553 // Make 2 a child of 1. | 532 // Make 2 a child of 1. |
| 554 { | 533 { |
| 555 AllocationScope scope; | |
| 556 ASSERT_TRUE(AddNode(view_manager_.get(), | 534 ASSERT_TRUE(AddNode(view_manager_.get(), |
| 557 CreateNodeId(client_.id(), 1), | 535 CreateNodeId(client_.id(), 1), |
| 558 CreateNodeId(client_.id(), 2), | 536 CreateNodeId(client_.id(), 2), |
| 559 1)); | 537 1)); |
| 560 Changes changes(client_.GetAndClearChanges()); | 538 Changes changes(client_.GetAndClearChanges()); |
| 561 ASSERT_TRUE(changes.empty()); | 539 ASSERT_TRUE(changes.empty()); |
| 562 | 540 |
| 563 client2_.DoRunLoopUntilChangesCount(1); | 541 client2_.DoRunLoopUntilChangesCount(1); |
| 564 changes = client2_.GetAndClearChanges(); | 542 changes = client2_.GetAndClearChanges(); |
| 565 ASSERT_EQ(1u, changes.size()); | 543 ASSERT_EQ(1u, changes.size()); |
| 566 EXPECT_EQ("ServerChangeIdAdvanced 2", changes[0]); | 544 EXPECT_EQ("ServerChangeIdAdvanced 2", changes[0]); |
| 567 } | 545 } |
| 568 | 546 |
| 569 // Try to make 1 a child of 2, this should fail since 1 is an ancestor of 2. | 547 // Try to make 1 a child of 2, this should fail since 1 is an ancestor of 2. |
| 570 { | 548 { |
| 571 AllocationScope scope; | |
| 572 EXPECT_FALSE(AddNode(view_manager_.get(), | 549 EXPECT_FALSE(AddNode(view_manager_.get(), |
| 573 CreateNodeId(client_.id(), 2), | 550 CreateNodeId(client_.id(), 2), |
| 574 CreateNodeId(client_.id(), 1), | 551 CreateNodeId(client_.id(), 1), |
| 575 2)); | 552 2)); |
| 576 Changes changes(client_.GetAndClearChanges()); | 553 Changes changes(client_.GetAndClearChanges()); |
| 577 EXPECT_TRUE(changes.empty()); | 554 EXPECT_TRUE(changes.empty()); |
| 578 } | 555 } |
| 579 } | 556 } |
| 580 | 557 |
| 581 // Verifies adding with an invalid id fails. | 558 // Verifies adding with an invalid id fails. |
| 582 TEST_F(ViewManagerConnectionTest, AddWithInvalidServerId) { | 559 TEST_F(ViewManagerConnectionTest, AddWithInvalidServerId) { |
| 583 // Create two nodes. | 560 // Create two nodes. |
| 584 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 1)); | 561 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 1)); |
| 585 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 2)); | 562 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 2)); |
| 586 | 563 |
| 587 // Make 2 a child of 1. Supply an invalid change id, which should fail. | 564 // Make 2 a child of 1. Supply an invalid change id, which should fail. |
| 588 { | 565 { |
| 589 AllocationScope scope; | |
| 590 ASSERT_FALSE(AddNode(view_manager_.get(), | 566 ASSERT_FALSE(AddNode(view_manager_.get(), |
| 591 CreateNodeId(client_.id(), 1), | 567 CreateNodeId(client_.id(), 1), |
| 592 CreateNodeId(client_.id(), 2), | 568 CreateNodeId(client_.id(), 2), |
| 593 0)); | 569 0)); |
| 594 Changes changes(client_.GetAndClearChanges()); | 570 Changes changes(client_.GetAndClearChanges()); |
| 595 EXPECT_TRUE(changes.empty()); | 571 EXPECT_TRUE(changes.empty()); |
| 596 } | 572 } |
| 597 } | 573 } |
| 598 | 574 |
| 599 // Verifies adding to root sends right notifications. | 575 // Verifies adding to root sends right notifications. |
| 600 TEST_F(ViewManagerConnectionTest, AddToRoot) { | 576 TEST_F(ViewManagerConnectionTest, AddToRoot) { |
| 601 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 21)); | 577 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 21)); |
| 602 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 3)); | 578 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 3)); |
| 603 EXPECT_TRUE(client_.GetAndClearChanges().empty()); | 579 EXPECT_TRUE(client_.GetAndClearChanges().empty()); |
| 604 | 580 |
| 605 EstablishSecondConnection(); | 581 EstablishSecondConnection(); |
| 606 EXPECT_TRUE(client2_.GetAndClearChanges().empty()); | 582 EXPECT_TRUE(client2_.GetAndClearChanges().empty()); |
| 607 | 583 |
| 608 // Make 3 a child of 21. | 584 // Make 3 a child of 21. |
| 609 { | 585 { |
| 610 AllocationScope scope; | |
| 611 ASSERT_TRUE(AddNode(view_manager_.get(), | 586 ASSERT_TRUE(AddNode(view_manager_.get(), |
| 612 CreateNodeId(client_.id(), 21), | 587 CreateNodeId(client_.id(), 21), |
| 613 CreateNodeId(client_.id(), 3), | 588 CreateNodeId(client_.id(), 3), |
| 614 1)); | 589 1)); |
| 615 Changes changes(client_.GetAndClearChanges()); | 590 Changes changes(client_.GetAndClearChanges()); |
| 616 ASSERT_TRUE(changes.empty()); | 591 ASSERT_TRUE(changes.empty()); |
| 617 | 592 |
| 618 client2_.DoRunLoopUntilChangesCount(1); | 593 client2_.DoRunLoopUntilChangesCount(1); |
| 619 changes = client2_.GetAndClearChanges(); | 594 changes = client2_.GetAndClearChanges(); |
| 620 ASSERT_EQ(1u, changes.size()); | 595 ASSERT_EQ(1u, changes.size()); |
| 621 EXPECT_EQ("ServerChangeIdAdvanced 2", changes[0]); | 596 EXPECT_EQ("ServerChangeIdAdvanced 2", changes[0]); |
| 622 } | 597 } |
| 623 | 598 |
| 624 // Make 21 a child of the root. | 599 // Make 21 a child of the root. |
| 625 { | 600 { |
| 626 AllocationScope scope; | |
| 627 ASSERT_TRUE(AddNode(view_manager_.get(), | 601 ASSERT_TRUE(AddNode(view_manager_.get(), |
| 628 CreateNodeId(0, 1), | 602 CreateNodeId(0, 1), |
| 629 CreateNodeId(client_.id(), 21), | 603 CreateNodeId(client_.id(), 21), |
| 630 2)); | 604 2)); |
| 631 Changes changes(client_.GetAndClearChanges()); | 605 Changes changes(client_.GetAndClearChanges()); |
| 632 ASSERT_TRUE(changes.empty()); | 606 ASSERT_TRUE(changes.empty()); |
| 633 | 607 |
| 634 client2_.DoRunLoopUntilChangesCount(1); | 608 client2_.DoRunLoopUntilChangesCount(1); |
| 635 changes = client2_.GetAndClearChanges(); | 609 changes = client2_.GetAndClearChanges(); |
| 636 ASSERT_EQ(1u, changes.size()); | 610 ASSERT_EQ(1u, changes.size()); |
| 637 EXPECT_EQ( | 611 EXPECT_EQ( |
| 638 "HierarchyChanged change_id=2 node=1,21 new_parent=0,1 old_parent=null", | 612 "HierarchyChanged change_id=2 node=1,21 new_parent=0,1 old_parent=null", |
| 639 changes[0]); | 613 changes[0]); |
| 640 } | 614 } |
| 641 } | 615 } |
| 642 | 616 |
| 643 // Verifies adding to root sends right notifications. | 617 // Verifies adding to root sends right notifications. |
| 644 TEST_F(ViewManagerConnectionTest, NodeHierarchyChangedNodes) { | 618 TEST_F(ViewManagerConnectionTest, NodeHierarchyChangedNodes) { |
| 645 // Create nodes 1 and 11 with 1 parented to the root and 11 a child of 1. | 619 // Create nodes 1 and 11 with 1 parented to the root and 11 a child of 1. |
| 646 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 1)); | 620 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 1)); |
| 647 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 11)); | 621 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 11)); |
| 648 | 622 |
| 649 // Make 11 a child of 1. | 623 // Make 11 a child of 1. |
| 650 { | 624 { |
| 651 AllocationScope scope; | |
| 652 ASSERT_TRUE(AddNode(view_manager_.get(), | 625 ASSERT_TRUE(AddNode(view_manager_.get(), |
| 653 CreateNodeId(client_.id(), 1), | 626 CreateNodeId(client_.id(), 1), |
| 654 CreateNodeId(client_.id(), 11), | 627 CreateNodeId(client_.id(), 11), |
| 655 1)); | 628 1)); |
| 656 ASSERT_TRUE(client_.GetAndClearChanges().empty()); | 629 ASSERT_TRUE(client_.GetAndClearChanges().empty()); |
| 657 } | 630 } |
| 658 | 631 |
| 659 EstablishSecondConnection(); | 632 EstablishSecondConnection(); |
| 660 | 633 |
| 661 // Make 1 a child of the root. | 634 // Make 1 a child of the root. |
| 662 { | 635 { |
| 663 AllocationScope scope; | |
| 664 ASSERT_TRUE(AddNode(view_manager_.get(), | 636 ASSERT_TRUE(AddNode(view_manager_.get(), |
| 665 CreateNodeId(0, 1), | 637 CreateNodeId(0, 1), |
| 666 CreateNodeId(client_.id(), 1), | 638 CreateNodeId(client_.id(), 1), |
| 667 2)); | 639 2)); |
| 668 ASSERT_TRUE(client_.GetAndClearChanges().empty()); | 640 ASSERT_TRUE(client_.GetAndClearChanges().empty()); |
| 669 | 641 |
| 670 // Client 2 should get a hierarchy change that includes the new nodes as it | 642 // Client 2 should get a hierarchy change that includes the new nodes as it |
| 671 // has not yet seen them. | 643 // has not yet seen them. |
| 672 client2_.DoRunLoopUntilChangesCount(1); | 644 client2_.DoRunLoopUntilChangesCount(1); |
| 673 Changes changes(client2_.GetAndClearChanges()); | 645 Changes changes(client2_.GetAndClearChanges()); |
| 674 ASSERT_EQ(1u, changes.size()); | 646 ASSERT_EQ(1u, changes.size()); |
| 675 EXPECT_EQ( | 647 EXPECT_EQ( |
| 676 "HierarchyChanged change_id=2 node=1,1 new_parent=0,1 old_parent=null", | 648 "HierarchyChanged change_id=2 node=1,1 new_parent=0,1 old_parent=null", |
| 677 changes[0]); | 649 changes[0]); |
| 678 const std::vector<TestNode>& nodes(client2_.hierarchy_changed_nodes()); | 650 const std::vector<TestNode>& nodes(client2_.hierarchy_changed_nodes()); |
| 679 ASSERT_EQ(2u, nodes.size()); | 651 ASSERT_EQ(2u, nodes.size()); |
| 680 EXPECT_EQ("node=1,1 parent=0,1 view=null", nodes[0].ToString()); | 652 EXPECT_EQ("node=1,1 parent=0,1 view=null", nodes[0].ToString()); |
| 681 EXPECT_EQ("node=1,11 parent=1,1 view=null", nodes[1].ToString()); | 653 EXPECT_EQ("node=1,11 parent=1,1 view=null", nodes[1].ToString()); |
| 682 } | 654 } |
| 683 | 655 |
| 684 // Remove 1 from the root. | 656 // Remove 1 from the root. |
| 685 { | 657 { |
| 686 AllocationScope scope; | |
| 687 ASSERT_TRUE(RemoveNodeFromParent(view_manager_.get(), | 658 ASSERT_TRUE(RemoveNodeFromParent(view_manager_.get(), |
| 688 CreateNodeId(client_.id(), 1), | 659 CreateNodeId(client_.id(), 1), |
| 689 3)); | 660 3)); |
| 690 ASSERT_TRUE(client_.GetAndClearChanges().empty()); | 661 ASSERT_TRUE(client_.GetAndClearChanges().empty()); |
| 691 | 662 |
| 692 client2_.DoRunLoopUntilChangesCount(1); | 663 client2_.DoRunLoopUntilChangesCount(1); |
| 693 Changes changes(client2_.GetAndClearChanges()); | 664 Changes changes(client2_.GetAndClearChanges()); |
| 694 ASSERT_EQ(1u, changes.size()); | 665 ASSERT_EQ(1u, changes.size()); |
| 695 EXPECT_EQ( | 666 EXPECT_EQ( |
| 696 "HierarchyChanged change_id=3 node=1,1 new_parent=null old_parent=0,1", | 667 "HierarchyChanged change_id=3 node=1,1 new_parent=null old_parent=0,1", |
| 697 changes[0]); | 668 changes[0]); |
| 698 } | 669 } |
| 699 | 670 |
| 700 // Create another node, 111, parent it to 11. | 671 // Create another node, 111, parent it to 11. |
| 701 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 111)); | 672 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 111)); |
| 702 { | 673 { |
| 703 AllocationScope scope; | |
| 704 ASSERT_TRUE(AddNode(view_manager_.get(), | 674 ASSERT_TRUE(AddNode(view_manager_.get(), |
| 705 CreateNodeId(client_.id(), 11), | 675 CreateNodeId(client_.id(), 11), |
| 706 CreateNodeId(client_.id(), 111), | 676 CreateNodeId(client_.id(), 111), |
| 707 4)); | 677 4)); |
| 708 ASSERT_TRUE(client_.GetAndClearChanges().empty()); | 678 ASSERT_TRUE(client_.GetAndClearChanges().empty()); |
| 709 | 679 |
| 710 client2_.DoRunLoopUntilChangesCount(1); | 680 client2_.DoRunLoopUntilChangesCount(1); |
| 711 Changes changes(client2_.GetAndClearChanges()); | 681 Changes changes(client2_.GetAndClearChanges()); |
| 712 ASSERT_EQ(1u, changes.size()); | 682 ASSERT_EQ(1u, changes.size()); |
| 713 // Even though 11 isn't attached to the root client 2 is still notified of | 683 // Even though 11 isn't attached to the root client 2 is still notified of |
| (...skipping 27 matching lines...) Expand all Loading... |
| 741 TEST_F(ViewManagerConnectionTest, NodeHierarchyChangedAddingKnownToUnknown) { | 711 TEST_F(ViewManagerConnectionTest, NodeHierarchyChangedAddingKnownToUnknown) { |
| 742 // Create the following structure: root -> 1 -> 11 and 2->21 (2 has no | 712 // Create the following structure: root -> 1 -> 11 and 2->21 (2 has no |
| 743 // parent). | 713 // parent). |
| 744 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 1)); | 714 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 1)); |
| 745 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 11)); | 715 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 11)); |
| 746 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 2)); | 716 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 2)); |
| 747 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 21)); | 717 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 21)); |
| 748 | 718 |
| 749 // Set up the hierarchy. | 719 // Set up the hierarchy. |
| 750 { | 720 { |
| 751 AllocationScope scope; | |
| 752 ASSERT_TRUE(AddNode(view_manager_.get(), | 721 ASSERT_TRUE(AddNode(view_manager_.get(), |
| 753 CreateNodeId(0, 1), | 722 CreateNodeId(0, 1), |
| 754 CreateNodeId(client_.id(), 1), | 723 CreateNodeId(client_.id(), 1), |
| 755 1)); | 724 1)); |
| 756 ASSERT_TRUE(AddNode(view_manager_.get(), | 725 ASSERT_TRUE(AddNode(view_manager_.get(), |
| 757 CreateNodeId(client_.id(), 1), | 726 CreateNodeId(client_.id(), 1), |
| 758 CreateNodeId(client_.id(), 11), | 727 CreateNodeId(client_.id(), 11), |
| 759 2)); | 728 2)); |
| 760 ASSERT_TRUE(AddNode(view_manager_.get(), | 729 ASSERT_TRUE(AddNode(view_manager_.get(), |
| 761 CreateNodeId(client_.id(), 2), | 730 CreateNodeId(client_.id(), 2), |
| 762 CreateNodeId(client_.id(), 21), | 731 CreateNodeId(client_.id(), 21), |
| 763 3)); | 732 3)); |
| 764 } | 733 } |
| 765 | 734 |
| 766 EstablishSecondConnection(); | 735 EstablishSecondConnection(); |
| 767 | 736 |
| 768 // Remove 11. | 737 // Remove 11. |
| 769 { | 738 { |
| 770 AllocationScope scope; | |
| 771 ASSERT_TRUE(RemoveNodeFromParent(view_manager_.get(), | 739 ASSERT_TRUE(RemoveNodeFromParent(view_manager_.get(), |
| 772 CreateNodeId(client_.id(), 11), | 740 CreateNodeId(client_.id(), 11), |
| 773 4)); | 741 4)); |
| 774 ASSERT_TRUE(client_.GetAndClearChanges().empty()); | 742 ASSERT_TRUE(client_.GetAndClearChanges().empty()); |
| 775 | 743 |
| 776 client2_.DoRunLoopUntilChangesCount(1); | 744 client2_.DoRunLoopUntilChangesCount(1); |
| 777 Changes changes(client2_.GetAndClearChanges()); | 745 Changes changes(client2_.GetAndClearChanges()); |
| 778 ASSERT_EQ(1u, changes.size()); | 746 ASSERT_EQ(1u, changes.size()); |
| 779 EXPECT_EQ( | 747 EXPECT_EQ( |
| 780 "HierarchyChanged change_id=4 node=1,11 new_parent=null old_parent=1,1", | 748 "HierarchyChanged change_id=4 node=1,11 new_parent=null old_parent=1,1", |
| 781 changes[0]); | 749 changes[0]); |
| 782 EXPECT_TRUE(client2_.hierarchy_changed_nodes().empty()); | 750 EXPECT_TRUE(client2_.hierarchy_changed_nodes().empty()); |
| 783 } | 751 } |
| 784 | 752 |
| 785 // Add 11 to 21. As client2 knows about 11 it should receive the new | 753 // Add 11 to 21. As client2 knows about 11 it should receive the new |
| 786 // hierarchy. | 754 // hierarchy. |
| 787 { | 755 { |
| 788 AllocationScope scope; | |
| 789 ASSERT_TRUE(AddNode(view_manager_.get(), | 756 ASSERT_TRUE(AddNode(view_manager_.get(), |
| 790 CreateNodeId(client_.id(), 21), | 757 CreateNodeId(client_.id(), 21), |
| 791 CreateNodeId(client_.id(), 11), | 758 CreateNodeId(client_.id(), 11), |
| 792 5)); | 759 5)); |
| 793 ASSERT_TRUE(client_.GetAndClearChanges().empty()); | 760 ASSERT_TRUE(client_.GetAndClearChanges().empty()); |
| 794 | 761 |
| 795 client2_.DoRunLoopUntilChangesCount(1); | 762 client2_.DoRunLoopUntilChangesCount(1); |
| 796 Changes changes(client2_.GetAndClearChanges()); | 763 Changes changes(client2_.GetAndClearChanges()); |
| 797 ASSERT_EQ(1u, changes.size()); | 764 ASSERT_EQ(1u, changes.size()); |
| 798 EXPECT_EQ( | 765 EXPECT_EQ( |
| 799 "HierarchyChanged change_id=5 node=1,11 new_parent=1,21 " | 766 "HierarchyChanged change_id=5 node=1,11 new_parent=1,21 " |
| 800 "old_parent=null", changes[0]); | 767 "old_parent=null", changes[0]); |
| 801 const std::vector<TestNode>& nodes(client2_.hierarchy_changed_nodes()); | 768 const std::vector<TestNode>& nodes(client2_.hierarchy_changed_nodes()); |
| 802 ASSERT_EQ(2u, nodes.size()); | 769 ASSERT_EQ(2u, nodes.size()); |
| 803 EXPECT_EQ("node=1,2 parent=null view=null", nodes[0].ToString()); | 770 EXPECT_EQ("node=1,2 parent=null view=null", nodes[0].ToString()); |
| 804 EXPECT_EQ("node=1,21 parent=1,2 view=null", nodes[1].ToString()); | 771 EXPECT_EQ("node=1,21 parent=1,2 view=null", nodes[1].ToString()); |
| 805 } | 772 } |
| 806 } | 773 } |
| 807 | 774 |
| 808 // Verifies connection on told descendants of the root when connecting. | 775 // Verifies connection on told descendants of the root when connecting. |
| 809 TEST_F(ViewManagerConnectionTest, GetInitialNodesOnInit) { | 776 TEST_F(ViewManagerConnectionTest, GetInitialNodesOnInit) { |
| 810 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 21)); | 777 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 21)); |
| 811 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 3)); | 778 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 3)); |
| 812 EXPECT_TRUE(client_.GetAndClearChanges().empty()); | 779 EXPECT_TRUE(client_.GetAndClearChanges().empty()); |
| 813 | 780 |
| 814 // Make 3 a child of 21. | 781 // Make 3 a child of 21. |
| 815 { | 782 { |
| 816 AllocationScope scope; | |
| 817 ASSERT_TRUE(AddNode(view_manager_.get(), | 783 ASSERT_TRUE(AddNode(view_manager_.get(), |
| 818 CreateNodeId(client_.id(), 21), | 784 CreateNodeId(client_.id(), 21), |
| 819 CreateNodeId(client_.id(), 3), | 785 CreateNodeId(client_.id(), 3), |
| 820 1)); | 786 1)); |
| 821 ASSERT_TRUE(client_.GetAndClearChanges().empty()); | 787 ASSERT_TRUE(client_.GetAndClearChanges().empty()); |
| 822 } | 788 } |
| 823 | 789 |
| 824 // Make 21 a child of the root. | 790 // Make 21 a child of the root. |
| 825 { | 791 { |
| 826 AllocationScope scope; | |
| 827 ASSERT_TRUE(AddNode(view_manager_.get(), | 792 ASSERT_TRUE(AddNode(view_manager_.get(), |
| 828 CreateNodeId(0, 1), | 793 CreateNodeId(0, 1), |
| 829 CreateNodeId(client_.id(), 21), | 794 CreateNodeId(client_.id(), 21), |
| 830 2)); | 795 2)); |
| 831 ASSERT_TRUE(client_.GetAndClearChanges().empty()); | 796 ASSERT_TRUE(client_.GetAndClearChanges().empty()); |
| 832 } | 797 } |
| 833 | 798 |
| 834 EstablishSecondConnection(); | 799 EstablishSecondConnection(); |
| 835 // Should get notification of children of the root. | 800 // Should get notification of children of the root. |
| 836 const std::vector<TestNode>& nodes(client2_.initial_nodes()); | 801 const std::vector<TestNode>& nodes(client2_.initial_nodes()); |
| 837 ASSERT_EQ(3u, nodes.size()); | 802 ASSERT_EQ(3u, nodes.size()); |
| 838 EXPECT_EQ("node=0,1 parent=null view=null", nodes[0].ToString()); | 803 EXPECT_EQ("node=0,1 parent=null view=null", nodes[0].ToString()); |
| 839 EXPECT_EQ("node=1,21 parent=0,1 view=null", nodes[1].ToString()); | 804 EXPECT_EQ("node=1,21 parent=0,1 view=null", nodes[1].ToString()); |
| 840 EXPECT_EQ("node=1,3 parent=1,21 view=null", nodes[2].ToString()); | 805 EXPECT_EQ("node=1,3 parent=1,21 view=null", nodes[2].ToString()); |
| 841 } | 806 } |
| 842 | 807 |
| 843 // Verifies DeleteNode works. | 808 // Verifies DeleteNode works. |
| 844 TEST_F(ViewManagerConnectionTest, DeleteNode) { | 809 TEST_F(ViewManagerConnectionTest, DeleteNode) { |
| 845 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 1)); | 810 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 1)); |
| 846 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 2)); | 811 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 2)); |
| 847 EXPECT_TRUE(client_.GetAndClearChanges().empty()); | 812 EXPECT_TRUE(client_.GetAndClearChanges().empty()); |
| 848 | 813 |
| 849 EstablishSecondConnection(); | 814 EstablishSecondConnection(); |
| 850 EXPECT_TRUE(client2_.GetAndClearChanges().empty()); | 815 EXPECT_TRUE(client2_.GetAndClearChanges().empty()); |
| 851 | 816 |
| 852 // Make 2 a child of 1. | 817 // Make 2 a child of 1. |
| 853 { | 818 { |
| 854 AllocationScope scope; | |
| 855 ASSERT_TRUE(AddNode(view_manager_.get(), | 819 ASSERT_TRUE(AddNode(view_manager_.get(), |
| 856 CreateNodeId(client_.id(), 1), | 820 CreateNodeId(client_.id(), 1), |
| 857 CreateNodeId(client_.id(), 2), | 821 CreateNodeId(client_.id(), 2), |
| 858 1)); | 822 1)); |
| 859 Changes changes(client_.GetAndClearChanges()); | 823 Changes changes(client_.GetAndClearChanges()); |
| 860 ASSERT_TRUE(changes.empty()); | 824 ASSERT_TRUE(changes.empty()); |
| 861 | 825 |
| 862 client2_.DoRunLoopUntilChangesCount(1); | 826 client2_.DoRunLoopUntilChangesCount(1); |
| 863 changes = client2_.GetAndClearChanges(); | 827 changes = client2_.GetAndClearChanges(); |
| 864 ASSERT_EQ(1u, changes.size()); | 828 ASSERT_EQ(1u, changes.size()); |
| 865 EXPECT_EQ("ServerChangeIdAdvanced 2", changes[0]); | 829 EXPECT_EQ("ServerChangeIdAdvanced 2", changes[0]); |
| 866 } | 830 } |
| 867 | 831 |
| 868 // Add 1 to the root | 832 // Add 1 to the root |
| 869 { | 833 { |
| 870 AllocationScope scope; | |
| 871 ASSERT_TRUE(AddNode(view_manager_.get(), | 834 ASSERT_TRUE(AddNode(view_manager_.get(), |
| 872 CreateNodeId(0, 1), | 835 CreateNodeId(0, 1), |
| 873 CreateNodeId(client_.id(), 1), | 836 CreateNodeId(client_.id(), 1), |
| 874 2)); | 837 2)); |
| 875 Changes changes(client_.GetAndClearChanges()); | 838 Changes changes(client_.GetAndClearChanges()); |
| 876 ASSERT_TRUE(changes.empty()); | 839 ASSERT_TRUE(changes.empty()); |
| 877 | 840 |
| 878 client2_.DoRunLoopUntilChangesCount(1); | 841 client2_.DoRunLoopUntilChangesCount(1); |
| 879 changes = client2_.GetAndClearChanges(); | 842 changes = client2_.GetAndClearChanges(); |
| 880 ASSERT_EQ(1u, changes.size()); | 843 ASSERT_EQ(1u, changes.size()); |
| 881 EXPECT_EQ( | 844 EXPECT_EQ( |
| 882 "HierarchyChanged change_id=2 node=1,1 new_parent=0,1 old_parent=null", | 845 "HierarchyChanged change_id=2 node=1,1 new_parent=0,1 old_parent=null", |
| 883 changes[0]); | 846 changes[0]); |
| 884 } | 847 } |
| 885 | 848 |
| 886 // Delete 1. | 849 // Delete 1. |
| 887 { | 850 { |
| 888 AllocationScope scope; | |
| 889 ASSERT_TRUE(DeleteNode(view_manager_.get(), CreateNodeId(client_.id(), 1))); | 851 ASSERT_TRUE(DeleteNode(view_manager_.get(), CreateNodeId(client_.id(), 1))); |
| 890 Changes changes(client_.GetAndClearChanges()); | 852 Changes changes(client_.GetAndClearChanges()); |
| 891 ASSERT_TRUE(changes.empty()); | 853 ASSERT_TRUE(changes.empty()); |
| 892 | 854 |
| 893 client2_.DoRunLoopUntilChangesCount(1); | 855 client2_.DoRunLoopUntilChangesCount(1); |
| 894 changes = client2_.GetAndClearChanges(); | 856 changes = client2_.GetAndClearChanges(); |
| 895 ASSERT_EQ(1u, changes.size()); | 857 ASSERT_EQ(1u, changes.size()); |
| 896 EXPECT_EQ("NodeDeleted change_id=3 node=1,1", changes[0]); | 858 EXPECT_EQ("NodeDeleted change_id=3 node=1,1", changes[0]); |
| 897 } | 859 } |
| 898 } | 860 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 914 // Verifies if a node was deleted and then reused that other clients are | 876 // Verifies if a node was deleted and then reused that other clients are |
| 915 // properly notified. | 877 // properly notified. |
| 916 TEST_F(ViewManagerConnectionTest, ReusedDeletedId) { | 878 TEST_F(ViewManagerConnectionTest, ReusedDeletedId) { |
| 917 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 1)); | 879 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 1)); |
| 918 EXPECT_TRUE(client_.GetAndClearChanges().empty()); | 880 EXPECT_TRUE(client_.GetAndClearChanges().empty()); |
| 919 | 881 |
| 920 EstablishSecondConnection(); | 882 EstablishSecondConnection(); |
| 921 | 883 |
| 922 // Make 1 a child of the root. | 884 // Make 1 a child of the root. |
| 923 { | 885 { |
| 924 AllocationScope scope; | |
| 925 ASSERT_TRUE(AddNode(view_manager_.get(), | 886 ASSERT_TRUE(AddNode(view_manager_.get(), |
| 926 CreateNodeId(0, 1), | 887 CreateNodeId(0, 1), |
| 927 CreateNodeId(client_.id(), 1), | 888 CreateNodeId(client_.id(), 1), |
| 928 1)); | 889 1)); |
| 929 EXPECT_TRUE(client_.GetAndClearChanges().empty()); | 890 EXPECT_TRUE(client_.GetAndClearChanges().empty()); |
| 930 | 891 |
| 931 client2_.DoRunLoopUntilChangesCount(1); | 892 client2_.DoRunLoopUntilChangesCount(1); |
| 932 Changes changes = client2_.GetAndClearChanges(); | 893 Changes changes = client2_.GetAndClearChanges(); |
| 933 EXPECT_EQ( | 894 EXPECT_EQ( |
| 934 "HierarchyChanged change_id=1 node=1,1 new_parent=0,1 old_parent=null", | 895 "HierarchyChanged change_id=1 node=1,1 new_parent=0,1 old_parent=null", |
| 935 changes[0]); | 896 changes[0]); |
| 936 const std::vector<TestNode>& nodes(client2_.hierarchy_changed_nodes()); | 897 const std::vector<TestNode>& nodes(client2_.hierarchy_changed_nodes()); |
| 937 ASSERT_EQ(1u, nodes.size()); | 898 ASSERT_EQ(1u, nodes.size()); |
| 938 EXPECT_EQ("node=1,1 parent=0,1 view=null", nodes[0].ToString()); | 899 EXPECT_EQ("node=1,1 parent=0,1 view=null", nodes[0].ToString()); |
| 939 } | 900 } |
| 940 | 901 |
| 941 // Delete 1. | 902 // Delete 1. |
| 942 { | 903 { |
| 943 AllocationScope scope; | |
| 944 ASSERT_TRUE(DeleteNode(view_manager_.get(), CreateNodeId(client_.id(), 1))); | 904 ASSERT_TRUE(DeleteNode(view_manager_.get(), CreateNodeId(client_.id(), 1))); |
| 945 EXPECT_TRUE(client_.GetAndClearChanges().empty()); | 905 EXPECT_TRUE(client_.GetAndClearChanges().empty()); |
| 946 | 906 |
| 947 client2_.DoRunLoopUntilChangesCount(1); | 907 client2_.DoRunLoopUntilChangesCount(1); |
| 948 Changes changes = client2_.GetAndClearChanges(); | 908 Changes changes = client2_.GetAndClearChanges(); |
| 949 ASSERT_EQ(1u, changes.size()); | 909 ASSERT_EQ(1u, changes.size()); |
| 950 EXPECT_EQ("NodeDeleted change_id=2 node=1,1", changes[0]); | 910 EXPECT_EQ("NodeDeleted change_id=2 node=1,1", changes[0]); |
| 951 } | 911 } |
| 952 | 912 |
| 953 // Create 1 again, and add it back to the root. Should get the same | 913 // Create 1 again, and add it back to the root. Should get the same |
| 954 // notification. | 914 // notification. |
| 955 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 1)); | 915 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 1)); |
| 956 { | 916 { |
| 957 AllocationScope scope; | |
| 958 ASSERT_TRUE(AddNode(view_manager_.get(), | 917 ASSERT_TRUE(AddNode(view_manager_.get(), |
| 959 CreateNodeId(0, 1), | 918 CreateNodeId(0, 1), |
| 960 CreateNodeId(client_.id(), 1), | 919 CreateNodeId(client_.id(), 1), |
| 961 3)); | 920 3)); |
| 962 EXPECT_TRUE(client_.GetAndClearChanges().empty()); | 921 EXPECT_TRUE(client_.GetAndClearChanges().empty()); |
| 963 | 922 |
| 964 client2_.DoRunLoopUntilChangesCount(1); | 923 client2_.DoRunLoopUntilChangesCount(1); |
| 965 Changes changes = client2_.GetAndClearChanges(); | 924 Changes changes = client2_.GetAndClearChanges(); |
| 966 EXPECT_EQ( | 925 EXPECT_EQ( |
| 967 "HierarchyChanged change_id=3 node=1,1 new_parent=0,1 old_parent=null", | 926 "HierarchyChanged change_id=3 node=1,1 new_parent=0,1 old_parent=null", |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1149 4)); | 1108 4)); |
| 1150 | 1109 |
| 1151 // Attach view to node 11 in the first connection. | 1110 // Attach view to node 11 in the first connection. |
| 1152 ASSERT_TRUE(CreateView(view_manager_.get(), 1, 51)); | 1111 ASSERT_TRUE(CreateView(view_manager_.get(), 1, 51)); |
| 1153 ASSERT_TRUE(SetView(view_manager_.get(), | 1112 ASSERT_TRUE(SetView(view_manager_.get(), |
| 1154 CreateNodeId(client_.id(), 11), | 1113 CreateNodeId(client_.id(), 11), |
| 1155 CreateViewId(client_.id(), 51))); | 1114 CreateViewId(client_.id(), 51))); |
| 1156 | 1115 |
| 1157 // Verifies GetNodeTree() on the root. | 1116 // Verifies GetNodeTree() on the root. |
| 1158 { | 1117 { |
| 1159 AllocationScope scope; | |
| 1160 std::vector<TestNode> nodes; | 1118 std::vector<TestNode> nodes; |
| 1161 GetNodeTree(view_manager2_.get(), CreateNodeId(0, 1), &nodes); | 1119 GetNodeTree(view_manager2_.get(), CreateNodeId(0, 1), &nodes); |
| 1162 ASSERT_EQ(5u, nodes.size()); | 1120 ASSERT_EQ(5u, nodes.size()); |
| 1163 EXPECT_EQ("node=0,1 parent=null view=null", nodes[0].ToString()); | 1121 EXPECT_EQ("node=0,1 parent=null view=null", nodes[0].ToString()); |
| 1164 EXPECT_EQ("node=1,1 parent=0,1 view=null", nodes[1].ToString()); | 1122 EXPECT_EQ("node=1,1 parent=0,1 view=null", nodes[1].ToString()); |
| 1165 EXPECT_EQ("node=1,11 parent=1,1 view=1,51", nodes[2].ToString()); | 1123 EXPECT_EQ("node=1,11 parent=1,1 view=1,51", nodes[2].ToString()); |
| 1166 EXPECT_EQ("node=2,2 parent=0,1 view=null", nodes[3].ToString()); | 1124 EXPECT_EQ("node=2,2 parent=0,1 view=null", nodes[3].ToString()); |
| 1167 EXPECT_EQ("node=2,3 parent=0,1 view=null", nodes[4].ToString()); | 1125 EXPECT_EQ("node=2,3 parent=0,1 view=null", nodes[4].ToString()); |
| 1168 } | 1126 } |
| 1169 | 1127 |
| 1170 // Verifies GetNodeTree() on the node 1,1. | 1128 // Verifies GetNodeTree() on the node 1,1. |
| 1171 { | 1129 { |
| 1172 AllocationScope scope; | |
| 1173 std::vector<TestNode> nodes; | 1130 std::vector<TestNode> nodes; |
| 1174 GetNodeTree(view_manager2_.get(), CreateNodeId(1, 1), &nodes); | 1131 GetNodeTree(view_manager2_.get(), CreateNodeId(1, 1), &nodes); |
| 1175 ASSERT_EQ(2u, nodes.size()); | 1132 ASSERT_EQ(2u, nodes.size()); |
| 1176 EXPECT_EQ("node=1,1 parent=0,1 view=null", nodes[0].ToString()); | 1133 EXPECT_EQ("node=1,1 parent=0,1 view=null", nodes[0].ToString()); |
| 1177 EXPECT_EQ("node=1,11 parent=1,1 view=1,51", nodes[1].ToString()); | 1134 EXPECT_EQ("node=1,11 parent=1,1 view=1,51", nodes[1].ToString()); |
| 1178 } | 1135 } |
| 1179 } | 1136 } |
| 1180 | 1137 |
| 1181 TEST_F(ViewManagerConnectionTest, SetNodeBounds) { | 1138 TEST_F(ViewManagerConnectionTest, SetNodeBounds) { |
| 1182 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 1)); | 1139 ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 1)); |
| 1183 ASSERT_TRUE(AddNode(view_manager_.get(), | 1140 ASSERT_TRUE(AddNode(view_manager_.get(), |
| 1184 CreateNodeId(0, 1), | 1141 CreateNodeId(0, 1), |
| 1185 CreateNodeId(1, 1), | 1142 CreateNodeId(1, 1), |
| 1186 1)); | 1143 1)); |
| 1187 EstablishSecondConnection(); | 1144 EstablishSecondConnection(); |
| 1188 | 1145 |
| 1189 AllocationScope scope; | |
| 1190 ASSERT_TRUE(SetNodeBounds(view_manager_.get(), | 1146 ASSERT_TRUE(SetNodeBounds(view_manager_.get(), |
| 1191 CreateNodeId(1, 1), | 1147 CreateNodeId(1, 1), |
| 1192 gfx::Rect(0, 0, 100, 100))); | 1148 gfx::Rect(0, 0, 100, 100))); |
| 1193 | 1149 |
| 1194 client2_.DoRunLoopUntilChangesCount(1); | 1150 client2_.DoRunLoopUntilChangesCount(1); |
| 1195 Changes changes(client2_.GetAndClearChanges()); | 1151 Changes changes(client2_.GetAndClearChanges()); |
| 1196 ASSERT_EQ(1u, changes.size()); | 1152 ASSERT_EQ(1u, changes.size()); |
| 1197 EXPECT_EQ("BoundsChanged node=1,1 old_bounds=0,0 0x0 new_bounds=0,0 100x100", | 1153 EXPECT_EQ("BoundsChanged node=1,1 old_bounds=0,0 0x0 new_bounds=0,0 100x100", |
| 1198 changes[0]); | 1154 changes[0]); |
| 1199 | 1155 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1214 // Parent 1 to the root. | 1170 // Parent 1 to the root. |
| 1215 ASSERT_TRUE(AddNode(view_manager_.get(), | 1171 ASSERT_TRUE(AddNode(view_manager_.get(), |
| 1216 CreateNodeId(0, 1), | 1172 CreateNodeId(0, 1), |
| 1217 CreateNodeId(client_.id(), 1), | 1173 CreateNodeId(client_.id(), 1), |
| 1218 1)); | 1174 1)); |
| 1219 | 1175 |
| 1220 // Establish the second connection and give it the roots 1 and 3. | 1176 // Establish the second connection and give it the roots 1 and 3. |
| 1221 EstablishSecondConnection(); | 1177 EstablishSecondConnection(); |
| 1222 client2_.ClearId(); | 1178 client2_.ClearId(); |
| 1223 { | 1179 { |
| 1224 AllocationScope scope; | |
| 1225 std::vector<uint32_t> roots; | 1180 std::vector<uint32_t> roots; |
| 1226 roots.push_back(CreateNodeId(1, 1)); | 1181 roots.push_back(CreateNodeId(1, 1)); |
| 1227 roots.push_back(CreateNodeId(1, 3)); | 1182 roots.push_back(CreateNodeId(1, 3)); |
| 1228 ASSERT_TRUE(SetRoots(view_manager_.get(), 2, roots)); | 1183 ASSERT_TRUE(SetRoots(view_manager_.get(), 2, roots)); |
| 1229 client2_.DoRunLoopUntilChangesCount(1); | 1184 client2_.DoRunLoopUntilChangesCount(1); |
| 1230 Changes changes(client2_.GetAndClearChanges()); | 1185 Changes changes(client2_.GetAndClearChanges()); |
| 1231 ASSERT_EQ(1u, changes.size()); | 1186 ASSERT_EQ(1u, changes.size()); |
| 1232 EXPECT_EQ("OnConnectionEstablished", changes[0]); | 1187 EXPECT_EQ("OnConnectionEstablished", changes[0]); |
| 1233 ASSERT_NE(0u, client2_.id()); | 1188 ASSERT_NE(0u, client2_.id()); |
| 1234 const std::vector<TestNode>& nodes(client2_.initial_nodes()); | 1189 const std::vector<TestNode>& nodes(client2_.initial_nodes()); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1355 CreateNodeId(client2_.id(), 10), | 1310 CreateNodeId(client2_.id(), 10), |
| 1356 CreateNodeId(client2_.id(), 11), | 1311 CreateNodeId(client2_.id(), 11), |
| 1357 3)); | 1312 3)); |
| 1358 // Remove 11 from 10. | 1313 // Remove 11 from 10. |
| 1359 ASSERT_TRUE(RemoveNodeFromParent(view_manager2_.get(), | 1314 ASSERT_TRUE(RemoveNodeFromParent(view_manager2_.get(), |
| 1360 CreateNodeId(2, 11), | 1315 CreateNodeId(2, 11), |
| 1361 4)); | 1316 4)); |
| 1362 | 1317 |
| 1363 // Verify nothing was actually removed. | 1318 // Verify nothing was actually removed. |
| 1364 { | 1319 { |
| 1365 AllocationScope scope; | |
| 1366 std::vector<TestNode> nodes; | 1320 std::vector<TestNode> nodes; |
| 1367 GetNodeTree(view_manager_.get(), CreateNodeId(0, 1), &nodes); | 1321 GetNodeTree(view_manager_.get(), CreateNodeId(0, 1), &nodes); |
| 1368 ASSERT_EQ(3u, nodes.size()); | 1322 ASSERT_EQ(3u, nodes.size()); |
| 1369 EXPECT_EQ("node=0,1 parent=null view=null", nodes[0].ToString()); | 1323 EXPECT_EQ("node=0,1 parent=null view=null", nodes[0].ToString()); |
| 1370 EXPECT_EQ("node=1,1 parent=0,1 view=null", nodes[1].ToString()); | 1324 EXPECT_EQ("node=1,1 parent=0,1 view=null", nodes[1].ToString()); |
| 1371 EXPECT_EQ("node=1,2 parent=0,1 view=null", nodes[2].ToString()); | 1325 EXPECT_EQ("node=1,2 parent=0,1 view=null", nodes[2].ToString()); |
| 1372 } | 1326 } |
| 1373 } | 1327 } |
| 1374 | 1328 |
| 1375 // Verify SetView fails for nodes that are not descendants of the roots. | 1329 // Verify SetView fails for nodes that are not descendants of the roots. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1416 1)); | 1370 1)); |
| 1417 ASSERT_TRUE(AddNode(view_manager_.get(), | 1371 ASSERT_TRUE(AddNode(view_manager_.get(), |
| 1418 CreateNodeId(0, 1), | 1372 CreateNodeId(0, 1), |
| 1419 CreateNodeId(client_.id(), 2), | 1373 CreateNodeId(client_.id(), 2), |
| 1420 2)); | 1374 2)); |
| 1421 | 1375 |
| 1422 // Establish the second connection and give it the root 1. | 1376 // Establish the second connection and give it the root 1. |
| 1423 ASSERT_NO_FATAL_FAILURE( | 1377 ASSERT_NO_FATAL_FAILURE( |
| 1424 EstablishSecondConnectionWithRoot(CreateNodeId(1, 1))); | 1378 EstablishSecondConnectionWithRoot(CreateNodeId(1, 1))); |
| 1425 | 1379 |
| 1426 AllocationScope scope; | |
| 1427 std::vector<TestNode> nodes; | 1380 std::vector<TestNode> nodes; |
| 1428 | 1381 |
| 1429 // Should get nothing for the root. | 1382 // Should get nothing for the root. |
| 1430 GetNodeTree(view_manager2_.get(), CreateNodeId(0, 1), &nodes); | 1383 GetNodeTree(view_manager2_.get(), CreateNodeId(0, 1), &nodes); |
| 1431 ASSERT_TRUE(nodes.empty()); | 1384 ASSERT_TRUE(nodes.empty()); |
| 1432 | 1385 |
| 1433 // Should get nothing for node 2. | 1386 // Should get nothing for node 2. |
| 1434 GetNodeTree(view_manager2_.get(), CreateNodeId(1, 2), &nodes); | 1387 GetNodeTree(view_manager2_.get(), CreateNodeId(1, 2), &nodes); |
| 1435 ASSERT_TRUE(nodes.empty()); | 1388 ASSERT_TRUE(nodes.empty()); |
| 1436 | 1389 |
| 1437 // Should get node 1 if asked for. | 1390 // Should get node 1 if asked for. |
| 1438 GetNodeTree(view_manager2_.get(), CreateNodeId(1, 1), &nodes); | 1391 GetNodeTree(view_manager2_.get(), CreateNodeId(1, 1), &nodes); |
| 1439 ASSERT_EQ(1u, nodes.size()); | 1392 ASSERT_EQ(1u, nodes.size()); |
| 1440 EXPECT_EQ("node=1,1 parent=null view=null", nodes[0].ToString()); | 1393 EXPECT_EQ("node=1,1 parent=null view=null", nodes[0].ToString()); |
| 1441 } | 1394 } |
| 1442 | 1395 |
| 1443 // TODO(sky): add coverage of test that destroys connections and ensures other | 1396 // TODO(sky): add coverage of test that destroys connections and ensures other |
| 1444 // connections get deletion notification (or advanced server id). | 1397 // connections get deletion notification (or advanced server id). |
| 1445 | 1398 |
| 1446 } // namespace service | 1399 } // namespace service |
| 1447 } // namespace view_manager | 1400 } // namespace view_manager |
| 1448 } // namespace mojo | 1401 } // namespace mojo |
| OLD | NEW |