Blink roll 25b6bd3a7a131ffe68d809546ad1a20707915cdc:3a503f41ae42e5b79cfcd2ff10e65afde...
[chromium-blink-merge.git] / components / sync_driver / device_info_sync_service_unittest.cc
blobb083e12f1ba31d65db393d01e4f9bc954ff6dde8
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 ~DeviceInfoSyncServiceTest() override {}
82 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 void TearDown() override { sync_service_->RemoveObserver(this); }
98 void OnDeviceInfoChange() override { num_device_info_changed_callbacks_++; }
100 scoped_ptr<SyncChangeProcessor> PassProcessor() {
101 return scoped_ptr<SyncChangeProcessor>(
102 new SyncChangeProcessorWrapperForTest(sync_processor_.get()));
105 scoped_ptr<SyncErrorFactory> CreateAndPassSyncErrorFactory() {
106 return scoped_ptr<SyncErrorFactory>(new SyncErrorFactoryMock());
109 SyncData CreateRemoteData(const std::string& client_id,
110 const std::string& client_name,
111 int64 backup_timestamp = 0) {
112 sync_pb::EntitySpecifics entity;
113 sync_pb::DeviceInfoSpecifics& specifics = *entity.mutable_device_info();
115 specifics.set_cache_guid(client_id);
116 specifics.set_client_name(client_name);
117 specifics.set_chrome_version("Chromium 10k");
118 specifics.set_sync_user_agent("Chrome 10k");
119 specifics.set_device_type(sync_pb::SyncEnums_DeviceType_TYPE_LINUX);
120 specifics.set_signin_scoped_device_id("device_id");
122 if (backup_timestamp != 0) {
123 specifics.set_backup_timestamp(backup_timestamp);
126 return SyncData::CreateRemoteData(1,
127 entity,
128 base::Time(),
129 AttachmentIdList(),
130 AttachmentServiceProxyForTest::Create());
133 void AddInitialData(SyncDataList& sync_data_list,
134 const std::string& client_id,
135 const std::string& client_name) {
136 SyncData sync_data = CreateRemoteData(client_id, client_name);
137 sync_data_list.push_back(sync_data);
140 void AddChange(SyncChangeList& change_list,
141 SyncChange::SyncChangeType change_type,
142 const std::string& client_id,
143 const std::string& client_name) {
144 SyncData sync_data = CreateRemoteData(client_id, client_name);
145 SyncChange sync_change(FROM_HERE, change_type, sync_data);
146 change_list.push_back(sync_change);
149 protected:
150 int num_device_info_changed_callbacks_;
151 base::MessageLoopForUI message_loop_;
152 scoped_ptr<LocalDeviceInfoProviderMock> local_device_;
153 scoped_ptr<DeviceInfoSyncService> sync_service_;
154 scoped_ptr<TestChangeProcessor> sync_processor_;
157 // Sync with empty initial data.
158 TEST_F(DeviceInfoSyncServiceTest, StartSyncEmptyInitialData) {
159 SyncMergeResult merge_result =
160 sync_service_->MergeDataAndStartSyncing(syncer::DEVICE_INFO,
161 SyncDataList(),
162 PassProcessor(),
163 CreateAndPassSyncErrorFactory());
165 EXPECT_EQ(0, merge_result.num_items_added());
166 EXPECT_EQ(0, merge_result.num_items_modified());
167 EXPECT_EQ(0, merge_result.num_items_deleted());
168 EXPECT_EQ(1, merge_result.num_items_before_association());
169 EXPECT_EQ(1, merge_result.num_items_after_association());
170 EXPECT_EQ(SyncChange::ACTION_ADD, sync_processor_->change_type_at(0));
172 EXPECT_EQ(1U, sync_processor_->change_list_size());
173 EXPECT_EQ("guid_1", sync_processor_->cache_guid_at(0));
175 // Should have one device info corresponding to local device info.
176 EXPECT_EQ(1U, sync_service_->GetAllSyncData(syncer::DEVICE_INFO).size());
177 EXPECT_EQ(1U, sync_service_->GetAllDeviceInfo().size());
178 EXPECT_TRUE(sync_service_->GetDeviceInfo("guid_1"));
179 EXPECT_FALSE(sync_service_->GetDeviceInfo("guid_0"));
182 // Sync with initial data matching the local device data.
183 TEST_F(DeviceInfoSyncServiceTest, StartSyncMatchingInitialData) {
184 SyncDataList sync_data;
185 AddInitialData(sync_data, "guid_1", "client_1");
187 SyncMergeResult merge_result =
188 sync_service_->MergeDataAndStartSyncing(syncer::DEVICE_INFO,
189 sync_data,
190 PassProcessor(),
191 CreateAndPassSyncErrorFactory());
192 EXPECT_EQ(0, merge_result.num_items_added());
193 EXPECT_EQ(0, merge_result.num_items_modified());
194 EXPECT_EQ(0, merge_result.num_items_deleted());
195 EXPECT_EQ(1, merge_result.num_items_before_association());
196 EXPECT_EQ(1, merge_result.num_items_after_association());
198 // No changes expected because the device info matches.
199 EXPECT_EQ(0U, sync_processor_->change_list_size());
201 EXPECT_EQ(1U, sync_service_->GetAllSyncData(syncer::DEVICE_INFO).size());
202 EXPECT_EQ(1U, sync_service_->GetAllDeviceInfo().size());
203 EXPECT_TRUE(sync_service_->GetDeviceInfo("guid_1"));
204 EXPECT_FALSE(sync_service_->GetDeviceInfo("guid_0"));
207 // Sync with misc initial data.
208 TEST_F(DeviceInfoSyncServiceTest, StartSync) {
209 SyncDataList sync_data;
210 AddInitialData(sync_data, "guid_2", "foo");
211 AddInitialData(sync_data, "guid_3", "bar");
212 // This guid matches the local device but the client name is different.
213 AddInitialData(sync_data, "guid_1", "baz");
215 SyncMergeResult merge_result =
216 sync_service_->MergeDataAndStartSyncing(syncer::DEVICE_INFO,
217 sync_data,
218 PassProcessor(),
219 CreateAndPassSyncErrorFactory());
221 EXPECT_EQ(2, merge_result.num_items_added());
222 EXPECT_EQ(1, merge_result.num_items_modified());
223 EXPECT_EQ(0, merge_result.num_items_deleted());
224 EXPECT_EQ(1, merge_result.num_items_before_association());
225 EXPECT_EQ(3, merge_result.num_items_after_association());
227 EXPECT_EQ(1U, sync_processor_->change_list_size());
228 EXPECT_EQ(SyncChange::ACTION_UPDATE, sync_processor_->change_type_at(0));
229 EXPECT_EQ("client_1", sync_processor_->client_name_at(0));
231 EXPECT_EQ(3U, sync_service_->GetAllSyncData(syncer::DEVICE_INFO).size());
232 EXPECT_EQ(3U, sync_service_->GetAllDeviceInfo().size());
233 EXPECT_TRUE(sync_service_->GetDeviceInfo("guid_1"));
234 EXPECT_TRUE(sync_service_->GetDeviceInfo("guid_2"));
235 EXPECT_TRUE(sync_service_->GetDeviceInfo("guid_3"));
236 EXPECT_FALSE(sync_service_->GetDeviceInfo("guid_0"));
239 // Process sync change with ACTION_ADD.
240 // Verify callback.
241 TEST_F(DeviceInfoSyncServiceTest, ProcessAddChange) {
242 EXPECT_EQ(0, num_device_info_changed_callbacks_);
244 // Start with an empty initial data.
245 SyncMergeResult merge_result =
246 sync_service_->MergeDataAndStartSyncing(syncer::DEVICE_INFO,
247 SyncDataList(),
248 PassProcessor(),
249 CreateAndPassSyncErrorFactory());
250 // There should be only one item corresponding to the local device
251 EXPECT_EQ(1, merge_result.num_items_after_association());
252 EXPECT_EQ(1, num_device_info_changed_callbacks_);
254 // Add a new device info with a non-matching guid.
255 SyncChangeList change_list;
256 AddChange(change_list, SyncChange::ACTION_ADD, "guid_2", "foo");
258 SyncError error = sync_service_->ProcessSyncChanges(FROM_HERE, change_list);
259 EXPECT_FALSE(error.IsSet());
260 EXPECT_EQ(2, num_device_info_changed_callbacks_);
262 EXPECT_EQ(2U, sync_service_->GetAllDeviceInfo().size());
264 EXPECT_TRUE(sync_service_->GetDeviceInfo("guid_1"));
265 EXPECT_TRUE(sync_service_->GetDeviceInfo("guid_2"));
266 EXPECT_FALSE(sync_service_->GetDeviceInfo("guid_0"));
269 // Process multiple sync change with ACTION_UPDATE and ACTION_ADD.
270 // Verify that callback is called multiple times.
271 TEST_F(DeviceInfoSyncServiceTest, ProcessMultipleChanges) {
272 SyncDataList sync_data;
273 AddInitialData(sync_data, "guid_2", "foo");
274 AddInitialData(sync_data, "guid_3", "bar");
276 SyncMergeResult merge_result =
277 sync_service_->MergeDataAndStartSyncing(syncer::DEVICE_INFO,
278 sync_data,
279 PassProcessor(),
280 CreateAndPassSyncErrorFactory());
281 EXPECT_EQ(3, merge_result.num_items_after_association());
282 // reset callbacks counter
283 num_device_info_changed_callbacks_ = 0;
285 SyncChangeList change_list;
286 AddChange(change_list, SyncChange::ACTION_UPDATE, "guid_2", "foo_2");
288 SyncError error = sync_service_->ProcessSyncChanges(FROM_HERE, change_list);
289 EXPECT_FALSE(error.IsSet());
291 EXPECT_EQ(1, num_device_info_changed_callbacks_);
292 EXPECT_EQ(3U, sync_service_->GetAllDeviceInfo().size());
293 EXPECT_EQ("foo_2", sync_service_->GetDeviceInfo("guid_2")->client_name());
295 change_list.clear();
296 AddChange(change_list, SyncChange::ACTION_UPDATE, "guid_3", "bar_3");
297 AddChange(change_list, SyncChange::ACTION_ADD, "guid_4", "baz_4");
299 error = sync_service_->ProcessSyncChanges(FROM_HERE, change_list);
300 EXPECT_FALSE(error.IsSet());
302 EXPECT_EQ(2, num_device_info_changed_callbacks_);
303 EXPECT_EQ(4U, sync_service_->GetAllDeviceInfo().size());
304 EXPECT_EQ("bar_3", sync_service_->GetDeviceInfo("guid_3")->client_name());
305 EXPECT_EQ("baz_4", sync_service_->GetDeviceInfo("guid_4")->client_name());
308 // Process update to the local device info and verify that it is ignored.
309 TEST_F(DeviceInfoSyncServiceTest, ProcessUpdateChangeMatchingLocalDevice) {
310 SyncMergeResult merge_result =
311 sync_service_->MergeDataAndStartSyncing(syncer::DEVICE_INFO,
312 SyncDataList(),
313 PassProcessor(),
314 CreateAndPassSyncErrorFactory());
315 EXPECT_EQ(1, merge_result.num_items_after_association());
316 // reset callbacks counter
317 num_device_info_changed_callbacks_ = 0;
319 SyncChangeList change_list;
320 AddChange(change_list, SyncChange::ACTION_UPDATE, "guid_1", "foo_1");
322 SyncError error = sync_service_->ProcessSyncChanges(FROM_HERE, change_list);
323 EXPECT_FALSE(error.IsSet());
324 // Callback shouldn't be sent in this case.
325 EXPECT_EQ(0, num_device_info_changed_callbacks_);
326 // Should still have the old local device Info.
327 EXPECT_EQ(1U, sync_service_->GetAllDeviceInfo().size());
328 EXPECT_EQ("client_1", sync_service_->GetDeviceInfo("guid_1")->client_name());
331 // Process sync change with ACTION_DELETE.
332 TEST_F(DeviceInfoSyncServiceTest, ProcessDeleteChange) {
333 SyncDataList sync_data;
334 AddInitialData(sync_data, "guid_2", "foo");
335 AddInitialData(sync_data, "guid_3", "bar");
337 SyncMergeResult merge_result =
338 sync_service_->MergeDataAndStartSyncing(syncer::DEVICE_INFO,
339 sync_data,
340 PassProcessor(),
341 CreateAndPassSyncErrorFactory());
342 EXPECT_EQ(3, merge_result.num_items_after_association());
343 // reset callbacks counter
344 num_device_info_changed_callbacks_ = 0;
346 SyncChangeList change_list;
347 AddChange(change_list, SyncChange::ACTION_DELETE, "guid_2", "foo_2");
349 SyncError error = sync_service_->ProcessSyncChanges(FROM_HERE, change_list);
350 EXPECT_FALSE(error.IsSet());
352 EXPECT_EQ(1, num_device_info_changed_callbacks_);
353 EXPECT_EQ(2U, sync_service_->GetAllDeviceInfo().size());
354 EXPECT_FALSE(sync_service_->GetDeviceInfo("guid_2"));
357 // Process sync change with unexpected action.
358 TEST_F(DeviceInfoSyncServiceTest, ProcessInvalidChange) {
359 SyncMergeResult merge_result =
360 sync_service_->MergeDataAndStartSyncing(syncer::DEVICE_INFO,
361 SyncDataList(),
362 PassProcessor(),
363 CreateAndPassSyncErrorFactory());
364 EXPECT_EQ(1, merge_result.num_items_after_association());
365 // reset callbacks counter
366 num_device_info_changed_callbacks_ = 0;
368 SyncChangeList change_list;
369 AddChange(change_list, (SyncChange::SyncChangeType)100, "guid_2", "foo_2");
371 SyncError error = sync_service_->ProcessSyncChanges(FROM_HERE, change_list);
372 EXPECT_TRUE(error.IsSet());
374 // The number of callback should still be zero.
375 EXPECT_EQ(0, num_device_info_changed_callbacks_);
376 EXPECT_EQ(1U, sync_service_->GetAllDeviceInfo().size());
379 // Process sync change after unsubscribing from notifications.
380 TEST_F(DeviceInfoSyncServiceTest, ProcessChangesAfterUnsubscribing) {
381 SyncMergeResult merge_result =
382 sync_service_->MergeDataAndStartSyncing(syncer::DEVICE_INFO,
383 SyncDataList(),
384 PassProcessor(),
385 CreateAndPassSyncErrorFactory());
386 EXPECT_EQ(1, merge_result.num_items_after_association());
387 // reset callbacks counter
388 num_device_info_changed_callbacks_ = 0;
390 SyncChangeList change_list;
391 AddChange(change_list, SyncChange::ACTION_ADD, "guid_2", "foo_2");
393 // Unsubscribe observer before processing changes.
394 sync_service_->RemoveObserver(this);
396 SyncError error = sync_service_->ProcessSyncChanges(FROM_HERE, change_list);
397 EXPECT_FALSE(error.IsSet());
399 // The number of callback should still be zero.
400 EXPECT_EQ(0, num_device_info_changed_callbacks_);
403 // Verifies setting backup timestamp after the initial sync.
404 TEST_F(DeviceInfoSyncServiceTest, UpdateLocalDeviceBackupTime) {
405 // Shouldn't have backuptime initially.
406 base::Time backup_time = sync_service_->GetLocalDeviceBackupTime();
407 EXPECT_TRUE(backup_time.is_null());
409 // Perform the initial sync with empty data.
410 SyncMergeResult merge_result =
411 sync_service_->MergeDataAndStartSyncing(syncer::DEVICE_INFO,
412 SyncDataList(),
413 PassProcessor(),
414 CreateAndPassSyncErrorFactory());
416 // Should have local device after the initial sync.
417 EXPECT_EQ(1U, sync_processor_->change_list_size());
418 EXPECT_EQ(SyncChange::ACTION_ADD, sync_processor_->change_type_at(0));
420 // Shouldn't have backup time initially.
421 EXPECT_EQ("guid_1", sync_processor_->cache_guid_at(0));
422 EXPECT_FALSE(sync_processor_->device_info_at(0).has_backup_timestamp());
424 sync_service_->UpdateLocalDeviceBackupTime(base::Time::FromTimeT(1000));
426 // Should have local device info updated with the specified backup timestamp.
427 EXPECT_EQ(1U, sync_processor_->change_list_size());
428 EXPECT_EQ(SyncChange::ACTION_UPDATE, sync_processor_->change_type_at(0));
429 EXPECT_EQ("guid_1", sync_processor_->cache_guid_at(0));
430 EXPECT_TRUE(sync_processor_->device_info_at(0).has_backup_timestamp());
432 backup_time = syncer::ProtoTimeToTime(
433 sync_processor_->device_info_at(0).backup_timestamp());
434 EXPECT_EQ(1000, backup_time.ToTimeT());
436 // Also verify that we get the same backup time directly from the service.
437 backup_time = sync_service_->GetLocalDeviceBackupTime();
438 EXPECT_EQ(1000, backup_time.ToTimeT());
441 // Verifies setting backup timestamp prior to the initial sync.
442 TEST_F(DeviceInfoSyncServiceTest, UpdateLocalDeviceBackupTimeBeforeSync) {
443 // Set the backup timestamp.
444 sync_service_->UpdateLocalDeviceBackupTime(base::Time::FromTimeT(2000));
445 // Verify that we get it back.
446 base::Time backup_time = sync_service_->GetLocalDeviceBackupTime();
447 EXPECT_EQ(2000, backup_time.ToTimeT());
449 // Now perform the initial sync with empty data.
450 SyncMergeResult merge_result =
451 sync_service_->MergeDataAndStartSyncing(syncer::DEVICE_INFO,
452 SyncDataList(),
453 PassProcessor(),
454 CreateAndPassSyncErrorFactory());
456 // Should have local device after the initial sync.
457 // Should have the backup timestamp set.
458 EXPECT_EQ(1U, sync_processor_->change_list_size());
459 EXPECT_EQ(SyncChange::ACTION_ADD, sync_processor_->change_type_at(0));
460 EXPECT_EQ("guid_1", sync_processor_->cache_guid_at(0));
461 EXPECT_TRUE(sync_processor_->device_info_at(0).has_backup_timestamp());
463 backup_time = syncer::ProtoTimeToTime(
464 sync_processor_->device_info_at(0).backup_timestamp());
465 EXPECT_EQ(2000, backup_time.ToTimeT());
468 // Verifies that the backup timestamp that comes in the intial sync data
469 // gets preserved when there are no changes to the local device.
470 TEST_F(DeviceInfoSyncServiceTest, PreserveBackupTimeWithMatchingLocalDevice) {
471 base::Time backup_time = base::Time::FromTimeT(3000);
472 SyncDataList sync_data;
473 sync_data.push_back(CreateRemoteData(
474 "guid_1", "client_1", syncer::TimeToProtoTime(backup_time)));
476 SyncMergeResult merge_result =
477 sync_service_->MergeDataAndStartSyncing(syncer::DEVICE_INFO,
478 sync_data,
479 PassProcessor(),
480 CreateAndPassSyncErrorFactory());
482 // Everything is matching so there should be no updates.
483 EXPECT_EQ(0U, sync_processor_->change_list_size());
485 // Verify that we get back the same time.
486 backup_time = sync_service_->GetLocalDeviceBackupTime();
487 EXPECT_EQ(3000, backup_time.ToTimeT());
490 // Verifies that the backup timestamp that comes in the intial sync data
491 // gets merged with the local device data.
492 TEST_F(DeviceInfoSyncServiceTest, MergeBackupTimeWithMatchingLocalDevice) {
493 base::Time backup_time = base::Time::FromTimeT(4000);
494 SyncDataList sync_data;
495 sync_data.push_back(CreateRemoteData(
496 "guid_1", "foo_1", syncer::TimeToProtoTime(backup_time)));
498 SyncMergeResult merge_result =
499 sync_service_->MergeDataAndStartSyncing(syncer::DEVICE_INFO,
500 sync_data,
501 PassProcessor(),
502 CreateAndPassSyncErrorFactory());
504 // Should be one change because of the client name mismatch.
505 // However the backup time passed in the initial data should be merged into
506 // the change.
507 EXPECT_EQ(1U, sync_processor_->change_list_size());
509 EXPECT_EQ(SyncChange::ACTION_UPDATE, sync_processor_->change_type_at(0));
510 EXPECT_EQ("guid_1", sync_processor_->cache_guid_at(0));
511 EXPECT_EQ("client_1", sync_processor_->client_name_at(0));
513 backup_time = syncer::ProtoTimeToTime(
514 sync_processor_->device_info_at(0).backup_timestamp());
515 EXPECT_EQ(4000, backup_time.ToTimeT());
518 // Verifies that mismatching backup timestamp generates an update even
519 // when the rest of local device data is matching.
520 TEST_F(DeviceInfoSyncServiceTest,
521 MergeMismatchingBackupTimeWithMatchingLocalDevice) {
522 base::Time backup_time = base::Time::FromTimeT(5000);
523 SyncDataList sync_data;
524 sync_data.push_back(CreateRemoteData(
525 "guid_1", "client_1", syncer::TimeToProtoTime(backup_time)));
527 // Set the backup timestamp different than the one in the sync data.
528 sync_service_->UpdateLocalDeviceBackupTime(base::Time::FromTimeT(6000));
530 SyncMergeResult merge_result =
531 sync_service_->MergeDataAndStartSyncing(syncer::DEVICE_INFO,
532 sync_data,
533 PassProcessor(),
534 CreateAndPassSyncErrorFactory());
536 // Should generate and update due to timestamp mismatch.
537 // The locally set timestamp wins.
538 EXPECT_EQ(1U, sync_processor_->change_list_size());
540 EXPECT_EQ(SyncChange::ACTION_UPDATE, sync_processor_->change_type_at(0));
541 EXPECT_EQ("guid_1", sync_processor_->cache_guid_at(0));
542 EXPECT_EQ("client_1", sync_processor_->client_name_at(0));
544 backup_time = syncer::ProtoTimeToTime(
545 sync_processor_->device_info_at(0).backup_timestamp());
546 EXPECT_EQ(6000, backup_time.ToTimeT());
549 } // namespace
551 } // namespace sync_driver