OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #include "components/sync_driver/device_info_sync_service.h" | 5 #include "components/sync_driver/device_info_sync_service.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/message_loop/message_loop.h" | |
10 #include "components/sync_driver/local_device_info_provider_mock.h" | 9 #include "components/sync_driver/local_device_info_provider_mock.h" |
11 #include "sync/api/sync_change.h" | 10 #include "sync/api/sync_change.h" |
12 #include "sync/api/sync_change_processor.h" | 11 #include "sync/api/sync_change_processor.h" |
13 #include "sync/api/sync_change_processor_wrapper_for_test.h" | 12 #include "sync/api/sync_change_processor_wrapper_for_test.h" |
14 #include "sync/api/sync_error_factory_mock.h" | 13 #include "sync/api/sync_error_factory_mock.h" |
15 #include "sync/internal_api/public/attachments/attachment_service_proxy_for_test
.h" | 14 #include "sync/internal_api/public/attachments/attachment_service_proxy_for_test
.h" |
16 #include "sync/util/time.h" | 15 #include "sync/util/time.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
18 | 17 |
19 using syncer::AttachmentIdList; | 18 using syncer::AttachmentIdList; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 SyncChange::SyncChangeType change_type, | 143 SyncChange::SyncChangeType change_type, |
145 const std::string& client_id, | 144 const std::string& client_id, |
146 const std::string& client_name) { | 145 const std::string& client_name) { |
147 SyncData sync_data = CreateRemoteData(client_id, client_name); | 146 SyncData sync_data = CreateRemoteData(client_id, client_name); |
148 SyncChange sync_change(FROM_HERE, change_type, sync_data); | 147 SyncChange sync_change(FROM_HERE, change_type, sync_data); |
149 change_list->push_back(sync_change); | 148 change_list->push_back(sync_change); |
150 } | 149 } |
151 | 150 |
152 protected: | 151 protected: |
153 int num_device_info_changed_callbacks_; | 152 int num_device_info_changed_callbacks_; |
154 base::MessageLoopForUI message_loop_; | |
155 scoped_ptr<LocalDeviceInfoProviderMock> local_device_; | 153 scoped_ptr<LocalDeviceInfoProviderMock> local_device_; |
156 scoped_ptr<DeviceInfoSyncService> sync_service_; | 154 scoped_ptr<DeviceInfoSyncService> sync_service_; |
157 scoped_ptr<TestChangeProcessor> sync_processor_; | 155 scoped_ptr<TestChangeProcessor> sync_processor_; |
158 }; | 156 }; |
159 | 157 |
160 // Sync with empty initial data. | 158 // Sync with empty initial data. |
161 TEST_F(DeviceInfoSyncServiceTest, StartSyncEmptyInitialData) { | 159 TEST_F(DeviceInfoSyncServiceTest, StartSyncEmptyInitialData) { |
162 EXPECT_FALSE(sync_service_->IsSyncing()); | 160 EXPECT_FALSE(sync_service_->IsSyncing()); |
163 | 161 |
164 SyncMergeResult merge_result = | 162 SyncMergeResult merge_result = |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 EXPECT_EQ("client_1", sync_processor_->client_name_at(0)); | 557 EXPECT_EQ("client_1", sync_processor_->client_name_at(0)); |
560 | 558 |
561 backup_time = syncer::ProtoTimeToTime( | 559 backup_time = syncer::ProtoTimeToTime( |
562 sync_processor_->device_info_at(0).backup_timestamp()); | 560 sync_processor_->device_info_at(0).backup_timestamp()); |
563 EXPECT_EQ(6000, backup_time.ToTimeT()); | 561 EXPECT_EQ(6000, backup_time.ToTimeT()); |
564 } | 562 } |
565 | 563 |
566 } // namespace | 564 } // namespace |
567 | 565 |
568 } // namespace sync_driver | 566 } // namespace sync_driver |
OLD | NEW |