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 b6aee00cb68d93b79cadd3b0ac61e06a38163be6..3c400e28615f019bba8c8dc2824e50491c0e43ea 100644 |
--- a/mojo/services/view_manager/view_manager_unittest.cc |
+++ b/mojo/services/view_manager/view_manager_unittest.cc |
@@ -93,10 +93,21 @@ class ViewManagerProxy : public TestChangeTracker::Delegate { |
// block until the result is received. |
bool CreateNode(Id node_id) { |
changes_.clear(); |
- bool result = false; |
- view_manager_->CreateNode(node_id, |
- base::Bind(&ViewManagerProxy::GotResult, |
- base::Unretained(this), &result)); |
+ ErrorCode result = ERROR_CODE_NONE; |
+ view_manager_->CreateNode( |
+ node_id, |
+ base::Bind(&ViewManagerProxy::GotResultWithErrorCode, |
+ base::Unretained(this), &result)); |
+ RunMainLoop(); |
+ return result == ERROR_CODE_NONE; |
+ } |
+ ErrorCode CreateNodeWithErrorCode(Id node_id) { |
+ changes_.clear(); |
+ ErrorCode result = ERROR_CODE_NONE; |
+ view_manager_->CreateNode( |
+ node_id, |
+ base::Bind(&ViewManagerProxy::GotResultWithErrorCode, |
+ base::Unretained(this), &result)); |
RunMainLoop(); |
return result; |
} |
@@ -241,6 +252,13 @@ class ViewManagerProxy : public TestChangeTracker::Delegate { |
main_run_loop_->Quit(); |
} |
+ void GotResultWithErrorCode(ErrorCode* error_code_cache, |
+ ErrorCode error_code) { |
+ *error_code_cache = error_code; |
+ DCHECK(main_run_loop_); |
+ main_run_loop_->Quit(); |
+ } |
+ |
void GotNodeTree(std::vector<TestNode>* nodes, Array<NodeDataPtr> results) { |
NodeDatasToTestNodes(results, nodes); |
DCHECK(main_run_loop_); |
@@ -541,11 +559,14 @@ TEST_F(ViewManagerTest, CreateNode) { |
EXPECT_TRUE(connection_->changes().empty()); |
// Can't create a node with the same id. |
- ASSERT_FALSE(connection_->CreateNode(BuildNodeId(1, 1))); |
+ ASSERT_EQ(ERROR_CODE_VALUE_IN_USE, |
+ connection_->CreateNodeWithErrorCode(BuildNodeId(1, 1))); |
EXPECT_TRUE(connection_->changes().empty()); |
// Can't create a node with a bogus connection id. |
- EXPECT_FALSE(connection_->CreateNode(BuildNodeId(2, 1))); |
+ EXPECT_EQ( |
+ ERROR_CODE_ILLEGAL_ARGUMENT, |
+ connection_->CreateNodeWithErrorCode(BuildNodeId(2, 1))); |
EXPECT_TRUE(connection_->changes().empty()); |
} |