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

Side by Side 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: Fixes from JS review 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sync/internal_api/sync_manager.cc ('k') | sync/syncable/syncable.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Unit tests for the SyncApi. Note that a lot of the underlying 5 // Unit tests for the SyncApi. Note that a lot of the underlying
6 // functionality is provided by the Syncable layer, which has its own 6 // functionality is provided by the Syncable layer, which has its own
7 // unit tests. We'll test SyncApi specific things in this harness. 7 // unit tests. We'll test SyncApi specific things in this harness.
8 8
9 #include <cstddef> 9 #include <cstddef>
10 #include <map> 10 #include <map>
(...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1198 } 1198 }
1199 1199
1200 { 1200 {
1201 ListValue args; 1201 ListValue args;
1202 args.Append(Value::CreateStringValue("9999")); 1202 args.Append(Value::CreateStringValue("9999"));
1203 SendJsMessage("getChildNodeIds", 1203 SendJsMessage("getChildNodeIds",
1204 JsArgList(&args), reply_handler.AsWeakHandle()); 1204 JsArgList(&args), reply_handler.AsWeakHandle());
1205 } 1205 }
1206 } 1206 }
1207 1207
1208 // TODO(akalin): Add unit tests for findNodesContainingString message. 1208 TEST_F(SyncManagerTest, GetAllNodesTest) {
1209 StrictMock<MockJsReplyHandler> reply_handler;
1210 JsArgList return_args;
1211
1212 EXPECT_CALL(reply_handler,
1213 HandleJsReply("getAllNodes", _))
1214 .Times(1).WillRepeatedly(SaveArg<1>(&return_args));
1215
1216 {
1217 ListValue args;
1218 SendJsMessage("getAllNodes",
1219 JsArgList(&args), reply_handler.AsWeakHandle());
1220 }
1221
1222 // There's not much value in verifying every attribute on every node here.
1223 // Most of the value of this test has already been achieved: we've verified we
1224 // can call the above function without crashing or leaking memory.
1225 //
1226 // Let's just check the list size and a few of its elements. Anything more
1227 // would make this test brittle without greatly increasing our chances of
1228 // catching real bugs.
1229
1230 ListValue* node_list;
1231 DictionaryValue* first_result;
1232
1233 // The resulting argument list should have one argument, a list of nodes.
1234 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.
1235 ASSERT_TRUE(return_args.Get().GetList(0, &node_list));
1236
1237 // The database creation logic depends on the routing info.
1238 // Refer to setup methods for more information.
1239 ModelSafeRoutingInfo routes;
1240 GetModelSafeRoutingInfo(&routes);
1241 size_t directory_size = routes.size() + 1;
1242
1243 ASSERT_EQ(node_list->GetSize(), directory_size);
1244 ASSERT_TRUE(node_list->GetDictionary(0, &first_result));
1245 EXPECT_TRUE(first_result->HasKey("ID"));
1246 EXPECT_TRUE(first_result->HasKey("NON_UNIQUE_NAME"));
1247 }
1209 1248
1210 TEST_F(SyncManagerTest, OnNotificationStateChange) { 1249 TEST_F(SyncManagerTest, OnNotificationStateChange) {
1211 InSequence dummy; 1250 InSequence dummy;
1212 StrictMock<MockJsEventHandler> event_handler; 1251 StrictMock<MockJsEventHandler> event_handler;
1213 1252
1214 DictionaryValue true_details; 1253 DictionaryValue true_details;
1215 true_details.SetBoolean("enabled", true); 1254 true_details.SetBoolean("enabled", true);
1216 DictionaryValue false_details; 1255 DictionaryValue false_details;
1217 false_details.SetBoolean("enabled", false); 1256 false_details.SetBoolean("enabled", false);
1218 1257
(...skipping 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after
2434 EXPECT_EQ(title, node.GetTitle()); 2473 EXPECT_EQ(title, node.GetTitle());
2435 EXPECT_EQ(GURL(url2), node.GetURL()); 2474 EXPECT_EQ(GURL(url2), node.GetURL());
2436 const syncable::Entry* node_entry = node.GetEntry(); 2475 const syncable::Entry* node_entry = node.GetEntry();
2437 EXPECT_EQ(kEncryptedString, node_entry->Get(NON_UNIQUE_NAME)); 2476 EXPECT_EQ(kEncryptedString, node_entry->Get(NON_UNIQUE_NAME));
2438 const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS); 2477 const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS);
2439 EXPECT_TRUE(specifics.has_encrypted()); 2478 EXPECT_TRUE(specifics.has_encrypted());
2440 } 2479 }
2441 } 2480 }
2442 2481
2443 } // namespace browser_sync 2482 } // namespace browser_sync
OLDNEW
« 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