Reland issue 671513010 check sync themes setting patch.
[chromium-blink-merge.git] / components / sync_driver / device_info_sync_service_unittest.cc
blob9722aa4d9c94726a165b0242234b265dc58d3635
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/message_loop/message_loop.h"
6 #include "components/sync_driver/device_info_sync_service.h"
7 #include "components/sync_driver/local_device_info_provider_mock.h"
8 #include "sync/api/sync_change.h"
9 #include "sync/api/sync_change_processor.h"
10 #include "sync/api/sync_change_processor_wrapper_for_test.h"
11 #include "sync/api/sync_error_factory_mock.h"
12 #include "sync/internal_api/public/attachments/attachment_service_proxy_for_test.h"
13 #include "sync/util/time.h"
14 #include "testing/gtest/include/gtest/gtest.h"
16 using syncer::AttachmentIdList;
17 using syncer::AttachmentServiceProxyForTest;
18 using syncer::ModelType;
19 using syncer::SyncChange;
20 using syncer::SyncChangeList;
21 using syncer::SyncChangeProcessor;
22 using syncer::SyncChangeProcessorWrapperForTest;
23 using syncer::SyncData;
24 using syncer::SyncDataList;
25 using syncer::SyncError;
26 using syncer::SyncErrorFactory;
27 using syncer::SyncErrorFactoryMock;
28 using syncer::SyncMergeResult;
30 namespace sync_driver {
32 namespace {
34 class TestChangeProcessor : public SyncChangeProcessor {
35 public:
36 TestChangeProcessor() {}
37 ~TestChangeProcessor() override {}
39 // SyncChangeProcessor implementation.
40 // Store a copy of all the changes passed in so we can examine them later.
41 SyncError ProcessSyncChanges(const tracked_objects::Location& from_here,
42 const SyncChangeList& change_list) override {
43 change_list_ = change_list;
44 return SyncError();
47 // This method isn't used in these tests.
48 SyncDataList GetAllSyncData(ModelType type) const override {
49 return SyncDataList();
52 size_t change_list_size() const { return change_list_.size(); }
54 SyncChange::SyncChangeType change_type_at(size_t index) const {
55 CHECK_LT(index, change_list_size());
56 return change_list_[index].change_type();
59 const sync_pb::DeviceInfoSpecifics& device_info_at(size_t index) const {
60 CHECK_LT(index, change_list_size());
61 return change_list_[index].sync_data().GetSpecifics().device_info();
64 const std::string& cache_guid_at(size_t index) const {
65 return device_info_at(index).cache_guid();
68 const std::string& client_name_at(size_t index) const {
69 return device_info_at(index).client_name();
72 private:
73 SyncChangeList change_list_;
76 class DeviceInfoSyncServiceTest : public testing::Test,
77 public DeviceInfoTracker::Observer {
78 public:
79 DeviceInfoSyncServiceTest() : num_device_info_changed_callbacks_(0) {}
80 virtual ~DeviceInfoSyncServiceTest() {}
82 virtual void SetUp() override {
83 local_device_.reset(new LocalDeviceInfoProviderMock(
84 "guid_1",
85 "client_1",
86 "Chromium 10k",
87 "Chrome 10k",
88 sync_pb::SyncEnums_DeviceType_TYPE_LINUX,
89 "device_id"));
90 sync_service_.reset(new DeviceInfoSyncService(local_device_.get()));
91 sync_processor_.reset(new TestChangeProcessor());
92 // Register observer
93 sync_service_->AddObserver(this);
96 virtual void TearDown() override {
97 sync_service_->RemoveObserver(this);
100 void OnDeviceInfoChange() override { num_device_info_changed_callbacks_++; }
102 scoped_ptr<SyncChangeProcessor> PassProcessor() {
103 return scoped_ptr<SyncChangeProcessor>(
104 new SyncChangeProcessorWrapperForTest(sync_processor_.get()));
107 scoped_ptr<SyncErrorFactory> CreateAndPassSyncErrorFactory() {
108 return scoped_ptr<SyncErrorFactory>(new SyncErrorFactoryMock());
111 SyncData CreateRemoteData(const std::string& client_id,
112 const std::string& client_name,
113 int64 backup_timestamp = 0) {
114 sync_pb::EntitySpecifics entity;
115 sync_pb::DeviceInfoSpecifics& specifics = *entity.mutable_device_info();
117 specifics.set_cache_guid(client_id);
118 specifics.set_client_name(client_name);
119 specifics.set_chrome_version("Chromium 10k");
120 specifics.set_sync_user_agent("Chrome 10k");
121 specifics.set_device_type(sync_pb::SyncEnums_DeviceType_TYPE_LINUX);
122 specifics.set_signin_scoped_device_id("device_id");
124 if (backup_timestamp != 0) {
125 specifics.set_backup_timestamp(backup_timestamp);
128 return SyncData::CreateRemoteData(1,
129 entity,
130 base::Time(),
131 AttachmentIdList(),
132 AttachmentServiceProxyForTest::Create());
135 void AddInitialData(SyncDataList& sync_data_list,
136 const std::string& client_id,
137 const std::string& client_name) {
138 SyncData sync_data = CreateRemoteData(client_id, client_name);
139 sync_data_list.push_back(sync_data);
142 void AddChange(SyncChangeList& change_list,
143 SyncChange::SyncChangeType change_type,
144 const std::string& client_id,
145 const std::string& client_name) {
146 SyncData sync_data = CreateRemoteData(client_id, client_name);
147 SyncChange sync_change(FROM_HERE, change_type, sync_data);
148 change_list.push_back(sync_change);
151 protected:
152 int num_device_info_changed_callbacks_;
153 base::MessageLoopForUI message_loop_;
154 scoped_ptr<LocalDeviceInfoProviderMock> local_device_;
155 scoped_ptr<DeviceInfoSyncService> sync_service_;
156 scoped_ptr<TestChangeProcessor> sync_processor_;
159 // Sync with empty initial data.
160 TEST_F(DeviceInfoSyncServiceTest, StartSyncEmptyInitialData) {
161 SyncMergeResult merge_result =
162 sync_service_->MergeDataAndStartSyncing(syncer::DEVICE_INFO,
163 SyncDataList(),
164 PassProcessor(),
165 CreateAndPassSyncErrorFactory());
167 EXPECT_EQ(0, merge_result.num_items_added());
168 EXPECT_EQ(0, merge_result.num_items_modified());
169 EXPECT_EQ(0, merge_result.num_items_deleted());
170 EXPECT_EQ(1, merge_result.num_items_before_association());
171 EXPECT_EQ(1, merge_result.num_items_after_association());
172 EXPECT_EQ(SyncChange::ACTION_ADD, sync_processor_->change_type_at(0));
174 EXPECT_EQ(1U, sync_processor_->change_list_size());
175 EXPECT_EQ("guid_1", sync_processor_->cache_guid_at(0));
177 // Should have one device info corresponding to local device info.
178 EXPECT_EQ(1U, sync_service_->GetAllSyncData(syncer::DEVICE_INFO).size());
179 EXPECT_EQ(1U, sync_service_->GetAllDeviceInfo().size());
180 EXPECT_TRUE(sync_service_->GetDeviceInfo("guid_1"));
181 EXPECT_FALSE(sync_service_->GetDeviceInfo("guid_0"));
184 // Sync with initial data matching the local device data.
185 TEST_F(DeviceInfoSyncServiceTest, StartSyncMatchingInitialData) {
186 SyncDataList sync_data;
187 AddInitialData(sync_data, "guid_1", "client_1");
189 SyncMergeResult merge_result =
190 sync_service_->MergeDataAndStartSyncing(syncer::DEVICE_INFO,
191 sync_data,
192 PassProcessor(),
193 CreateAndPassSyncErrorFactory());
194 EXPECT_EQ(0, merge_result.num_items_added());
195 EXPECT_EQ(0, merge_result.num_items_modified());
196 EXPECT_EQ(0, merge_result.num_items_deleted());
197 EXPECT_EQ(1, merge_result.num_items_before_association());
198 EXPECT_EQ(1, merge_result.num_items_after_association());
200 // No changes expected because the device info matches.
201 EXPECT_EQ(0U, sync_processor_->change_list_size());
203 EXPECT_EQ(1U, sync_service_->GetAllSyncData(syncer::DEVICE_INFO).size());
204 EXPECT_EQ(1U, sync_service_->GetAllDeviceInfo().size());
205 EXPECT_TRUE(sync_service_->GetDeviceInfo("guid_1"));
206 EXPECT_FALSE(sync_service_->GetDeviceInfo("guid_0"));
209 // Sync with misc initial data.
210 TEST_F(DeviceInfoSyncServiceTest, StartSync) {
211 SyncDataList sync_data;
212 AddInitialData(sync_data, "guid_2", "foo");
213 AddInitialData(sync_data, "guid_3", "bar");
214 // This guid matches the local device but the client name is different.
215 AddInitialData(sync_data, "guid_1", "baz");
217 SyncMergeResult merge_result =
218 sync_service_->MergeDataAndStartSyncing(syncer::DEVICE_INFO,
219 sync_data,
220 PassProcessor(),
221 CreateAndPassSyncErrorFactory());
223 EXPECT_EQ(2, merge_result.num_items_added());
224 EXPECT_EQ(1, merge_result.num_items_modified());
225 EXPECT_EQ(0, merge_result.num_items_deleted());
226 EXPECT_EQ(1, merge_result.num_items_before_association());
227 EXPECT_EQ(3, merge_result.num_items_after_association());
229 EXPECT_EQ(1U, sync_processor_->change_list_size());
230 EXPECT_EQ(SyncChange::ACTION_UPDATE, sync_processor_->change_type_at(0));
231 EXPECT_EQ("client_1", sync_processor_->client_name_at(0));
233 EXPECT_EQ(3U, sync_service_->GetAllSyncData(syncer::DEVICE_INFO).size());
234 EXPECT_EQ(3U, sync_service_->GetAllDeviceInfo().size());
235 EXPECT_TRUE(sync_service_->GetDeviceInfo("guid_1"));
236 EXPECT_TRUE(sync_service_->GetDeviceInfo("guid_2"));
237 EXPECT_TRUE(sync_service_->GetDeviceInfo("guid_3"));
238 EXPECT_FALSE(sync_service_->GetDeviceInfo("guid_0"));
241 // Process sync change with ACTION_ADD.
242 // Verify callback.
243 TEST_F(DeviceInfoSyncServiceTest, ProcessAddChange) {
244 EXPECT_EQ(0, num_device_info_changed_callbacks_);
246 // Start with an empty initial data.
247 SyncMergeResult merge_result =
248 sync_service_->MergeDataAndStartSyncing(syncer::DEVICE_INFO,
249 SyncDataList(),
250 PassProcessor(),
251 CreateAndPassSyncErrorFactory());
252 // There should be only one item corresponding to the local device
253 EXPECT_EQ(1, merge_result.num_items_after_association());
254 EXPECT_EQ(1, num_device_info_changed_callbacks_);
256 // Add a new device info with a non-matching guid.
257 SyncChangeList change_list;
258 AddChange(change_list, SyncChange::ACTION_ADD, "guid_2", "foo");
260 SyncError error = sync_service_->ProcessSyncChanges(FROM_HERE, change_list);
261 EXPECT_FALSE(error.IsSet());
262 EXPECT_EQ(2, num_device_info_changed_callbacks_);
264 EXPECT_EQ(2U, sync_service_->GetAllDeviceInfo().size());
266 EXPECT_TRUE(sync_service_->GetDeviceInfo("guid_1"));
267 EXPECT_TRUE(sync_service_->GetDeviceInfo("guid_2"));
268 EXPECT_FALSE(sync_service_->GetDeviceInfo("guid_0"));
271 // Process multiple sync change with ACTION_UPDATE and ACTION_ADD.
272 // Verify that callback is called multiple times.
273 TEST_F(DeviceInfoSyncServiceTest, ProcessMultipleChanges) {
274 SyncDataList sync_data;
275 AddInitialData(sync_data, "guid_2", "foo");
276 AddInitialData(sync_data, "guid_3", "bar");
278 SyncMergeResult merge_result =
279 sync_service_->MergeDataAndStartSyncing(syncer::DEVICE_INFO,
280 sync_data,
281 PassProcessor(),
282 CreateAndPassSyncErrorFactory());
283 EXPECT_EQ(3, merge_result.num_items_after_association());
284 // reset callbacks counter
285 num_device_info_changed_callbacks_ = 0;
287 SyncChangeList change_list;
288 AddChange(change_list, SyncChange::ACTION_UPDATE, "guid_2", "foo_2");
290 SyncError error = sync_service_->ProcessSyncChanges(FROM_HERE, change_list);
291 EXPECT_FALSE(error.IsSet());
293 EXPECT_EQ(1, num_device_info_changed_callbacks_);
294 EXPECT_EQ(3U, sync_service_->GetAllDeviceInfo().size());
295 EXPECT_EQ("foo_2", sync_service_->GetDeviceInfo("guid_2")->client_name());
297 change_list.clear();
298 AddChange(change_list, SyncChange::ACTION_UPDATE, "guid_3", "bar_3");
299 AddChange(change_list, SyncChange::ACTION_ADD, "guid_4", "baz_4");
301 error = sync_service_->ProcessSyncChanges(FROM_HERE, change_list);
302 EXPECT_FALSE(error.IsSet());
304 EXPECT_EQ(2, num_device_info_changed_callbacks_);
305 EXPECT_EQ(4U, sync_service_->GetAllDeviceInfo().size());
306 EXPECT_EQ("bar_3", sync_service_->GetDeviceInfo("guid_3")->client_name());
307 EXPECT_EQ("baz_4", sync_service_->GetDeviceInfo("guid_4")->client_name());
310 // Process update to the local device info and verify that it is ignored.
311 TEST_F(DeviceInfoSyncServiceTest, ProcessUpdateChangeMatchingLocalDevice) {
312 SyncMergeResult merge_result =
313 sync_service_->MergeDataAndStartSyncing(syncer::DEVICE_INFO,
314 SyncDataList(),
315 PassProcessor(),
316 CreateAndPassSyncErrorFactory());
317 EXPECT_EQ(1, merge_result.num_items_after_association());
318 // reset callbacks counter
319 num_device_info_changed_callbacks_ = 0;
321 SyncChangeList change_list;
322 AddChange(change_list, SyncChange::ACTION_UPDATE, "guid_1", "foo_1");
324 SyncError error = sync_service_->ProcessSyncChanges(FROM_HERE, change_list);
325 EXPECT_FALSE(error.IsSet());
326 // Callback shouldn't be sent in this case.
327 EXPECT_EQ(0, num_device_info_changed_callbacks_);
328 // Should still have the old local device Info.
329 EXPECT_EQ(1U, sync_service_->GetAllDeviceInfo().size());
330 EXPECT_EQ("client_1", sync_service_->GetDeviceInfo("guid_1")->client_name());
333 // Process sync change with ACTION_DELETE.
334 TEST_F(DeviceInfoSyncServiceTest, ProcessDeleteChange) {
335 SyncDataList sync_data;
336 AddInitialData(sync_data, "guid_2", "foo");
337 AddInitialData(sync_data, "guid_3", "bar");
339 SyncMergeResult merge_result =
340 sync_service_->MergeDataAndStartSyncing(syncer::DEVICE_INFO,
341 sync_data,
342 PassProcessor(),
343 CreateAndPassSyncErrorFactory());
344 EXPECT_EQ(3, merge_result.num_items_after_association());
345 // reset callbacks counter
346 num_device_info_changed_callbacks_ = 0;
348 SyncChangeList change_list;
349 AddChange(change_list, SyncChange::ACTION_DELETE, "guid_2", "foo_2");
351 SyncError error = sync_service_->ProcessSyncChanges(FROM_HERE, change_list);
352 EXPECT_FALSE(error.IsSet());
354 EXPECT_EQ(1, num_device_info_changed_callbacks_);
355 EXPECT_EQ(2U, sync_service_->GetAllDeviceInfo().size());
356 EXPECT_FALSE(sync_service_->GetDeviceInfo("guid_2"));
359 // Process sync change with unexpected action.
360 TEST_F(DeviceInfoSyncServiceTest, ProcessInvalidChange) {
361 SyncMergeResult merge_result =
362 sync_service_->MergeDataAndStartSyncing(syncer::DEVICE_INFO,
363 SyncDataList(),
364 PassProcessor(),
365 CreateAndPassSyncErrorFactory());
366 EXPECT_EQ(1, merge_result.num_items_after_association());
367 // reset callbacks counter
368 num_device_info_changed_callbacks_ = 0;
370 SyncChangeList change_list;
371 AddChange(change_list, (SyncChange::SyncChangeType)100, "guid_2", "foo_2");
373 SyncError error = sync_service_->ProcessSyncChanges(FROM_HERE, change_list);
374 EXPECT_TRUE(error.IsSet());
376 // The number of callback should still be zero.
377 EXPECT_EQ(0, num_device_info_changed_callbacks_);
378 EXPECT_EQ(1U, sync_service_->GetAllDeviceInfo().size());
381 // Process sync change after unsubscribing from notifications.
382 TEST_F(DeviceInfoSyncServiceTest, ProcessChangesAfterUnsubscribing) {
383 SyncMergeResult merge_result =
384 sync_service_->MergeDataAndStartSyncing(syncer::DEVICE_INFO,
385 SyncDataList(),
386 PassProcessor(),
387 CreateAndPassSyncErrorFactory());
388 EXPECT_EQ(1, merge_result.num_items_after_association());
389 // reset callbacks counter
390 num_device_info_changed_callbacks_ = 0;
392 SyncChangeList change_list;
393 AddChange(change_list, SyncChange::ACTION_ADD, "guid_2", "foo_2");
395 // Unsubscribe observer before processing changes.
396 sync_service_->RemoveObserver(this);
398 SyncError error = sync_service_->ProcessSyncChanges(FROM_HERE, change_list);
399 EXPECT_FALSE(error.IsSet());
401 // The number of callback should still be zero.
402 EXPECT_EQ(0, num_device_info_changed_callbacks_);
405 // Verifies setting backup timestamp after the initial sync.
406 TEST_F(DeviceInfoSyncServiceTest, UpdateLocalDeviceBackupTime) {
407 // Shouldn't have backuptime initially.
408 base::Time backup_time = sync_service_->GetLocalDeviceBackupTime();
409 EXPECT_TRUE(backup_time.is_null());
411 // Perform the initial sync with empty data.
412 SyncMergeResult merge_result =
413 sync_service_->MergeDataAndStartSyncing(syncer::DEVICE_INFO,
414 SyncDataList(),
415 PassProcessor(),
416 CreateAndPassSyncErrorFactory());
418 // Should have local device after the initial sync.
419 EXPECT_EQ(1U, sync_processor_->change_list_size());
420 EXPECT_EQ(SyncChange::ACTION_ADD, sync_processor_->change_type_at(0));
422 // Shouldn't have backup time initially.
423 EXPECT_EQ("guid_1", sync_processor_->cache_guid_at(0));
424 EXPECT_FALSE(sync_processor_->device_info_at(0).has_backup_timestamp());
426 sync_service_->UpdateLocalDeviceBackupTime(base::Time::FromTimeT(1000));
428 // Should have local device info updated with the specified backup timestamp.
429 EXPECT_EQ(1U, sync_processor_->change_list_size());
430 EXPECT_EQ(SyncChange::ACTION_UPDATE, sync_processor_->change_type_at(0));
431 EXPECT_EQ("guid_1", sync_processor_->cache_guid_at(0));
432 EXPECT_TRUE(sync_processor_->device_info_at(0).has_backup_timestamp());
434 backup_time = syncer::ProtoTimeToTime(
435 sync_processor_->device_info_at(0).backup_timestamp());
436 EXPECT_EQ(1000, backup_time.ToTimeT());
438 // Also verify that we get the same backup time directly from the service.
439 backup_time = sync_service_->GetLocalDeviceBackupTime();
440 EXPECT_EQ(1000, backup_time.ToTimeT());
443 // Verifies setting backup timestamp prior to the initial sync.
444 TEST_F(DeviceInfoSyncServiceTest, UpdateLocalDeviceBackupTimeBeforeSync) {
445 // Set the backup timestamp.
446 sync_service_->UpdateLocalDeviceBackupTime(base::Time::FromTimeT(2000));
447 // Verify that we get it back.
448 base::Time backup_time = sync_service_->GetLocalDeviceBackupTime();
449 EXPECT_EQ(2000, backup_time.ToTimeT());
451 // Now perform the initial sync with empty data.
452 SyncMergeResult merge_result =
453 sync_service_->MergeDataAndStartSyncing(syncer::DEVICE_INFO,
454 SyncDataList(),
455 PassProcessor(),
456 CreateAndPassSyncErrorFactory());
458 // Should have local device after the initial sync.
459 // Should have the backup timestamp set.
460 EXPECT_EQ(1U, sync_processor_->change_list_size());
461 EXPECT_EQ(SyncChange::ACTION_ADD, sync_processor_->change_type_at(0));
462 EXPECT_EQ("guid_1", sync_processor_->cache_guid_at(0));
463 EXPECT_TRUE(sync_processor_->device_info_at(0).has_backup_timestamp());
465 backup_time = syncer::ProtoTimeToTime(
466 sync_processor_->device_info_at(0).backup_timestamp());
467 EXPECT_EQ(2000, backup_time.ToTimeT());
470 // Verifies that the backup timestamp that comes in the intial sync data
471 // gets preserved when there are no changes to the local device.
472 TEST_F(DeviceInfoSyncServiceTest, PreserveBackupTimeWithMatchingLocalDevice) {
473 base::Time backup_time = base::Time::FromTimeT(3000);
474 SyncDataList sync_data;
475 sync_data.push_back(CreateRemoteData(
476 "guid_1", "client_1", syncer::TimeToProtoTime(backup_time)));
478 SyncMergeResult merge_result =
479 sync_service_->MergeDataAndStartSyncing(syncer::DEVICE_INFO,
480 sync_data,
481 PassProcessor(),
482 CreateAndPassSyncErrorFactory());
484 // Everything is matching so there should be no updates.
485 EXPECT_EQ(0U, sync_processor_->change_list_size());
487 // Verify that we get back the same time.
488 backup_time = sync_service_->GetLocalDeviceBackupTime();
489 EXPECT_EQ(3000, backup_time.ToTimeT());
492 // Verifies that the backup timestamp that comes in the intial sync data
493 // gets merged with the local device data.
494 TEST_F(DeviceInfoSyncServiceTest, MergeBackupTimeWithMatchingLocalDevice) {
495 base::Time backup_time = base::Time::FromTimeT(4000);
496 SyncDataList sync_data;
497 sync_data.push_back(CreateRemoteData(
498 "guid_1", "foo_1", syncer::TimeToProtoTime(backup_time)));
500 SyncMergeResult merge_result =
501 sync_service_->MergeDataAndStartSyncing(syncer::DEVICE_INFO,
502 sync_data,
503 PassProcessor(),
504 CreateAndPassSyncErrorFactory());
506 // Should be one change because of the client name mismatch.
507 // However the backup time passed in the initial data should be merged into
508 // the change.
509 EXPECT_EQ(1U, sync_processor_->change_list_size());
511 EXPECT_EQ(SyncChange::ACTION_UPDATE, sync_processor_->change_type_at(0));
512 EXPECT_EQ("guid_1", sync_processor_->cache_guid_at(0));
513 EXPECT_EQ("client_1", sync_processor_->client_name_at(0));
515 backup_time = syncer::ProtoTimeToTime(
516 sync_processor_->device_info_at(0).backup_timestamp());
517 EXPECT_EQ(4000, backup_time.ToTimeT());
520 // Verifies that mismatching backup timestamp generates an update even
521 // when the rest of local device data is matching.
522 TEST_F(DeviceInfoSyncServiceTest,
523 MergeMismatchingBackupTimeWithMatchingLocalDevice) {
524 base::Time backup_time = base::Time::FromTimeT(5000);
525 SyncDataList sync_data;
526 sync_data.push_back(CreateRemoteData(
527 "guid_1", "client_1", syncer::TimeToProtoTime(backup_time)));
529 // Set the backup timestamp different than the one in the sync data.
530 sync_service_->UpdateLocalDeviceBackupTime(base::Time::FromTimeT(6000));
532 SyncMergeResult merge_result =
533 sync_service_->MergeDataAndStartSyncing(syncer::DEVICE_INFO,
534 sync_data,
535 PassProcessor(),
536 CreateAndPassSyncErrorFactory());
538 // Should generate and update due to timestamp mismatch.
539 // The locally set timestamp wins.
540 EXPECT_EQ(1U, sync_processor_->change_list_size());
542 EXPECT_EQ(SyncChange::ACTION_UPDATE, sync_processor_->change_type_at(0));
543 EXPECT_EQ("guid_1", sync_processor_->cache_guid_at(0));
544 EXPECT_EQ("client_1", sync_processor_->client_name_at(0));
546 backup_time = syncer::ProtoTimeToTime(
547 sync_processor_->device_info_at(0).backup_timestamp());
548 EXPECT_EQ(6000, backup_time.ToTimeT());
551 } // namespace
553 } // namespace sync_driver