Index: mojo/services/view_manager/view_manager_connection_unittest.cc |
diff --git a/mojo/services/view_manager/view_manager_connection_unittest.cc b/mojo/services/view_manager/view_manager_connection_unittest.cc |
index 8d8458d9a766457f8160c373d3643192bdd08bb0..a75e718119356197a3cf298aa20ab772372ad59d 100644 |
--- a/mojo/services/view_manager/view_manager_connection_unittest.cc |
+++ b/mojo/services/view_manager/view_manager_connection_unittest.cc |
@@ -10,7 +10,6 @@ |
#include "base/message_loop/message_loop.h" |
#include "base/run_loop.h" |
#include "base/strings/stringprintf.h" |
-#include "mojo/public/cpp/bindings/allocation_scope.h" |
#include "mojo/public/cpp/environment/environment.h" |
#include "mojo/public/cpp/shell/connect.h" |
#include "mojo/services/public/cpp/view_manager/util.h" |
@@ -62,13 +61,13 @@ struct TestNode { |
TransportNodeId view_id; |
}; |
-void INodesToTestNodes(const mojo::Array<INode>& data, |
+void INodesToTestNodes(const mojo::Array<INodePtr>& data, |
std::vector<TestNode>* test_nodes) { |
for (size_t i = 0; i < data.size(); ++i) { |
TestNode node; |
- node.parent_id = data[i].parent_id(); |
- node.node_id = data[i].node_id(); |
- node.view_id = data[i].view_id(); |
+ node.parent_id = data[i]->parent_id; |
+ node.node_id = data[i]->node_id; |
+ node.view_id = data[i]->view_id; |
test_nodes->push_back(node); |
} |
} |
@@ -76,7 +75,7 @@ void INodesToTestNodes(const mojo::Array<INode>& data, |
// Callback that results in a vector of INodes. The INodes are converted to |
// TestNodes. |
void INodesCallback(std::vector<TestNode>* test_nodes, |
- const mojo::Array<INode>& data) { |
+ mojo::Array<INodePtr> data) { |
INodesToTestNodes(data, test_nodes); |
current_run_loop->Quit(); |
} |
@@ -221,7 +220,7 @@ class ViewManagerClientImpl : public IViewManagerClient { |
virtual void OnConnectionEstablished( |
TransportConnectionId connection_id, |
TransportChangeId next_server_change_id, |
- const mojo::Array<INode>& nodes) OVERRIDE { |
+ mojo::Array<INodePtr> nodes) OVERRIDE { |
id_ = connection_id; |
next_server_change_id_ = next_server_change_id; |
INodesToTestNodes(nodes, &initial_nodes_); |
@@ -241,7 +240,7 @@ class ViewManagerClientImpl : public IViewManagerClient { |
TransportNodeId new_parent, |
TransportNodeId old_parent, |
TransportChangeId server_change_id, |
- const mojo::Array<INode>& nodes) OVERRIDE { |
+ mojo::Array<INodePtr> nodes) OVERRIDE { |
changes_.push_back( |
base::StringPrintf( |
"HierarchyChanged change_id=%d node=%s new_parent=%s old_parent=%s", |
@@ -386,7 +385,6 @@ TEST_F(ViewManagerConnectionTest, AddRemoveNotify) { |
// Make 2 a child of 1. |
{ |
- AllocationScope scope; |
ASSERT_TRUE(AddNode(view_manager_.get(), |
CreateNodeId(client_.id(), 1), |
CreateNodeId(client_.id(), 2), |
@@ -402,7 +400,6 @@ TEST_F(ViewManagerConnectionTest, AddRemoveNotify) { |
// Remove 2 from its parent. |
{ |
- AllocationScope scope; |
ASSERT_TRUE(RemoveNodeFromParent(view_manager_.get(), |
CreateNodeId(client_.id(), 2), |
2)); |
@@ -428,7 +425,6 @@ TEST_F(ViewManagerConnectionTest, AddNodeWithNoChange) { |
// Make 2 a child of 1. |
{ |
- AllocationScope scope; |
ASSERT_TRUE(AddNode(view_manager_.get(), |
CreateNodeId(client_.id(), 1), |
CreateNodeId(client_.id(), 2), |
@@ -444,7 +440,6 @@ TEST_F(ViewManagerConnectionTest, AddNodeWithNoChange) { |
// Try again, this should fail. |
{ |
- AllocationScope scope; |
EXPECT_FALSE(AddNode(view_manager_.get(), |
CreateNodeId(client_.id(), 1), |
CreateNodeId(client_.id(), 2), |
@@ -466,7 +461,6 @@ TEST_F(ViewManagerConnectionTest, AddAncestorFails) { |
// Make 2 a child of 1. |
{ |
- AllocationScope scope; |
ASSERT_TRUE(AddNode(view_manager_.get(), |
CreateNodeId(client_.id(), 1), |
CreateNodeId(client_.id(), 2), |
@@ -482,7 +476,6 @@ TEST_F(ViewManagerConnectionTest, AddAncestorFails) { |
// Try to make 1 a child of 2, this should fail since 1 is an ancestor of 2. |
{ |
- AllocationScope scope; |
EXPECT_FALSE(AddNode(view_manager_.get(), |
CreateNodeId(client_.id(), 2), |
CreateNodeId(client_.id(), 1), |
@@ -500,7 +493,6 @@ TEST_F(ViewManagerConnectionTest, AddWithInvalidServerId) { |
// Make 2 a child of 1. Supply an invalid change id, which should fail. |
{ |
- AllocationScope scope; |
ASSERT_FALSE(AddNode(view_manager_.get(), |
CreateNodeId(client_.id(), 1), |
CreateNodeId(client_.id(), 2), |
@@ -521,7 +513,6 @@ TEST_F(ViewManagerConnectionTest, AddToRoot) { |
// Make 3 a child of 21. |
{ |
- AllocationScope scope; |
ASSERT_TRUE(AddNode(view_manager_.get(), |
CreateNodeId(client_.id(), 21), |
CreateNodeId(client_.id(), 3), |
@@ -537,7 +528,6 @@ TEST_F(ViewManagerConnectionTest, AddToRoot) { |
// Make 21 a child of the root. |
{ |
- AllocationScope scope; |
ASSERT_TRUE(AddNode(view_manager_.get(), |
CreateNodeId(0, 1), |
CreateNodeId(client_.id(), 21), |
@@ -562,7 +552,6 @@ TEST_F(ViewManagerConnectionTest, NodeHierarchyChangedNodes) { |
// Make 11 a child of 1. |
{ |
- AllocationScope scope; |
ASSERT_TRUE(AddNode(view_manager_.get(), |
CreateNodeId(client_.id(), 1), |
CreateNodeId(client_.id(), 11), |
@@ -574,7 +563,6 @@ TEST_F(ViewManagerConnectionTest, NodeHierarchyChangedNodes) { |
// Make 1 a child of the root. |
{ |
- AllocationScope scope; |
ASSERT_TRUE(AddNode(view_manager_.get(), |
CreateNodeId(0, 1), |
CreateNodeId(client_.id(), 1), |
@@ -597,7 +585,6 @@ TEST_F(ViewManagerConnectionTest, NodeHierarchyChangedNodes) { |
// Remove 1 from the root. |
{ |
- AllocationScope scope; |
ASSERT_TRUE(RemoveNodeFromParent(view_manager_.get(), |
CreateNodeId(client_.id(), 1), |
3)); |
@@ -614,7 +601,6 @@ TEST_F(ViewManagerConnectionTest, NodeHierarchyChangedNodes) { |
// Create another node, 111, parent it to 11. |
ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 111)); |
{ |
- AllocationScope scope; |
ASSERT_TRUE(AddNode(view_manager_.get(), |
CreateNodeId(client_.id(), 11), |
CreateNodeId(client_.id(), 111), |
@@ -662,7 +648,6 @@ TEST_F(ViewManagerConnectionTest, NodeHierarchyChangedAddingKnownToUnknown) { |
// Set up the hierarchy. |
{ |
- AllocationScope scope; |
ASSERT_TRUE(AddNode(view_manager_.get(), |
CreateNodeId(0, 1), |
CreateNodeId(client_.id(), 1), |
@@ -681,7 +666,6 @@ TEST_F(ViewManagerConnectionTest, NodeHierarchyChangedAddingKnownToUnknown) { |
// Remove 11. |
{ |
- AllocationScope scope; |
ASSERT_TRUE(RemoveNodeFromParent(view_manager_.get(), |
CreateNodeId(client_.id(), 11), |
4)); |
@@ -699,7 +683,6 @@ TEST_F(ViewManagerConnectionTest, NodeHierarchyChangedAddingKnownToUnknown) { |
// Add 11 to 21. As client2 knows about 11 it should receive the new |
// hierarchy. |
{ |
- AllocationScope scope; |
ASSERT_TRUE(AddNode(view_manager_.get(), |
CreateNodeId(client_.id(), 21), |
CreateNodeId(client_.id(), 11), |
@@ -727,7 +710,6 @@ TEST_F(ViewManagerConnectionTest, GetInitialNodesOnInit) { |
// Make 3 a child of 21. |
{ |
- AllocationScope scope; |
ASSERT_TRUE(AddNode(view_manager_.get(), |
CreateNodeId(client_.id(), 21), |
CreateNodeId(client_.id(), 3), |
@@ -737,7 +719,6 @@ TEST_F(ViewManagerConnectionTest, GetInitialNodesOnInit) { |
// Make 21 a child of the root. |
{ |
- AllocationScope scope; |
ASSERT_TRUE(AddNode(view_manager_.get(), |
CreateNodeId(0, 1), |
CreateNodeId(client_.id(), 21), |
@@ -765,7 +746,6 @@ TEST_F(ViewManagerConnectionTest, DeleteNode) { |
// Make 2 a child of 1. |
{ |
- AllocationScope scope; |
ASSERT_TRUE(AddNode(view_manager_.get(), |
CreateNodeId(client_.id(), 1), |
CreateNodeId(client_.id(), 2), |
@@ -781,7 +761,6 @@ TEST_F(ViewManagerConnectionTest, DeleteNode) { |
// Add 1 to the root |
{ |
- AllocationScope scope; |
ASSERT_TRUE(AddNode(view_manager_.get(), |
CreateNodeId(0, 1), |
CreateNodeId(client_.id(), 1), |
@@ -799,7 +778,6 @@ TEST_F(ViewManagerConnectionTest, DeleteNode) { |
// Delete 1. |
{ |
- AllocationScope scope; |
ASSERT_TRUE(DeleteNode(view_manager_.get(), CreateNodeId(client_.id(), 1))); |
Changes changes(client_.GetAndClearChanges()); |
ASSERT_TRUE(changes.empty()); |
@@ -835,7 +813,6 @@ TEST_F(ViewManagerConnectionTest, ReusedDeletedId) { |
// Make 1 a child of the root. |
{ |
- AllocationScope scope; |
ASSERT_TRUE(AddNode(view_manager_.get(), |
CreateNodeId(0, 1), |
CreateNodeId(client_.id(), 1), |
@@ -854,7 +831,6 @@ TEST_F(ViewManagerConnectionTest, ReusedDeletedId) { |
// Delete 1. |
{ |
- AllocationScope scope; |
ASSERT_TRUE(DeleteNode(view_manager_.get(), CreateNodeId(client_.id(), 1))); |
EXPECT_TRUE(client_.GetAndClearChanges().empty()); |
@@ -868,7 +844,6 @@ TEST_F(ViewManagerConnectionTest, ReusedDeletedId) { |
// notification. |
ASSERT_TRUE(CreateNode(view_manager_.get(), 1, 1)); |
{ |
- AllocationScope scope; |
ASSERT_TRUE(AddNode(view_manager_.get(), |
CreateNodeId(0, 1), |
CreateNodeId(client_.id(), 1), |
@@ -1068,7 +1043,6 @@ TEST_F(ViewManagerConnectionTest, GetNodeTree) { |
// Verifies GetNodeTree() on the root. |
{ |
- AllocationScope scope; |
std::vector<TestNode> nodes; |
GetNodeTree(view_manager2_.get(), CreateNodeId(0, 1), &nodes); |
ASSERT_EQ(5u, nodes.size()); |
@@ -1081,7 +1055,6 @@ TEST_F(ViewManagerConnectionTest, GetNodeTree) { |
// Verifies GetNodeTree() on the node 1,1. |
{ |
- AllocationScope scope; |
std::vector<TestNode> nodes; |
GetNodeTree(view_manager2_.get(), CreateNodeId(1, 1), &nodes); |
ASSERT_EQ(2u, nodes.size()); |