Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(956)

Unified Diff: mojo/services/view_manager/view_manager_unittest.cc

Issue 383293002: Start of adding enums for error codes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/services/view_manager/view_manager_service_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
}
« no previous file with comments | « mojo/services/view_manager/view_manager_service_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698