Index: chrome/browser/sync/internal_api/syncapi_unittest.cc |
diff --git a/chrome/browser/sync/internal_api/syncapi_unittest.cc b/chrome/browser/sync/internal_api/syncapi_unittest.cc |
index 189573345e6a839656973c6d16004902cfeafd1a..c3f9e98ea9e51d36237a572f7e070d51a47ddb97 100644 |
--- a/chrome/browser/sync/internal_api/syncapi_unittest.cc |
+++ b/chrome/browser/sync/internal_api/syncapi_unittest.cc |
@@ -1205,7 +1205,46 @@ TEST_F(SyncManagerTest, GetChildNodeIdsFailure) { |
} |
} |
-// TODO(akalin): Add unit tests for findNodesContainingString message. |
+TEST_F(SyncManagerTest, GetAllNodesTest) { |
+ StrictMock<MockJsReplyHandler> reply_handler; |
+ JsArgList return_args; |
+ |
+ EXPECT_CALL(reply_handler, |
+ HandleJsReply("getAllNodes", _)) |
+ .Times(1).WillRepeatedly(SaveArg<1>(&return_args)); |
+ |
+ { |
+ ListValue args; |
+ SendJsMessage("getAllNodes", |
+ JsArgList(&args), reply_handler.AsWeakHandle()); |
+ } |
+ |
+ // There's not much value in verifying every attribute on every node here. |
+ // Most of the value of this test has already been achieved: we've verified we |
+ // can call the above function without crashing or leaking memory. |
+ // |
+ // Let's just check the list size and a few of its elements. Anything more |
+ // would make this test brittle without greatly increasing our chances of |
+ // catching real bugs. |
+ |
+ ListValue* node_list; |
+ DictionaryValue* first_result; |
+ |
+ // The resulting argument list should have one argument, a list of nodes. |
+ ASSERT_EQ(return_args.Get().GetSize(), static_cast<size_t>(1)); |
tim (not reviewing)
2012/04/12 01:22:08
Here and below -
Prefer 1U to static_cast<size_t>
rlarocque
2012/04/12 02:27:19
Done.
|
+ ASSERT_TRUE(return_args.Get().GetList(0, &node_list)); |
+ |
+ // The database creation logic depends on the routing info. |
+ // Refer to setup methods for more information. |
+ ModelSafeRoutingInfo routes; |
+ GetModelSafeRoutingInfo(&routes); |
+ size_t directory_size = routes.size() + 1; |
+ |
+ ASSERT_EQ(node_list->GetSize(), directory_size); |
+ ASSERT_TRUE(node_list->GetDictionary(0, &first_result)); |
+ EXPECT_TRUE(first_result->HasKey("ID")); |
+ EXPECT_TRUE(first_result->HasKey("NON_UNIQUE_NAME")); |
+} |
TEST_F(SyncManagerTest, OnNotificationStateChange) { |
InSequence dummy; |