| Index: mojo/services/view_manager/view_manager_unittest.cc
|
| diff --git a/mojo/services/view_manager/view_manager_unittest.cc b/mojo/services/view_manager/view_manager_unittest.cc
|
| index 2c97f42a054407ecd03e939b06a87225f04464d6..c939489b586001612b7504e43b3058ddbd4131bf 100644
|
| --- a/mojo/services/view_manager/view_manager_unittest.cc
|
| +++ b/mojo/services/view_manager/view_manager_unittest.cc
|
| @@ -105,27 +105,29 @@ class ViewManagerProxy : public TestChangeTracker::Delegate {
|
|
|
| // The following functions are cover methods for ViewManagerService. They
|
| // block until the result is received.
|
| - bool CreateNode(Id node_id) {
|
| + bool CreateView(Id view_id) {
|
| changes_.clear();
|
| ErrorCode result = ERROR_CODE_NONE;
|
| view_manager_->CreateView(
|
| - node_id,
|
| + view_id,
|
| base::Bind(&ViewManagerProxy::GotResultWithErrorCode,
|
| - base::Unretained(this), &result));
|
| + base::Unretained(this),
|
| + &result));
|
| RunMainLoop();
|
| return result == ERROR_CODE_NONE;
|
| }
|
| - ErrorCode CreateNodeWithErrorCode(Id node_id) {
|
| + ErrorCode CreateViewWithErrorCode(Id view_id) {
|
| changes_.clear();
|
| ErrorCode result = ERROR_CODE_NONE;
|
| view_manager_->CreateView(
|
| - node_id,
|
| + view_id,
|
| base::Bind(&ViewManagerProxy::GotResultWithErrorCode,
|
| - base::Unretained(this), &result));
|
| + base::Unretained(this),
|
| + &result));
|
| RunMainLoop();
|
| return result;
|
| }
|
| - bool AddNode(Id parent, Id child) {
|
| + bool AddView(Id parent, Id child) {
|
| changes_.clear();
|
| bool result = false;
|
| view_manager_->AddView(parent, child,
|
| @@ -134,59 +136,68 @@ class ViewManagerProxy : public TestChangeTracker::Delegate {
|
| RunMainLoop();
|
| return result;
|
| }
|
| - bool RemoveNodeFromParent(Id node_id) {
|
| + bool RemoveViewFromParent(Id view_id) {
|
| changes_.clear();
|
| bool result = false;
|
| - view_manager_->RemoveViewFromParent(node_id,
|
| - base::Bind(&ViewManagerProxy::GotResult,
|
| - base::Unretained(this), &result));
|
| + view_manager_->RemoveViewFromParent(
|
| + view_id,
|
| + base::Bind(
|
| + &ViewManagerProxy::GotResult, base::Unretained(this), &result));
|
| RunMainLoop();
|
| return result;
|
| }
|
| - bool ReorderNode(Id node_id,
|
| - Id relative_node_id,
|
| - OrderDirection direction) {
|
| + bool ReorderView(Id view_id, Id relative_view_id, OrderDirection direction) {
|
| changes_.clear();
|
| bool result = false;
|
| - view_manager_->ReorderView(node_id, relative_node_id, direction,
|
| - base::Bind(&ViewManagerProxy::GotResult,
|
| - base::Unretained(this), &result));
|
| + view_manager_->ReorderView(
|
| + view_id,
|
| + relative_view_id,
|
| + direction,
|
| + base::Bind(
|
| + &ViewManagerProxy::GotResult, base::Unretained(this), &result));
|
| RunMainLoop();
|
| return result;
|
| }
|
| - void GetNodeTree(Id node_id, std::vector<TestNode>* nodes) {
|
| + void GetViewTree(Id view_id, std::vector<TestView>* views) {
|
| changes_.clear();
|
| - view_manager_->GetViewTree(node_id,
|
| - base::Bind(&ViewManagerProxy::GotNodeTree,
|
| - base::Unretained(this), nodes));
|
| + view_manager_->GetViewTree(
|
| + view_id,
|
| + base::Bind(
|
| + &ViewManagerProxy::GotViewTree, base::Unretained(this), views));
|
| RunMainLoop();
|
| }
|
| - bool Embed(const Id node_id, const char* url) {
|
| + bool Embed(const Id view_id, const char* url) {
|
| changes_.clear();
|
| base::AutoReset<bool> auto_reset(&in_embed_, true);
|
| bool result = false;
|
| ServiceProviderPtr services;
|
| - view_manager_->Embed(url, node_id, services.Pass(),
|
| - base::Bind(&ViewManagerProxy::GotResult,
|
| - base::Unretained(this), &result));
|
| + view_manager_->Embed(
|
| + url,
|
| + view_id,
|
| + services.Pass(),
|
| + base::Bind(
|
| + &ViewManagerProxy::GotResult, base::Unretained(this), &result));
|
| RunMainLoop();
|
| return result;
|
| }
|
| - bool DeleteNode(Id node_id) {
|
| + bool DeleteView(Id view_id) {
|
| changes_.clear();
|
| bool result = false;
|
| - view_manager_->DeleteView(node_id,
|
| - base::Bind(&ViewManagerProxy::GotResult,
|
| - base::Unretained(this), &result));
|
| + view_manager_->DeleteView(
|
| + view_id,
|
| + base::Bind(
|
| + &ViewManagerProxy::GotResult, base::Unretained(this), &result));
|
| RunMainLoop();
|
| return result;
|
| }
|
| - bool SetNodeBounds(Id node_id, const gfx::Rect& bounds) {
|
| + bool SetViewBounds(Id view_id, const gfx::Rect& bounds) {
|
| changes_.clear();
|
| bool result = false;
|
| - view_manager_->SetViewBounds(node_id, Rect::From(bounds),
|
| - base::Bind(&ViewManagerProxy::GotResult,
|
| - base::Unretained(this), &result));
|
| + view_manager_->SetViewBounds(
|
| + view_id,
|
| + Rect::From(bounds),
|
| + base::Bind(
|
| + &ViewManagerProxy::GotResult, base::Unretained(this), &result));
|
| RunMainLoop();
|
| return result;
|
| }
|
| @@ -238,8 +249,8 @@ class ViewManagerProxy : public TestChangeTracker::Delegate {
|
| main_run_loop_->Quit();
|
| }
|
|
|
| - void GotNodeTree(std::vector<TestNode>* nodes, Array<ViewDataPtr> results) {
|
| - ViewDatasToTestNodes(results, nodes);
|
| + void GotViewTree(std::vector<TestView>* views, Array<ViewDataPtr> results) {
|
| + ViewDatasToTestViews(results, views);
|
| DCHECK(main_run_loop_);
|
| main_run_loop_->Quit();
|
| }
|
| @@ -301,29 +312,27 @@ class TestViewManagerClientConnection
|
| InterfaceRequest<ServiceProvider> services) OVERRIDE {
|
| tracker_.OnEmbed(connection_id, creator_url, root.Pass());
|
| }
|
| - virtual void OnViewBoundsChanged(Id node_id,
|
| + virtual void OnViewBoundsChanged(Id view_id,
|
| RectPtr old_bounds,
|
| RectPtr new_bounds) OVERRIDE {
|
| - tracker_.OnNodeBoundsChanged(node_id, old_bounds.Pass(), new_bounds.Pass());
|
| + tracker_.OnViewBoundsChanged(view_id, old_bounds.Pass(), new_bounds.Pass());
|
| }
|
| - virtual void OnViewHierarchyChanged(Id node,
|
| + virtual void OnViewHierarchyChanged(Id view,
|
| Id new_parent,
|
| Id old_parent,
|
| - Array<ViewDataPtr> nodes) OVERRIDE {
|
| - tracker_.OnNodeHierarchyChanged(node, new_parent, old_parent, nodes.Pass());
|
| + Array<ViewDataPtr> views) OVERRIDE {
|
| + tracker_.OnViewHierarchyChanged(view, new_parent, old_parent, views.Pass());
|
| }
|
| - virtual void OnViewReordered(Id node_id,
|
| - Id relative_node_id,
|
| + virtual void OnViewReordered(Id view_id,
|
| + Id relative_view_id,
|
| OrderDirection direction) OVERRIDE {
|
| - tracker_.OnNodeReordered(node_id, relative_node_id, direction);
|
| + tracker_.OnViewReordered(view_id, relative_view_id, direction);
|
| }
|
| - virtual void OnViewDeleted(Id node) OVERRIDE {
|
| - tracker_.OnNodeDeleted(node);
|
| - }
|
| - virtual void OnViewInputEvent(Id node_id,
|
| + virtual void OnViewDeleted(Id view) OVERRIDE { tracker_.OnViewDeleted(view); }
|
| + virtual void OnViewInputEvent(Id view_id,
|
| EventPtr event,
|
| const Callback<void()>& callback) OVERRIDE {
|
| - tracker_.OnNodeInputEvent(node_id, event.Pass());
|
| + tracker_.OnViewInputEvent(view_id, event.Pass());
|
| }
|
| virtual void Embed(
|
| const String& url,
|
| @@ -383,9 +392,9 @@ class EmbedApplicationLoader : public ApplicationLoader,
|
| };
|
|
|
| // Creates an id used for transport from the specified parameters.
|
| -Id BuildNodeId(ConnectionSpecificId connection_id,
|
| - ConnectionSpecificId node_id) {
|
| - return (connection_id << 16) | node_id;
|
| +Id BuildViewId(ConnectionSpecificId connection_id,
|
| + ConnectionSpecificId view_id) {
|
| + return (connection_id << 16) | view_id;
|
| }
|
|
|
| // Callback from Embed(). |result| is the result of the
|
| @@ -461,18 +470,17 @@ class ViewManagerTest : public testing::Test {
|
| }
|
|
|
| // Creates a second connection to the viewmanager.
|
| - void EstablishSecondConnection(bool create_initial_node) {
|
| - if (create_initial_node)
|
| - ASSERT_TRUE(connection_->CreateNode(BuildNodeId(1, 1)));
|
| + void EstablishSecondConnection(bool create_initial_view) {
|
| + if (create_initial_view)
|
| + ASSERT_TRUE(connection_->CreateView(BuildViewId(1, 1)));
|
| ASSERT_NO_FATAL_FAILURE(
|
| - EstablishSecondConnectionWithRoot(BuildNodeId(1, 1)));
|
| + EstablishSecondConnectionWithRoot(BuildViewId(1, 1)));
|
| const std::vector<Change>& changes(connection2_->changes());
|
| ASSERT_EQ(1u, changes.size());
|
| EXPECT_EQ("OnEmbed creator=mojo:test_url",
|
| ChangesToDescription1(changes)[0]);
|
| - if (create_initial_node) {
|
| - EXPECT_EQ("[node=1,1 parent=null]",
|
| - ChangeNodeDescription(changes));
|
| + if (create_initial_view) {
|
| + EXPECT_EQ("[view=1,1 parent=null]", ChangeViewDescription(changes));
|
| }
|
| }
|
|
|
| @@ -512,7 +520,7 @@ TEST_F(ViewManagerTest, SecondEmbedRoot_InitService) {
|
| }
|
|
|
| TEST_F(ViewManagerTest, SecondEmbedRoot_Service) {
|
| - ASSERT_TRUE(connection_->Embed(BuildNodeId(0, 0), kTestServiceURL));
|
| + ASSERT_TRUE(connection_->Embed(BuildViewId(0, 0), kTestServiceURL));
|
| connection_->DoRunLoopUntilChangesCount(1);
|
| EXPECT_EQ(kTestServiceURL, connection_->changes()[0].embed_url);
|
| }
|
| @@ -554,209 +562,209 @@ TEST_F(ViewManagerTest, TwoClientsGetDifferentConnectionIds) {
|
| EXPECT_EQ(2, connection2_->changes()[0].connection_id);
|
| }
|
|
|
| -// Verifies when Embed() is invoked any child nodes are removed.
|
| -TEST_F(ViewManagerTest, NodesRemovedWhenEmbedding) {
|
| - // Two nodes 1 and 2. 2 is parented to 1.
|
| - ASSERT_TRUE(connection_->CreateNode(BuildNodeId(1, 1)));
|
| - ASSERT_TRUE(connection_->CreateNode(BuildNodeId(1, 2)));
|
| - ASSERT_TRUE(connection_->AddNode(BuildNodeId(1, 1), BuildNodeId(1, 2)));
|
| +// Verifies when Embed() is invoked any child views are removed.
|
| +TEST_F(ViewManagerTest, ViewsRemovedWhenEmbedding) {
|
| + // Two views 1 and 2. 2 is parented to 1.
|
| + ASSERT_TRUE(connection_->CreateView(BuildViewId(1, 1)));
|
| + ASSERT_TRUE(connection_->CreateView(BuildViewId(1, 2)));
|
| + ASSERT_TRUE(connection_->AddView(BuildViewId(1, 1), BuildViewId(1, 2)));
|
|
|
| ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(false));
|
| - EXPECT_EQ("[node=1,1 parent=null]",
|
| - ChangeNodeDescription(connection2_->changes()));
|
| + EXPECT_EQ("[view=1,1 parent=null]",
|
| + ChangeViewDescription(connection2_->changes()));
|
|
|
| - // Embed() removed node 2.
|
| + // Embed() removed view 2.
|
| {
|
| - std::vector<TestNode> nodes;
|
| - connection_->GetNodeTree(BuildNodeId(1, 2), &nodes);
|
| - ASSERT_EQ(1u, nodes.size());
|
| - EXPECT_EQ("node=1,2 parent=null", nodes[0].ToString());
|
| + std::vector<TestView> views;
|
| + connection_->GetViewTree(BuildViewId(1, 2), &views);
|
| + ASSERT_EQ(1u, views.size());
|
| + EXPECT_EQ("view=1,2 parent=null", views[0].ToString());
|
| }
|
|
|
| - // |connection2_| should not see node 2.
|
| + // |connection2_| should not see view 2.
|
| {
|
| - std::vector<TestNode> nodes;
|
| - connection2_->GetNodeTree(BuildNodeId(1, 1), &nodes);
|
| - ASSERT_EQ(1u, nodes.size());
|
| - EXPECT_EQ("node=1,1 parent=null", nodes[0].ToString());
|
| + std::vector<TestView> views;
|
| + connection2_->GetViewTree(BuildViewId(1, 1), &views);
|
| + ASSERT_EQ(1u, views.size());
|
| + EXPECT_EQ("view=1,1 parent=null", views[0].ToString());
|
| }
|
| {
|
| - std::vector<TestNode> nodes;
|
| - connection2_->GetNodeTree(BuildNodeId(1, 2), &nodes);
|
| - EXPECT_TRUE(nodes.empty());
|
| + std::vector<TestView> views;
|
| + connection2_->GetViewTree(BuildViewId(1, 2), &views);
|
| + EXPECT_TRUE(views.empty());
|
| }
|
|
|
| - // Nodes 3 and 4 in connection 2.
|
| - ASSERT_TRUE(connection2_->CreateNode(BuildNodeId(2, 3)));
|
| - ASSERT_TRUE(connection2_->CreateNode(BuildNodeId(2, 4)));
|
| - ASSERT_TRUE(connection2_->AddNode(BuildNodeId(2, 3), BuildNodeId(2, 4)));
|
| + // Views 3 and 4 in connection 2.
|
| + ASSERT_TRUE(connection2_->CreateView(BuildViewId(2, 3)));
|
| + ASSERT_TRUE(connection2_->CreateView(BuildViewId(2, 4)));
|
| + ASSERT_TRUE(connection2_->AddView(BuildViewId(2, 3), BuildViewId(2, 4)));
|
|
|
| // Connection 3 rooted at 2.
|
| - ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(connection2_,
|
| - BuildNodeId(2, 3)));
|
| + ASSERT_NO_FATAL_FAILURE(
|
| + EstablishThirdConnection(connection2_, BuildViewId(2, 3)));
|
|
|
| - // Node 4 should no longer have a parent.
|
| + // View 4 should no longer have a parent.
|
| {
|
| - std::vector<TestNode> nodes;
|
| - connection2_->GetNodeTree(BuildNodeId(2, 3), &nodes);
|
| - ASSERT_EQ(1u, nodes.size());
|
| - EXPECT_EQ("node=2,3 parent=null", nodes[0].ToString());
|
| + std::vector<TestView> views;
|
| + connection2_->GetViewTree(BuildViewId(2, 3), &views);
|
| + ASSERT_EQ(1u, views.size());
|
| + EXPECT_EQ("view=2,3 parent=null", views[0].ToString());
|
|
|
| - nodes.clear();
|
| - connection2_->GetNodeTree(BuildNodeId(2, 4), &nodes);
|
| - ASSERT_EQ(1u, nodes.size());
|
| - EXPECT_EQ("node=2,4 parent=null", nodes[0].ToString());
|
| + views.clear();
|
| + connection2_->GetViewTree(BuildViewId(2, 4), &views);
|
| + ASSERT_EQ(1u, views.size());
|
| + EXPECT_EQ("view=2,4 parent=null", views[0].ToString());
|
| }
|
|
|
| - // And node 4 should not be visible to connection 3.
|
| + // And view 4 should not be visible to connection 3.
|
| {
|
| - std::vector<TestNode> nodes;
|
| - connection3_->GetNodeTree(BuildNodeId(2, 3), &nodes);
|
| - ASSERT_EQ(1u, nodes.size());
|
| - EXPECT_EQ("node=2,3 parent=null", nodes[0].ToString());
|
| + std::vector<TestView> views;
|
| + connection3_->GetViewTree(BuildViewId(2, 3), &views);
|
| + ASSERT_EQ(1u, views.size());
|
| + EXPECT_EQ("view=2,3 parent=null", views[0].ToString());
|
| }
|
| }
|
|
|
| // Verifies once Embed() has been invoked the parent connection can't see any
|
| // children.
|
| -TEST_F(ViewManagerTest, CantAccessChildrenOfEmbeddedNode) {
|
| +TEST_F(ViewManagerTest, CantAccessChildrenOfEmbeddedView) {
|
| ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true));
|
|
|
| - ASSERT_TRUE(connection2_->CreateNode(BuildNodeId(2, 2)));
|
| - ASSERT_TRUE(connection2_->AddNode(BuildNodeId(1, 1), BuildNodeId(2, 2)));
|
| + ASSERT_TRUE(connection2_->CreateView(BuildViewId(2, 2)));
|
| + ASSERT_TRUE(connection2_->AddView(BuildViewId(1, 1), BuildViewId(2, 2)));
|
|
|
| - ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(connection2_,
|
| - BuildNodeId(2, 2)));
|
| + ASSERT_NO_FATAL_FAILURE(
|
| + EstablishThirdConnection(connection2_, BuildViewId(2, 2)));
|
|
|
| - ASSERT_TRUE(connection3_->CreateNode(BuildNodeId(3, 3)));
|
| - ASSERT_TRUE(connection3_->AddNode(BuildNodeId(2, 2), BuildNodeId(3, 3)));
|
| + ASSERT_TRUE(connection3_->CreateView(BuildViewId(3, 3)));
|
| + ASSERT_TRUE(connection3_->AddView(BuildViewId(2, 2), BuildViewId(3, 3)));
|
|
|
| // Even though 3 is a child of 2 connection 2 can't see 3 as it's from a
|
| // different connection.
|
| {
|
| - std::vector<TestNode> nodes;
|
| - connection2_->GetNodeTree(BuildNodeId(2, 2), &nodes);
|
| - ASSERT_EQ(1u, nodes.size());
|
| - EXPECT_EQ("node=2,2 parent=1,1", nodes[0].ToString());
|
| + std::vector<TestView> views;
|
| + connection2_->GetViewTree(BuildViewId(2, 2), &views);
|
| + ASSERT_EQ(1u, views.size());
|
| + EXPECT_EQ("view=2,2 parent=1,1", views[0].ToString());
|
| }
|
|
|
| {
|
| - std::vector<TestNode> nodes;
|
| - connection2_->GetNodeTree(BuildNodeId(3, 3), &nodes);
|
| - EXPECT_TRUE(nodes.empty());
|
| + std::vector<TestView> views;
|
| + connection2_->GetViewTree(BuildViewId(3, 3), &views);
|
| + EXPECT_TRUE(views.empty());
|
| }
|
|
|
| - // Connection 2 shouldn't be able to get node 3 at all.
|
| + // Connection 2 shouldn't be able to get view 3 at all.
|
| {
|
| - std::vector<TestNode> nodes;
|
| - connection2_->GetNodeTree(BuildNodeId(3, 3), &nodes);
|
| - EXPECT_TRUE(nodes.empty());
|
| + std::vector<TestView> views;
|
| + connection2_->GetViewTree(BuildViewId(3, 3), &views);
|
| + EXPECT_TRUE(views.empty());
|
| }
|
|
|
| // Connection 1 should be able to see it all (its the root).
|
| {
|
| - std::vector<TestNode> nodes;
|
| - connection_->GetNodeTree(BuildNodeId(1, 1), &nodes);
|
| - ASSERT_EQ(3u, nodes.size());
|
| - EXPECT_EQ("node=1,1 parent=null", nodes[0].ToString());
|
| - EXPECT_EQ("node=2,2 parent=1,1", nodes[1].ToString());
|
| - EXPECT_EQ("node=3,3 parent=2,2", nodes[2].ToString());
|
| + std::vector<TestView> views;
|
| + connection_->GetViewTree(BuildViewId(1, 1), &views);
|
| + ASSERT_EQ(3u, views.size());
|
| + EXPECT_EQ("view=1,1 parent=null", views[0].ToString());
|
| + EXPECT_EQ("view=2,2 parent=1,1", views[1].ToString());
|
| + EXPECT_EQ("view=3,3 parent=2,2", views[2].ToString());
|
| }
|
| }
|
|
|
| // Verifies once Embed() has been invoked the parent can't mutate the children.
|
| -TEST_F(ViewManagerTest, CantModifyChildrenOfEmbeddedNode) {
|
| +TEST_F(ViewManagerTest, CantModifyChildrenOfEmbeddedView) {
|
| ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true));
|
|
|
| - ASSERT_TRUE(connection2_->CreateNode(BuildNodeId(2, 2)));
|
| - ASSERT_TRUE(connection2_->AddNode(BuildNodeId(1, 1), BuildNodeId(2, 2)));
|
| + ASSERT_TRUE(connection2_->CreateView(BuildViewId(2, 2)));
|
| + ASSERT_TRUE(connection2_->AddView(BuildViewId(1, 1), BuildViewId(2, 2)));
|
|
|
| - ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(connection2_,
|
| - BuildNodeId(2, 2)));
|
| + ASSERT_NO_FATAL_FAILURE(
|
| + EstablishThirdConnection(connection2_, BuildViewId(2, 2)));
|
|
|
| - ASSERT_TRUE(connection2_->CreateNode(BuildNodeId(2, 3)));
|
| - // Connection 2 shouldn't be able to add anything to the node anymore.
|
| - ASSERT_FALSE(connection2_->AddNode(BuildNodeId(2, 2), BuildNodeId(2, 3)));
|
| + ASSERT_TRUE(connection2_->CreateView(BuildViewId(2, 3)));
|
| + // Connection 2 shouldn't be able to add anything to the view anymore.
|
| + ASSERT_FALSE(connection2_->AddView(BuildViewId(2, 2), BuildViewId(2, 3)));
|
|
|
| - // Create node 3 in connection 3 and add it to node 3.
|
| - ASSERT_TRUE(connection3_->CreateNode(BuildNodeId(3, 3)));
|
| - ASSERT_TRUE(connection3_->AddNode(BuildNodeId(2, 2), BuildNodeId(3, 3)));
|
| + // Create view 3 in connection 3 and add it to view 3.
|
| + ASSERT_TRUE(connection3_->CreateView(BuildViewId(3, 3)));
|
| + ASSERT_TRUE(connection3_->AddView(BuildViewId(2, 2), BuildViewId(3, 3)));
|
|
|
| - // Connection 2 shouldn't be able to remove node 3.
|
| - ASSERT_FALSE(connection2_->RemoveNodeFromParent(BuildNodeId(3, 3)));
|
| + // Connection 2 shouldn't be able to remove view 3.
|
| + ASSERT_FALSE(connection2_->RemoveViewFromParent(BuildViewId(3, 3)));
|
| }
|
|
|
| // Verifies client gets a valid id.
|
| -TEST_F(ViewManagerTest, CreateNode) {
|
| - ASSERT_TRUE(connection_->CreateNode(BuildNodeId(1, 1)));
|
| +TEST_F(ViewManagerTest, CreateView) {
|
| + ASSERT_TRUE(connection_->CreateView(BuildViewId(1, 1)));
|
| EXPECT_TRUE(connection_->changes().empty());
|
|
|
| - // Can't create a node with the same id.
|
| + // Can't create a view with the same id.
|
| ASSERT_EQ(ERROR_CODE_VALUE_IN_USE,
|
| - connection_->CreateNodeWithErrorCode(BuildNodeId(1, 1)));
|
| + connection_->CreateViewWithErrorCode(BuildViewId(1, 1)));
|
| EXPECT_TRUE(connection_->changes().empty());
|
|
|
| - // Can't create a node with a bogus connection id.
|
| + // Can't create a view with a bogus connection id.
|
| EXPECT_EQ(ERROR_CODE_ILLEGAL_ARGUMENT,
|
| - connection_->CreateNodeWithErrorCode(BuildNodeId(2, 1)));
|
| + connection_->CreateViewWithErrorCode(BuildViewId(2, 1)));
|
| EXPECT_TRUE(connection_->changes().empty());
|
| }
|
|
|
| -// Verifies AddNode fails when node is already in position.
|
| -TEST_F(ViewManagerTest, AddNodeWithNoChange) {
|
| - ASSERT_TRUE(connection_->CreateNode(BuildNodeId(1, 2)));
|
| - ASSERT_TRUE(connection_->CreateNode(BuildNodeId(1, 3)));
|
| +// Verifies AddView fails when view is already in position.
|
| +TEST_F(ViewManagerTest, AddViewWithNoChange) {
|
| + ASSERT_TRUE(connection_->CreateView(BuildViewId(1, 2)));
|
| + ASSERT_TRUE(connection_->CreateView(BuildViewId(1, 3)));
|
|
|
| ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true));
|
|
|
| // Make 3 a child of 2.
|
| - ASSERT_TRUE(connection_->AddNode(BuildNodeId(1, 2), BuildNodeId(1, 3)));
|
| + ASSERT_TRUE(connection_->AddView(BuildViewId(1, 2), BuildViewId(1, 3)));
|
|
|
| // Try again, this should fail.
|
| - EXPECT_FALSE(connection_->AddNode(BuildNodeId(1, 2), BuildNodeId(1, 3)));
|
| + EXPECT_FALSE(connection_->AddView(BuildViewId(1, 2), BuildViewId(1, 3)));
|
| }
|
|
|
| -// Verifies AddNode fails when node is already in position.
|
| +// Verifies AddView fails when view is already in position.
|
| TEST_F(ViewManagerTest, AddAncestorFails) {
|
| - ASSERT_TRUE(connection_->CreateNode(BuildNodeId(1, 2)));
|
| - ASSERT_TRUE(connection_->CreateNode(BuildNodeId(1, 3)));
|
| + ASSERT_TRUE(connection_->CreateView(BuildViewId(1, 2)));
|
| + ASSERT_TRUE(connection_->CreateView(BuildViewId(1, 3)));
|
|
|
| ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true));
|
|
|
| // Make 3 a child of 2.
|
| - ASSERT_TRUE(connection_->AddNode(BuildNodeId(1, 2), BuildNodeId(1, 3)));
|
| + ASSERT_TRUE(connection_->AddView(BuildViewId(1, 2), BuildViewId(1, 3)));
|
|
|
| // Try to make 2 a child of 3, this should fail since 2 is an ancestor of 3.
|
| - EXPECT_FALSE(connection_->AddNode(BuildNodeId(1, 3), BuildNodeId(1, 2)));
|
| + EXPECT_FALSE(connection_->AddView(BuildViewId(1, 3), BuildViewId(1, 2)));
|
| }
|
|
|
| // Verifies adding to root sends right notifications.
|
| TEST_F(ViewManagerTest, AddToRoot) {
|
| - ASSERT_TRUE(connection_->CreateNode(BuildNodeId(1, 21)));
|
| - ASSERT_TRUE(connection_->CreateNode(BuildNodeId(1, 3)));
|
| + ASSERT_TRUE(connection_->CreateView(BuildViewId(1, 21)));
|
| + ASSERT_TRUE(connection_->CreateView(BuildViewId(1, 3)));
|
|
|
| ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true));
|
|
|
| // Make 3 a child of 21.
|
| - ASSERT_TRUE(connection_->AddNode(BuildNodeId(1, 21), BuildNodeId(1, 3)));
|
| + ASSERT_TRUE(connection_->AddView(BuildViewId(1, 21), BuildViewId(1, 3)));
|
|
|
| // Make 21 a child of 1.
|
| - ASSERT_TRUE(connection_->AddNode(BuildNodeId(1, 1), BuildNodeId(1, 21)));
|
| + ASSERT_TRUE(connection_->AddView(BuildViewId(1, 1), BuildViewId(1, 21)));
|
|
|
| - // Connection 2 should not be told anything (because the node is from a
|
| - // different connection). Create a node to ensure we got a response from
|
| + // Connection 2 should not be told anything (because the view is from a
|
| + // different connection). Create a view to ensure we got a response from
|
| // the server.
|
| - ASSERT_TRUE(connection2_->CreateNode(BuildNodeId(2, 100)));
|
| + ASSERT_TRUE(connection2_->CreateView(BuildViewId(2, 100)));
|
| connection2_->CopyChangesFromTracker();
|
| EXPECT_TRUE(connection2_->changes().empty());
|
| }
|
|
|
| // Verifies HierarchyChanged is correctly sent for various adds/removes.
|
| -TEST_F(ViewManagerTest, NodeHierarchyChangedNodes) {
|
| +TEST_F(ViewManagerTest, ViewHierarchyChangedViews) {
|
| // 1,2->1,11.
|
| - ASSERT_TRUE(connection_->CreateNode(BuildNodeId(1, 2)));
|
| - ASSERT_TRUE(connection_->CreateNode(BuildNodeId(1, 11)));
|
| - ASSERT_TRUE(connection_->AddNode(BuildNodeId(1, 2), BuildNodeId(1, 11)));
|
| + ASSERT_TRUE(connection_->CreateView(BuildViewId(1, 2)));
|
| + ASSERT_TRUE(connection_->CreateView(BuildViewId(1, 11)));
|
| + ASSERT_TRUE(connection_->AddView(BuildViewId(1, 2), BuildViewId(1, 11)));
|
|
|
| ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true));
|
|
|
| @@ -764,8 +772,8 @@ TEST_F(ViewManagerTest, NodeHierarchyChangedNodes) {
|
| {
|
| // Client 2 should not get anything (1,2 is from another connection).
|
| connection2_->ClearChanges();
|
| - ASSERT_TRUE(connection_->AddNode(BuildNodeId(1, 1), BuildNodeId(1, 2)));
|
| - ASSERT_TRUE(connection2_->CreateNode(BuildNodeId(2, 100)));
|
| + ASSERT_TRUE(connection_->AddView(BuildViewId(1, 1), BuildViewId(1, 2)));
|
| + ASSERT_TRUE(connection2_->CreateView(BuildViewId(2, 100)));
|
| connection2_->CopyChangesFromTracker();
|
| EXPECT_TRUE(connection2_->changes().empty());
|
| }
|
| @@ -774,8 +782,8 @@ TEST_F(ViewManagerTest, NodeHierarchyChangedNodes) {
|
| {
|
| // Again, client 2 should not get anything.
|
| connection2_->ClearChanges();
|
| - ASSERT_TRUE(connection_->AddNode(BuildNodeId(0, 1), BuildNodeId(1, 1)));
|
| - ASSERT_TRUE(connection2_->CreateNode(BuildNodeId(2, 101)));
|
| + ASSERT_TRUE(connection_->AddView(BuildViewId(0, 1), BuildViewId(1, 1)));
|
| + ASSERT_TRUE(connection2_->CreateView(BuildViewId(2, 101)));
|
| connection2_->CopyChangesFromTracker();
|
| EXPECT_TRUE(connection2_->changes().empty());
|
| }
|
| @@ -783,19 +791,19 @@ TEST_F(ViewManagerTest, NodeHierarchyChangedNodes) {
|
| // 1,1->1,2->1,11.
|
| {
|
| connection2_->ClearChanges();
|
| - ASSERT_TRUE(connection_->RemoveNodeFromParent(BuildNodeId(1, 1)));
|
| + ASSERT_TRUE(connection_->RemoveViewFromParent(BuildViewId(1, 1)));
|
| EXPECT_TRUE(connection_->changes().empty());
|
| - ASSERT_TRUE(connection2_->CreateNode(BuildNodeId(2, 102)));
|
| + ASSERT_TRUE(connection2_->CreateView(BuildViewId(2, 102)));
|
| connection2_->CopyChangesFromTracker();
|
| EXPECT_TRUE(connection2_->changes().empty());
|
| }
|
|
|
| // 1,1->1,2->1,11->1,111.
|
| - ASSERT_TRUE(connection_->CreateNode(BuildNodeId(1, 111)));
|
| + ASSERT_TRUE(connection_->CreateView(BuildViewId(1, 111)));
|
| {
|
| connection2_->ClearChanges();
|
| - ASSERT_TRUE(connection_->AddNode(BuildNodeId(1, 11), BuildNodeId(1, 111)));
|
| - ASSERT_TRUE(connection2_->CreateNode(BuildNodeId(2, 103)));
|
| + ASSERT_TRUE(connection_->AddView(BuildViewId(1, 11), BuildViewId(1, 111)));
|
| + ASSERT_TRUE(connection2_->CreateView(BuildViewId(2, 103)));
|
| connection2_->CopyChangesFromTracker();
|
| EXPECT_TRUE(connection2_->changes().empty());
|
| }
|
| @@ -803,474 +811,471 @@ TEST_F(ViewManagerTest, NodeHierarchyChangedNodes) {
|
| // 0,1->1,1->1,2->1,11->1,111
|
| {
|
| connection2_->ClearChanges();
|
| - ASSERT_TRUE(connection_->AddNode(BuildNodeId(0, 1), BuildNodeId(1, 1)));
|
| - ASSERT_TRUE(connection2_->CreateNode(BuildNodeId(2, 104)));
|
| + ASSERT_TRUE(connection_->AddView(BuildViewId(0, 1), BuildViewId(1, 1)));
|
| + ASSERT_TRUE(connection2_->CreateView(BuildViewId(2, 104)));
|
| connection2_->CopyChangesFromTracker();
|
| EXPECT_TRUE(connection2_->changes().empty());
|
| }
|
| }
|
|
|
| -TEST_F(ViewManagerTest, NodeHierarchyChangedAddingKnownToUnknown) {
|
| +TEST_F(ViewManagerTest, ViewHierarchyChangedAddingKnownToUnknown) {
|
| // Create the following structure: root -> 1 -> 11 and 2->21 (2 has no
|
| // parent).
|
| ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true));
|
|
|
| - ASSERT_TRUE(connection2_->CreateNode(BuildNodeId(2, 11)));
|
| - ASSERT_TRUE(connection2_->CreateNode(BuildNodeId(2, 2)));
|
| - ASSERT_TRUE(connection2_->CreateNode(BuildNodeId(2, 21)));
|
| + ASSERT_TRUE(connection2_->CreateView(BuildViewId(2, 11)));
|
| + ASSERT_TRUE(connection2_->CreateView(BuildViewId(2, 2)));
|
| + ASSERT_TRUE(connection2_->CreateView(BuildViewId(2, 21)));
|
|
|
| // Set up the hierarchy.
|
| - ASSERT_TRUE(connection_->AddNode(BuildNodeId(0, 1), BuildNodeId(1, 1)));
|
| - ASSERT_TRUE(connection2_->AddNode(BuildNodeId(1, 1), BuildNodeId(2, 11)));
|
| - ASSERT_TRUE(connection2_->AddNode(BuildNodeId(2, 2), BuildNodeId(2, 21)));
|
| + ASSERT_TRUE(connection_->AddView(BuildViewId(0, 1), BuildViewId(1, 1)));
|
| + ASSERT_TRUE(connection2_->AddView(BuildViewId(1, 1), BuildViewId(2, 11)));
|
| + ASSERT_TRUE(connection2_->AddView(BuildViewId(2, 2), BuildViewId(2, 21)));
|
|
|
| // Remove 11, should result in a hierarchy change for the root.
|
| {
|
| connection_->ClearChanges();
|
| - ASSERT_TRUE(connection2_->RemoveNodeFromParent(BuildNodeId(2, 11)));
|
| + ASSERT_TRUE(connection2_->RemoveViewFromParent(BuildViewId(2, 11)));
|
|
|
| connection_->DoRunLoopUntilChangesCount(1);
|
| const Changes changes(ChangesToDescription1(connection_->changes()));
|
| ASSERT_EQ(1u, changes.size());
|
| - EXPECT_EQ("HierarchyChanged node=2,11 new_parent=null old_parent=1,1",
|
| + EXPECT_EQ("HierarchyChanged view=2,11 new_parent=null old_parent=1,1",
|
| changes[0]);
|
| }
|
|
|
| // Add 2 to 1.
|
| {
|
| - ASSERT_TRUE(connection2_->AddNode(BuildNodeId(1, 1), BuildNodeId(2, 2)));
|
| + ASSERT_TRUE(connection2_->AddView(BuildViewId(1, 1), BuildViewId(2, 2)));
|
|
|
| connection_->DoRunLoopUntilChangesCount(1);
|
| const Changes changes(ChangesToDescription1(connection_->changes()));
|
| ASSERT_EQ(1u, changes.size());
|
| - EXPECT_EQ("HierarchyChanged node=2,2 new_parent=1,1 old_parent=null",
|
| + EXPECT_EQ("HierarchyChanged view=2,2 new_parent=1,1 old_parent=null",
|
| changes[0]);
|
| - EXPECT_EQ("[node=2,2 parent=1,1],"
|
| - "[node=2,21 parent=2,2]",
|
| - ChangeNodeDescription(connection_->changes()));
|
| + EXPECT_EQ(
|
| + "[view=2,2 parent=1,1],"
|
| + "[view=2,21 parent=2,2]",
|
| + ChangeViewDescription(connection_->changes()));
|
| }
|
| }
|
|
|
| -TEST_F(ViewManagerTest, ReorderNode) {
|
| +TEST_F(ViewManagerTest, ReorderView) {
|
| ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true));
|
|
|
| - Id node1_id = BuildNodeId(2, 1);
|
| - Id node2_id = BuildNodeId(2, 2);
|
| - Id node3_id = BuildNodeId(2, 3);
|
| - Id node4_id = BuildNodeId(1, 4); // Peer to 1,1
|
| - Id node5_id = BuildNodeId(1, 5); // Peer to 1,1
|
| - Id node6_id = BuildNodeId(2, 6); // Child of 1,2.
|
| - Id node7_id = BuildNodeId(2, 7); // Unparented.
|
| - Id node8_id = BuildNodeId(2, 8); // Unparented.
|
| - ASSERT_TRUE(connection2_->CreateNode(node1_id));
|
| - ASSERT_TRUE(connection2_->CreateNode(node2_id));
|
| - ASSERT_TRUE(connection2_->CreateNode(node3_id));
|
| - ASSERT_TRUE(connection_->CreateNode(node4_id));
|
| - ASSERT_TRUE(connection_->CreateNode(node5_id));
|
| - ASSERT_TRUE(connection2_->CreateNode(node6_id));
|
| - ASSERT_TRUE(connection2_->CreateNode(node7_id));
|
| - ASSERT_TRUE(connection2_->CreateNode(node8_id));
|
| - ASSERT_TRUE(connection2_->AddNode(node1_id, node2_id));
|
| - ASSERT_TRUE(connection2_->AddNode(node2_id, node6_id));
|
| - ASSERT_TRUE(connection2_->AddNode(node1_id, node3_id));
|
| - ASSERT_TRUE(connection_->AddNode(
|
| - NodeIdToTransportId(RootNodeId()), node4_id));
|
| - ASSERT_TRUE(connection_->AddNode(
|
| - NodeIdToTransportId(RootNodeId()), node5_id));
|
| -
|
| - ASSERT_TRUE(connection_->AddNode(
|
| - NodeIdToTransportId(RootNodeId()), node1_id));
|
| + Id view1_id = BuildViewId(2, 1);
|
| + Id view2_id = BuildViewId(2, 2);
|
| + Id view3_id = BuildViewId(2, 3);
|
| + Id view4_id = BuildViewId(1, 4); // Peer to 1,1
|
| + Id view5_id = BuildViewId(1, 5); // Peer to 1,1
|
| + Id view6_id = BuildViewId(2, 6); // Child of 1,2.
|
| + Id view7_id = BuildViewId(2, 7); // Unparented.
|
| + Id view8_id = BuildViewId(2, 8); // Unparented.
|
| + ASSERT_TRUE(connection2_->CreateView(view1_id));
|
| + ASSERT_TRUE(connection2_->CreateView(view2_id));
|
| + ASSERT_TRUE(connection2_->CreateView(view3_id));
|
| + ASSERT_TRUE(connection_->CreateView(view4_id));
|
| + ASSERT_TRUE(connection_->CreateView(view5_id));
|
| + ASSERT_TRUE(connection2_->CreateView(view6_id));
|
| + ASSERT_TRUE(connection2_->CreateView(view7_id));
|
| + ASSERT_TRUE(connection2_->CreateView(view8_id));
|
| + ASSERT_TRUE(connection2_->AddView(view1_id, view2_id));
|
| + ASSERT_TRUE(connection2_->AddView(view2_id, view6_id));
|
| + ASSERT_TRUE(connection2_->AddView(view1_id, view3_id));
|
| + ASSERT_TRUE(
|
| + connection_->AddView(ViewIdToTransportId(RootViewId()), view4_id));
|
| + ASSERT_TRUE(
|
| + connection_->AddView(ViewIdToTransportId(RootViewId()), view5_id));
|
| +
|
| + ASSERT_TRUE(
|
| + connection_->AddView(ViewIdToTransportId(RootViewId()), view1_id));
|
|
|
| {
|
| ASSERT_TRUE(
|
| - connection2_->ReorderNode(node2_id, node3_id, ORDER_DIRECTION_ABOVE));
|
| + connection2_->ReorderView(view2_id, view3_id, ORDER_DIRECTION_ABOVE));
|
|
|
| connection_->DoRunLoopUntilChangesCount(1);
|
| const Changes changes(ChangesToDescription1(connection_->changes()));
|
| ASSERT_EQ(1u, changes.size());
|
| - EXPECT_EQ("Reordered node=2,2 relative=2,3 direction=above",
|
| - changes[0]);
|
| + EXPECT_EQ("Reordered view=2,2 relative=2,3 direction=above", changes[0]);
|
| }
|
|
|
| {
|
| - ASSERT_TRUE(connection2_->ReorderNode(
|
| - node2_id, node3_id, ORDER_DIRECTION_BELOW));
|
| + ASSERT_TRUE(
|
| + connection2_->ReorderView(view2_id, view3_id, ORDER_DIRECTION_BELOW));
|
|
|
| connection_->DoRunLoopUntilChangesCount(1);
|
| const Changes changes(ChangesToDescription1(connection_->changes()));
|
| ASSERT_EQ(1u, changes.size());
|
| - EXPECT_EQ("Reordered node=2,2 relative=2,3 direction=below",
|
| - changes[0]);
|
| + EXPECT_EQ("Reordered view=2,2 relative=2,3 direction=below", changes[0]);
|
| }
|
|
|
| - // node2 is already below node3.
|
| + // view2 is already below view3.
|
| EXPECT_FALSE(
|
| - connection2_->ReorderNode(node2_id, node3_id, ORDER_DIRECTION_BELOW));
|
| + connection2_->ReorderView(view2_id, view3_id, ORDER_DIRECTION_BELOW));
|
|
|
| - // node4 & 5 are unknown to connection2_.
|
| - EXPECT_FALSE(connection2_->ReorderNode(
|
| - node4_id, node5_id, ORDER_DIRECTION_ABOVE));
|
| + // view4 & 5 are unknown to connection2_.
|
| + EXPECT_FALSE(
|
| + connection2_->ReorderView(view4_id, view5_id, ORDER_DIRECTION_ABOVE));
|
|
|
| - // node6 & node3 have different parents.
|
| + // view6 & view3 have different parents.
|
| EXPECT_FALSE(
|
| - connection_->ReorderNode(node3_id, node6_id, ORDER_DIRECTION_ABOVE));
|
| + connection_->ReorderView(view3_id, view6_id, ORDER_DIRECTION_ABOVE));
|
|
|
| - // Non-existent node-ids
|
| - EXPECT_FALSE(connection_->ReorderNode(
|
| - BuildNodeId(1, 27), BuildNodeId(1, 28), ORDER_DIRECTION_ABOVE));
|
| + // Non-existent view-ids
|
| + EXPECT_FALSE(connection_->ReorderView(
|
| + BuildViewId(1, 27), BuildViewId(1, 28), ORDER_DIRECTION_ABOVE));
|
|
|
| - // node7 & node8 are un-parented.
|
| + // view7 & view8 are un-parented.
|
| EXPECT_FALSE(
|
| - connection_->ReorderNode(node7_id, node8_id, ORDER_DIRECTION_ABOVE));
|
| + connection_->ReorderView(view7_id, view8_id, ORDER_DIRECTION_ABOVE));
|
| }
|
|
|
| -// Verifies DeleteNode works.
|
| -TEST_F(ViewManagerTest, DeleteNode) {
|
| +// Verifies DeleteView works.
|
| +TEST_F(ViewManagerTest, DeleteView) {
|
| ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true));
|
| - ASSERT_TRUE(connection2_->CreateNode(BuildNodeId(2, 2)));
|
| + ASSERT_TRUE(connection2_->CreateView(BuildViewId(2, 2)));
|
|
|
| // Make 2 a child of 1.
|
| {
|
| - ASSERT_TRUE(connection2_->AddNode(BuildNodeId(1, 1), BuildNodeId(2, 2)));
|
| + ASSERT_TRUE(connection2_->AddView(BuildViewId(1, 1), BuildViewId(2, 2)));
|
| connection_->DoRunLoopUntilChangesCount(1);
|
| const Changes changes(ChangesToDescription1(connection_->changes()));
|
| ASSERT_EQ(1u, changes.size());
|
| - EXPECT_EQ("HierarchyChanged node=2,2 new_parent=1,1 old_parent=null",
|
| + EXPECT_EQ("HierarchyChanged view=2,2 new_parent=1,1 old_parent=null",
|
| changes[0]);
|
| }
|
|
|
| // Delete 2.
|
| {
|
| - ASSERT_TRUE(connection2_->DeleteNode(BuildNodeId(2, 2)));
|
| + ASSERT_TRUE(connection2_->DeleteView(BuildViewId(2, 2)));
|
| EXPECT_TRUE(connection2_->changes().empty());
|
|
|
| connection_->DoRunLoopUntilChangesCount(1);
|
| const Changes changes(ChangesToDescription1(connection_->changes()));
|
| ASSERT_EQ(1u, changes.size());
|
| - EXPECT_EQ("NodeDeleted node=2,2", changes[0]);
|
| + EXPECT_EQ("ViewDeleted view=2,2", changes[0]);
|
| }
|
| }
|
|
|
| -// Verifies DeleteNode isn't allowed from a separate connection.
|
| -TEST_F(ViewManagerTest, DeleteNodeFromAnotherConnectionDisallowed) {
|
| +// Verifies DeleteView isn't allowed from a separate connection.
|
| +TEST_F(ViewManagerTest, DeleteViewFromAnotherConnectionDisallowed) {
|
| ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true));
|
| - EXPECT_FALSE(connection2_->DeleteNode(BuildNodeId(1, 1)));
|
| + EXPECT_FALSE(connection2_->DeleteView(BuildViewId(1, 1)));
|
| }
|
|
|
| -// Verifies if a node was deleted and then reused that other clients are
|
| +// Verifies if a view was deleted and then reused that other clients are
|
| // properly notified.
|
| -TEST_F(ViewManagerTest, ReuseDeletedNodeId) {
|
| +TEST_F(ViewManagerTest, ReuseDeletedViewId) {
|
| ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true));
|
| - ASSERT_TRUE(connection2_->CreateNode(BuildNodeId(2, 2)));
|
| + ASSERT_TRUE(connection2_->CreateView(BuildViewId(2, 2)));
|
|
|
| // Add 2 to 1.
|
| {
|
| - ASSERT_TRUE(connection2_->AddNode(BuildNodeId(1, 1), BuildNodeId(2, 2)));
|
| + ASSERT_TRUE(connection2_->AddView(BuildViewId(1, 1), BuildViewId(2, 2)));
|
|
|
| connection_->DoRunLoopUntilChangesCount(1);
|
| const Changes changes(ChangesToDescription1(connection_->changes()));
|
| - EXPECT_EQ("HierarchyChanged node=2,2 new_parent=1,1 old_parent=null",
|
| + EXPECT_EQ("HierarchyChanged view=2,2 new_parent=1,1 old_parent=null",
|
| changes[0]);
|
| - EXPECT_EQ("[node=2,2 parent=1,1]",
|
| - ChangeNodeDescription(connection_->changes()));
|
| + EXPECT_EQ("[view=2,2 parent=1,1]",
|
| + ChangeViewDescription(connection_->changes()));
|
| }
|
|
|
| // Delete 2.
|
| {
|
| - ASSERT_TRUE(connection2_->DeleteNode(BuildNodeId(2, 2)));
|
| + ASSERT_TRUE(connection2_->DeleteView(BuildViewId(2, 2)));
|
|
|
| connection_->DoRunLoopUntilChangesCount(1);
|
| const Changes changes(ChangesToDescription1(connection_->changes()));
|
| ASSERT_EQ(1u, changes.size());
|
| - EXPECT_EQ("NodeDeleted node=2,2", changes[0]);
|
| + EXPECT_EQ("ViewDeleted view=2,2", changes[0]);
|
| }
|
|
|
| // Create 2 again, and add it back to 1. Should get the same notification.
|
| - ASSERT_TRUE(connection2_->CreateNode(BuildNodeId(2, 2)));
|
| + ASSERT_TRUE(connection2_->CreateView(BuildViewId(2, 2)));
|
| {
|
| - ASSERT_TRUE(connection2_->AddNode(BuildNodeId(1, 1), BuildNodeId(2, 2)));
|
| + ASSERT_TRUE(connection2_->AddView(BuildViewId(1, 1), BuildViewId(2, 2)));
|
|
|
| connection_->DoRunLoopUntilChangesCount(1);
|
| const Changes changes(ChangesToDescription1(connection_->changes()));
|
| - EXPECT_EQ("HierarchyChanged node=2,2 new_parent=1,1 old_parent=null",
|
| + EXPECT_EQ("HierarchyChanged view=2,2 new_parent=1,1 old_parent=null",
|
| changes[0]);
|
| - EXPECT_EQ("[node=2,2 parent=1,1]",
|
| - ChangeNodeDescription(connection_->changes()));
|
| + EXPECT_EQ("[view=2,2 parent=1,1]",
|
| + ChangeViewDescription(connection_->changes()));
|
| }
|
| }
|
|
|
| -// Assertions for GetNodeTree.
|
| -TEST_F(ViewManagerTest, GetNodeTree) {
|
| +// Assertions for GetViewTree.
|
| +TEST_F(ViewManagerTest, GetViewTree) {
|
| ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true));
|
|
|
| // Create 11 in first connection and make it a child of 1.
|
| - ASSERT_TRUE(connection_->CreateNode(BuildNodeId(1, 11)));
|
| - ASSERT_TRUE(connection_->AddNode(BuildNodeId(0, 1), BuildNodeId(1, 1)));
|
| - ASSERT_TRUE(connection_->AddNode(BuildNodeId(1, 1), BuildNodeId(1, 11)));
|
| + ASSERT_TRUE(connection_->CreateView(BuildViewId(1, 11)));
|
| + ASSERT_TRUE(connection_->AddView(BuildViewId(0, 1), BuildViewId(1, 1)));
|
| + ASSERT_TRUE(connection_->AddView(BuildViewId(1, 1), BuildViewId(1, 11)));
|
|
|
| - // Create two nodes in second connection, 2 and 3, both children of 1.
|
| - ASSERT_TRUE(connection2_->CreateNode(BuildNodeId(2, 2)));
|
| - ASSERT_TRUE(connection2_->CreateNode(BuildNodeId(2, 3)));
|
| - ASSERT_TRUE(connection2_->AddNode(BuildNodeId(1, 1), BuildNodeId(2, 2)));
|
| - ASSERT_TRUE(connection2_->AddNode(BuildNodeId(1, 1), BuildNodeId(2, 3)));
|
| + // Create two views in second connection, 2 and 3, both children of 1.
|
| + ASSERT_TRUE(connection2_->CreateView(BuildViewId(2, 2)));
|
| + ASSERT_TRUE(connection2_->CreateView(BuildViewId(2, 3)));
|
| + ASSERT_TRUE(connection2_->AddView(BuildViewId(1, 1), BuildViewId(2, 2)));
|
| + ASSERT_TRUE(connection2_->AddView(BuildViewId(1, 1), BuildViewId(2, 3)));
|
|
|
| - // Verifies GetNodeTree() on the root. The root connection sees all.
|
| + // Verifies GetViewTree() on the root. The root connection sees all.
|
| {
|
| - std::vector<TestNode> nodes;
|
| - connection_->GetNodeTree(BuildNodeId(0, 1), &nodes);
|
| - ASSERT_EQ(5u, nodes.size());
|
| - EXPECT_EQ("node=0,1 parent=null", nodes[0].ToString());
|
| - EXPECT_EQ("node=1,1 parent=0,1", nodes[1].ToString());
|
| - EXPECT_EQ("node=1,11 parent=1,1", nodes[2].ToString());
|
| - EXPECT_EQ("node=2,2 parent=1,1", nodes[3].ToString());
|
| - EXPECT_EQ("node=2,3 parent=1,1", nodes[4].ToString());
|
| + std::vector<TestView> views;
|
| + connection_->GetViewTree(BuildViewId(0, 1), &views);
|
| + ASSERT_EQ(5u, views.size());
|
| + EXPECT_EQ("view=0,1 parent=null", views[0].ToString());
|
| + EXPECT_EQ("view=1,1 parent=0,1", views[1].ToString());
|
| + EXPECT_EQ("view=1,11 parent=1,1", views[2].ToString());
|
| + EXPECT_EQ("view=2,2 parent=1,1", views[3].ToString());
|
| + EXPECT_EQ("view=2,3 parent=1,1", views[4].ToString());
|
| }
|
|
|
| - // Verifies GetNodeTree() on the node 1,1. This does not include any children
|
| + // Verifies GetViewTree() on the view 1,1. This does not include any children
|
| // as they are not from this connection.
|
| {
|
| - std::vector<TestNode> nodes;
|
| - connection2_->GetNodeTree(BuildNodeId(1, 1), &nodes);
|
| - ASSERT_EQ(1u, nodes.size());
|
| - EXPECT_EQ("node=1,1 parent=null", nodes[0].ToString());
|
| + std::vector<TestView> views;
|
| + connection2_->GetViewTree(BuildViewId(1, 1), &views);
|
| + ASSERT_EQ(1u, views.size());
|
| + EXPECT_EQ("view=1,1 parent=null", views[0].ToString());
|
| }
|
|
|
| // Connection 2 shouldn't be able to get the root tree.
|
| {
|
| - std::vector<TestNode> nodes;
|
| - connection2_->GetNodeTree(BuildNodeId(0, 1), &nodes);
|
| - ASSERT_EQ(0u, nodes.size());
|
| + std::vector<TestView> views;
|
| + connection2_->GetViewTree(BuildViewId(0, 1), &views);
|
| + ASSERT_EQ(0u, views.size());
|
| }
|
| }
|
|
|
| -TEST_F(ViewManagerTest, SetNodeBounds) {
|
| - ASSERT_TRUE(connection_->CreateNode(BuildNodeId(1, 1)));
|
| - ASSERT_TRUE(connection_->AddNode(BuildNodeId(0, 1), BuildNodeId(1, 1)));
|
| +TEST_F(ViewManagerTest, SetViewBounds) {
|
| + ASSERT_TRUE(connection_->CreateView(BuildViewId(1, 1)));
|
| + ASSERT_TRUE(connection_->AddView(BuildViewId(0, 1), BuildViewId(1, 1)));
|
|
|
| ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(false));
|
|
|
| - ASSERT_TRUE(connection_->SetNodeBounds(BuildNodeId(1, 1),
|
| - gfx::Rect(0, 0, 100, 100)));
|
| + ASSERT_TRUE(
|
| + connection_->SetViewBounds(BuildViewId(1, 1), gfx::Rect(0, 0, 100, 100)));
|
|
|
| connection2_->DoRunLoopUntilChangesCount(1);
|
| const Changes changes(ChangesToDescription1(connection2_->changes()));
|
| ASSERT_EQ(1u, changes.size());
|
| - EXPECT_EQ("BoundsChanged node=1,1 old_bounds=0,0 0x0 new_bounds=0,0 100x100",
|
| + EXPECT_EQ("BoundsChanged view=1,1 old_bounds=0,0 0x0 new_bounds=0,0 100x100",
|
| changes[0]);
|
|
|
| - // Should not be possible to change the bounds of a node created by another
|
| + // Should not be possible to change the bounds of a view created by another
|
| // connection.
|
| - ASSERT_FALSE(connection2_->SetNodeBounds(BuildNodeId(1, 1),
|
| - gfx::Rect(0, 0, 0, 0)));
|
| + ASSERT_FALSE(
|
| + connection2_->SetViewBounds(BuildViewId(1, 1), gfx::Rect(0, 0, 0, 0)));
|
| }
|
|
|
| -// Verify AddNode fails when trying to manipulate nodes in other roots.
|
| -TEST_F(ViewManagerTest, CantMoveNodesFromOtherRoot) {
|
| +// Verify AddView fails when trying to manipulate views in other roots.
|
| +TEST_F(ViewManagerTest, CantMoveViewsFromOtherRoot) {
|
| // Create 1 and 2 in the first connection.
|
| - ASSERT_TRUE(connection_->CreateNode(BuildNodeId(1, 1)));
|
| - ASSERT_TRUE(connection_->CreateNode(BuildNodeId(1, 2)));
|
| + ASSERT_TRUE(connection_->CreateView(BuildViewId(1, 1)));
|
| + ASSERT_TRUE(connection_->CreateView(BuildViewId(1, 2)));
|
|
|
| ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(false));
|
|
|
| // Try to move 2 to be a child of 1 from connection 2. This should fail as 2
|
| // should not be able to access 1.
|
| - ASSERT_FALSE(connection2_->AddNode(BuildNodeId(1, 1), BuildNodeId(1, 2)));
|
| + ASSERT_FALSE(connection2_->AddView(BuildViewId(1, 1), BuildViewId(1, 2)));
|
|
|
| // Try to reparent 1 to the root. A connection is not allowed to reparent its
|
| // roots.
|
| - ASSERT_FALSE(connection2_->AddNode(BuildNodeId(0, 1), BuildNodeId(1, 1)));
|
| + ASSERT_FALSE(connection2_->AddView(BuildViewId(0, 1), BuildViewId(1, 1)));
|
| }
|
|
|
| -// Verify RemoveNodeFromParent fails for nodes that are descendants of the
|
| +// Verify RemoveViewFromParent fails for views that are descendants of the
|
| // roots.
|
| -TEST_F(ViewManagerTest, CantRemoveNodesInOtherRoots) {
|
| +TEST_F(ViewManagerTest, CantRemoveViewsInOtherRoots) {
|
| // Create 1 and 2 in the first connection and parent both to the root.
|
| - ASSERT_TRUE(connection_->CreateNode(BuildNodeId(1, 1)));
|
| - ASSERT_TRUE(connection_->CreateNode(BuildNodeId(1, 2)));
|
| + ASSERT_TRUE(connection_->CreateView(BuildViewId(1, 1)));
|
| + ASSERT_TRUE(connection_->CreateView(BuildViewId(1, 2)));
|
|
|
| - ASSERT_TRUE(connection_->AddNode(BuildNodeId(0, 1), BuildNodeId(1, 1)));
|
| - ASSERT_TRUE(connection_->AddNode(BuildNodeId(0, 1), BuildNodeId(1, 2)));
|
| + ASSERT_TRUE(connection_->AddView(BuildViewId(0, 1), BuildViewId(1, 1)));
|
| + ASSERT_TRUE(connection_->AddView(BuildViewId(0, 1), BuildViewId(1, 2)));
|
|
|
| // Establish the second connection and give it the root 1.
|
| ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(false));
|
|
|
| - // Connection 2 should not be able to remove node 2 or 1 from its parent.
|
| - ASSERT_FALSE(connection2_->RemoveNodeFromParent(BuildNodeId(1, 2)));
|
| - ASSERT_FALSE(connection2_->RemoveNodeFromParent(BuildNodeId(1, 1)));
|
| + // Connection 2 should not be able to remove view 2 or 1 from its parent.
|
| + ASSERT_FALSE(connection2_->RemoveViewFromParent(BuildViewId(1, 2)));
|
| + ASSERT_FALSE(connection2_->RemoveViewFromParent(BuildViewId(1, 1)));
|
|
|
| - // Create nodes 10 and 11 in 2.
|
| - ASSERT_TRUE(connection2_->CreateNode(BuildNodeId(2, 10)));
|
| - ASSERT_TRUE(connection2_->CreateNode(BuildNodeId(2, 11)));
|
| + // Create views 10 and 11 in 2.
|
| + ASSERT_TRUE(connection2_->CreateView(BuildViewId(2, 10)));
|
| + ASSERT_TRUE(connection2_->CreateView(BuildViewId(2, 11)));
|
|
|
| // Parent 11 to 10.
|
| - ASSERT_TRUE(connection2_->AddNode(BuildNodeId(2, 10), BuildNodeId(2, 11)));
|
| + ASSERT_TRUE(connection2_->AddView(BuildViewId(2, 10), BuildViewId(2, 11)));
|
| // Remove 11 from 10.
|
| - ASSERT_TRUE(connection2_->RemoveNodeFromParent( BuildNodeId(2, 11)));
|
| + ASSERT_TRUE(connection2_->RemoveViewFromParent(BuildViewId(2, 11)));
|
|
|
| // Verify nothing was actually removed.
|
| {
|
| - std::vector<TestNode> nodes;
|
| - connection_->GetNodeTree(BuildNodeId(0, 1), &nodes);
|
| - ASSERT_EQ(3u, nodes.size());
|
| - EXPECT_EQ("node=0,1 parent=null", nodes[0].ToString());
|
| - EXPECT_EQ("node=1,1 parent=0,1", nodes[1].ToString());
|
| - EXPECT_EQ("node=1,2 parent=0,1", nodes[2].ToString());
|
| + std::vector<TestView> views;
|
| + connection_->GetViewTree(BuildViewId(0, 1), &views);
|
| + ASSERT_EQ(3u, views.size());
|
| + EXPECT_EQ("view=0,1 parent=null", views[0].ToString());
|
| + EXPECT_EQ("view=1,1 parent=0,1", views[1].ToString());
|
| + EXPECT_EQ("view=1,2 parent=0,1", views[2].ToString());
|
| }
|
| }
|
|
|
| -// Verify GetNodeTree fails for nodes that are not descendants of the roots.
|
| -TEST_F(ViewManagerTest, CantGetNodeTreeOfOtherRoots) {
|
| +// Verify GetViewTree fails for views that are not descendants of the roots.
|
| +TEST_F(ViewManagerTest, CantGetViewTreeOfOtherRoots) {
|
| // Create 1 and 2 in the first connection and parent both to the root.
|
| - ASSERT_TRUE(connection_->CreateNode(BuildNodeId(1, 1)));
|
| - ASSERT_TRUE(connection_->CreateNode(BuildNodeId(1, 2)));
|
| + ASSERT_TRUE(connection_->CreateView(BuildViewId(1, 1)));
|
| + ASSERT_TRUE(connection_->CreateView(BuildViewId(1, 2)));
|
|
|
| - ASSERT_TRUE(connection_->AddNode(BuildNodeId(0, 1), BuildNodeId(1, 1)));
|
| - ASSERT_TRUE(connection_->AddNode(BuildNodeId(0, 1), BuildNodeId(1, 2)));
|
| + ASSERT_TRUE(connection_->AddView(BuildViewId(0, 1), BuildViewId(1, 1)));
|
| + ASSERT_TRUE(connection_->AddView(BuildViewId(0, 1), BuildViewId(1, 2)));
|
|
|
| ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(false));
|
|
|
| - std::vector<TestNode> nodes;
|
| + std::vector<TestView> views;
|
|
|
| // Should get nothing for the root.
|
| - connection2_->GetNodeTree(BuildNodeId(0, 1), &nodes);
|
| - ASSERT_TRUE(nodes.empty());
|
| + connection2_->GetViewTree(BuildViewId(0, 1), &views);
|
| + ASSERT_TRUE(views.empty());
|
|
|
| - // Should get nothing for node 2.
|
| - connection2_->GetNodeTree(BuildNodeId(1, 2), &nodes);
|
| - ASSERT_TRUE(nodes.empty());
|
| + // Should get nothing for view 2.
|
| + connection2_->GetViewTree(BuildViewId(1, 2), &views);
|
| + ASSERT_TRUE(views.empty());
|
|
|
| - // Should get node 1 if asked for.
|
| - connection2_->GetNodeTree(BuildNodeId(1, 1), &nodes);
|
| - ASSERT_EQ(1u, nodes.size());
|
| - EXPECT_EQ("node=1,1 parent=null", nodes[0].ToString());
|
| + // Should get view 1 if asked for.
|
| + connection2_->GetViewTree(BuildViewId(1, 1), &views);
|
| + ASSERT_EQ(1u, views.size());
|
| + EXPECT_EQ("view=1,1 parent=null", views[0].ToString());
|
| }
|
|
|
| TEST_F(ViewManagerTest, ConnectTwice) {
|
| - ASSERT_TRUE(connection_->CreateNode(BuildNodeId(1, 1)));
|
| - ASSERT_TRUE(connection_->CreateNode(BuildNodeId(1, 2)));
|
| + ASSERT_TRUE(connection_->CreateView(BuildViewId(1, 1)));
|
| + ASSERT_TRUE(connection_->CreateView(BuildViewId(1, 2)));
|
|
|
| ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(false));
|
|
|
| // Try to connect again to 1,1, this should fail as already connected to that
|
| // root.
|
| - ASSERT_FALSE(connection_->Embed(BuildNodeId(1, 1), kTestServiceURL));
|
| + ASSERT_FALSE(connection_->Embed(BuildViewId(1, 1), kTestServiceURL));
|
|
|
| // Connecting to 1,2 should succeed and end up in connection2.
|
| {
|
| - ASSERT_TRUE(connection_->Embed(BuildNodeId(1, 2), kTestServiceURL));
|
| + ASSERT_TRUE(connection_->Embed(BuildViewId(1, 2), kTestServiceURL));
|
| connection2_->DoRunLoopUntilChangesCount(1);
|
| const Changes changes(ChangesToDescription1(connection2_->changes()));
|
| ASSERT_EQ(1u, changes.size());
|
| EXPECT_EQ("OnEmbed creator=mojo:test_url", changes[0]);
|
| - EXPECT_EQ("[node=1,2 parent=null]",
|
| - ChangeNodeDescription(connection2_->changes()));
|
| + EXPECT_EQ("[view=1,2 parent=null]",
|
| + ChangeViewDescription(connection2_->changes()));
|
| }
|
| }
|
|
|
| -TEST_F(ViewManagerTest, OnNodeInput) {
|
| - ASSERT_TRUE(connection_->CreateNode(BuildNodeId(1, 1)));
|
| +TEST_F(ViewManagerTest, OnViewInput) {
|
| + ASSERT_TRUE(connection_->CreateView(BuildViewId(1, 1)));
|
| ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(false));
|
|
|
| - // Dispatch an event to the node and verify its received.
|
| + // Dispatch an event to the view and verify its received.
|
| {
|
| EventPtr event(Event::New());
|
| event->action = static_cast<EventType>(1);
|
| - connection_->view_manager()->DispatchOnViewInputEvent(
|
| - BuildNodeId(1, 1),
|
| - event.Pass());
|
| + connection_->view_manager()->DispatchOnViewInputEvent(BuildViewId(1, 1),
|
| + event.Pass());
|
| connection2_->DoRunLoopUntilChangesCount(1);
|
| const Changes changes(ChangesToDescription1(connection2_->changes()));
|
| ASSERT_EQ(1u, changes.size());
|
| - EXPECT_EQ("InputEvent node=1,1 event_action=1", changes[0]);
|
| + EXPECT_EQ("InputEvent view=1,1 event_action=1", changes[0]);
|
| }
|
| }
|
|
|
| -TEST_F(ViewManagerTest, EmbedWithSameNodeId) {
|
| +TEST_F(ViewManagerTest, EmbedWithSameViewId) {
|
| ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true));
|
|
|
| - ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(connection_,
|
| - BuildNodeId(1, 1)));
|
| + ASSERT_NO_FATAL_FAILURE(
|
| + EstablishThirdConnection(connection_, BuildViewId(1, 1)));
|
|
|
| - // Connection2 should have been told the node was deleted.
|
| + // Connection2 should have been told the view was deleted.
|
| {
|
| connection2_->DoRunLoopUntilChangesCount(1);
|
| const Changes changes(ChangesToDescription1(connection2_->changes()));
|
| ASSERT_EQ(1u, changes.size());
|
| - EXPECT_EQ("NodeDeleted node=1,1", changes[0]);
|
| + EXPECT_EQ("ViewDeleted view=1,1", changes[0]);
|
| }
|
|
|
| - // Connection2 has no root. Verify it can't see node 1,1 anymore.
|
| + // Connection2 has no root. Verify it can't see view 1,1 anymore.
|
| {
|
| - std::vector<TestNode> nodes;
|
| - connection2_->GetNodeTree(BuildNodeId(1, 1), &nodes);
|
| - EXPECT_TRUE(nodes.empty());
|
| + std::vector<TestView> views;
|
| + connection2_->GetViewTree(BuildViewId(1, 1), &views);
|
| + EXPECT_TRUE(views.empty());
|
| }
|
| }
|
|
|
| -TEST_F(ViewManagerTest, EmbedWithSameNodeId2) {
|
| +TEST_F(ViewManagerTest, EmbedWithSameViewId2) {
|
| ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true));
|
|
|
| - ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(connection_,
|
| - BuildNodeId(1, 1)));
|
| + ASSERT_NO_FATAL_FAILURE(
|
| + EstablishThirdConnection(connection_, BuildViewId(1, 1)));
|
|
|
| - // Connection2 should have been told the node was deleted.
|
| + // Connection2 should have been told the view was deleted.
|
| connection2_->DoRunLoopUntilChangesCount(1);
|
| connection2_->ClearChanges();
|
|
|
| - // Create a node in the third connection and parent it to the root.
|
| - ASSERT_TRUE(connection3_->CreateNode(BuildNodeId(3, 1)));
|
| - ASSERT_TRUE(connection3_->AddNode(BuildNodeId(1, 1), BuildNodeId(3, 1)));
|
| + // Create a view in the third connection and parent it to the root.
|
| + ASSERT_TRUE(connection3_->CreateView(BuildViewId(3, 1)));
|
| + ASSERT_TRUE(connection3_->AddView(BuildViewId(1, 1), BuildViewId(3, 1)));
|
|
|
| - // Connection 1 should have been told about the add (it owns the node).
|
| + // Connection 1 should have been told about the add (it owns the view).
|
| {
|
| connection_->DoRunLoopUntilChangesCount(1);
|
| const Changes changes(ChangesToDescription1(connection_->changes()));
|
| ASSERT_EQ(1u, changes.size());
|
| - EXPECT_EQ("HierarchyChanged node=3,1 new_parent=1,1 old_parent=null",
|
| + EXPECT_EQ("HierarchyChanged view=3,1 new_parent=1,1 old_parent=null",
|
| changes[0]);
|
| }
|
|
|
| // Embed 1,1 back in connection 2.
|
| {
|
| // 2 should be told about the new embed.
|
| - ASSERT_TRUE(connection_->Embed(BuildNodeId(1, 1), kTestServiceURL));
|
| + ASSERT_TRUE(connection_->Embed(BuildViewId(1, 1), kTestServiceURL));
|
| connection2_->DoRunLoopUntilChangesCount(1);
|
| const std::vector<Change>& changes(connection2_->changes());
|
| ASSERT_EQ(1u, changes.size());
|
| EXPECT_EQ("OnEmbed creator=mojo:test_url",
|
| ChangesToDescription1(changes)[0]);
|
| - EXPECT_EQ("[node=1,1 parent=null]",
|
| - ChangeNodeDescription(changes));
|
| + EXPECT_EQ("[view=1,1 parent=null]", ChangeViewDescription(changes));
|
|
|
| // And 3 should get a delete.
|
| connection3_->DoRunLoopUntilChangesCount(1);
|
| ASSERT_EQ(1u, connection3_->changes().size());
|
| - EXPECT_EQ("NodeDeleted node=1,1",
|
| + EXPECT_EQ("ViewDeleted view=1,1",
|
| ChangesToDescription1(connection3_->changes())[0]);
|
| }
|
|
|
| - // Connection3_ has no root. Verify it can't see node 1,1 anymore.
|
| + // Connection3_ has no root. Verify it can't see view 1,1 anymore.
|
| {
|
| - std::vector<TestNode> nodes;
|
| - connection3_->GetNodeTree(BuildNodeId(1, 1), &nodes);
|
| - EXPECT_TRUE(nodes.empty());
|
| + std::vector<TestView> views;
|
| + connection3_->GetViewTree(BuildViewId(1, 1), &views);
|
| + EXPECT_TRUE(views.empty());
|
| }
|
|
|
| // Verify 3,1 is no longer parented to 1,1. We have to do this from 1,1 as
|
| // connection3_ can no longer see 1,1.
|
| {
|
| - std::vector<TestNode> nodes;
|
| - connection_->GetNodeTree(BuildNodeId(1, 1), &nodes);
|
| - ASSERT_EQ(1u, nodes.size());
|
| - EXPECT_EQ("node=1,1 parent=null", nodes[0].ToString());
|
| + std::vector<TestView> views;
|
| + connection_->GetViewTree(BuildViewId(1, 1), &views);
|
| + ASSERT_EQ(1u, views.size());
|
| + EXPECT_EQ("view=1,1 parent=null", views[0].ToString());
|
| }
|
|
|
| - // Verify connection3_ can still see the node it created 3,1.
|
| + // Verify connection3_ can still see the view it created 3,1.
|
| {
|
| - std::vector<TestNode> nodes;
|
| - connection3_->GetNodeTree(BuildNodeId(3, 1), &nodes);
|
| - ASSERT_EQ(1u, nodes.size());
|
| - EXPECT_EQ("node=3,1 parent=null", nodes[0].ToString());
|
| + std::vector<TestView> views;
|
| + connection3_->GetViewTree(BuildViewId(3, 1), &views);
|
| + ASSERT_EQ(1u, views.size());
|
| + EXPECT_EQ("view=3,1 parent=null", views[0].ToString());
|
| }
|
| }
|
|
|
| @@ -1278,7 +1283,7 @@ TEST_F(ViewManagerTest, EmbedWithSameNodeId2) {
|
| // connections get deletion notification.
|
|
|
| // TODO(sky): need to better track changes to initial connection. For example,
|
| -// that SetBounsdNodes/AddNode and the like don't result in messages to the
|
| +// that SetBounsdViews/AddView and the like don't result in messages to the
|
| // originating connection.
|
|
|
| } // namespace service
|
|
|