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" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 bool CreateNode(IViewManager* view_manager, | 98 bool CreateNode(IViewManager* view_manager, |
99 TransportConnectionId connection_id, | 99 TransportConnectionId connection_id, |
100 TransportConnectionSpecificNodeId node_id) { | 100 TransportConnectionSpecificNodeId node_id) { |
101 bool result = false; | 101 bool result = false; |
102 view_manager->CreateNode(CreateNodeId(connection_id, node_id), | 102 view_manager->CreateNode(CreateNodeId(connection_id, node_id), |
103 base::Bind(&BooleanCallback, &result)); | 103 base::Bind(&BooleanCallback, &result)); |
104 DoRunLoop(); | 104 DoRunLoop(); |
105 return result; | 105 return result; |
106 } | 106 } |
107 | 107 |
108 // TODO(sky): make a macro for these functions, they are all the same. | |
109 | |
110 // Deletes a node, blocking until done. | 108 // Deletes a node, blocking until done. |
111 bool DeleteNode(IViewManager* view_manager, TransportNodeId node_id) { | 109 bool DeleteNode(IViewManager* view_manager, TransportNodeId node_id) { |
112 bool result = false; | 110 bool result = false; |
113 view_manager->DeleteNode(node_id, base::Bind(&BooleanCallback, &result)); | 111 view_manager->DeleteNode(node_id, base::Bind(&BooleanCallback, &result)); |
114 DoRunLoop(); | 112 DoRunLoop(); |
115 return result; | 113 return result; |
116 } | 114 } |
117 | 115 |
118 // Adds a node, blocking until done. | 116 // Adds a node, blocking until done. |
119 bool AddNode(IViewManager* view_manager, | 117 bool AddNode(IViewManager* view_manager, |
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1066 GetNodeTree(view_manager2_.get(), CreateNodeId(1, 1), &nodes); | 1064 GetNodeTree(view_manager2_.get(), CreateNodeId(1, 1), &nodes); |
1067 ASSERT_EQ(2u, nodes.size()); | 1065 ASSERT_EQ(2u, nodes.size()); |
1068 EXPECT_EQ("node=1,1 parent=0,1 view=null", nodes[0].ToString()); | 1066 EXPECT_EQ("node=1,1 parent=0,1 view=null", nodes[0].ToString()); |
1069 EXPECT_EQ("node=1,11 parent=1,1 view=1,51", nodes[1].ToString()); | 1067 EXPECT_EQ("node=1,11 parent=1,1 view=1,51", nodes[1].ToString()); |
1070 } | 1068 } |
1071 } | 1069 } |
1072 | 1070 |
1073 } // namespace service | 1071 } // namespace service |
1074 } // namespace view_manager | 1072 } // namespace view_manager |
1075 } // namespace mojo | 1073 } // namespace mojo |
OLD | NEW |