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

Unified Diff: chrome/browser/sync/internal_api/syncapi_unittest.cc

Issue 9836100: Add full text regex searching to chrome://sync (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix typo Created 8 years, 8 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 | « chrome/browser/sync/internal_api/sync_manager.cc ('k') | sync/syncable/syncable.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 e32d526ce1c74352376dee28655ef241528797b2..1a4ab2822724d11015f4fdcb26becb7f48ed9690 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(1U, return_args.Get().GetSize());
+ 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(directory_size, node_list->GetSize());
+ 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;
« no previous file with comments | « chrome/browser/sync/internal_api/sync_manager.cc ('k') | sync/syncable/syncable.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698