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 "sync/api/sync_data.h" | 5 #include "components/sync/api/sync_data.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/memory/ref_counted_memory.h" | 12 #include "base/memory/ref_counted_memory.h" |
13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
14 #include "base/threading/thread_task_runner_handle.h" | 14 #include "base/threading/thread_task_runner_handle.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "sync/api/attachments/attachment_id.h" | 16 #include "components/sync/api/attachments/attachment_id.h" |
17 #include "sync/internal_api/public/attachments/attachment_service.h" | 17 #include "components/sync/core/attachments/attachment_service.h" |
18 #include "sync/internal_api/public/attachments/attachment_service_impl.h" | 18 #include "components/sync/core/attachments/attachment_service_impl.h" |
19 #include "sync/internal_api/public/attachments/attachment_service_proxy.h" | 19 #include "components/sync/core/attachments/attachment_service_proxy.h" |
20 #include "sync/protocol/sync.pb.h" | 20 #include "components/sync/protocol/sync.pb.h" |
21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
22 | 22 |
23 using std::string; | 23 using std::string; |
24 | 24 |
25 namespace syncer { | 25 namespace syncer { |
26 | 26 |
27 namespace { | 27 namespace { |
28 | 28 |
29 const char kSyncTag[] = "3984729834"; | 29 const char kSyncTag[] = "3984729834"; |
30 const ModelType kDatatype = syncer::PREFERENCES; | 30 const ModelType kDatatype = syncer::PREFERENCES; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 EXPECT_TRUE(data.IsLocal()); | 100 EXPECT_TRUE(data.IsLocal()); |
101 EXPECT_EQ(kSyncTag, SyncDataLocal(data).GetTag()); | 101 EXPECT_EQ(kSyncTag, SyncDataLocal(data).GetTag()); |
102 EXPECT_EQ(kDatatype, data.GetDataType()); | 102 EXPECT_EQ(kDatatype, data.GetDataType()); |
103 EXPECT_EQ(kNonUniqueTitle, data.GetTitle()); | 103 EXPECT_EQ(kNonUniqueTitle, data.GetTitle()); |
104 EXPECT_TRUE(data.GetSpecifics().has_preference()); | 104 EXPECT_TRUE(data.GetSpecifics().has_preference()); |
105 EXPECT_TRUE(data.GetAttachmentIds().empty()); | 105 EXPECT_TRUE(data.GetAttachmentIds().empty()); |
106 } | 106 } |
107 | 107 |
108 TEST_F(SyncDataTest, CreateRemoteData) { | 108 TEST_F(SyncDataTest, CreateRemoteData) { |
109 specifics.mutable_preference(); | 109 specifics.mutable_preference(); |
110 SyncData data = SyncData::CreateRemoteData(kId, | 110 SyncData data = |
111 specifics, | 111 SyncData::CreateRemoteData(kId, specifics, kLastModifiedTime, |
112 kLastModifiedTime, | 112 AttachmentIdList(), attachment_service_proxy); |
113 AttachmentIdList(), | |
114 attachment_service_proxy); | |
115 EXPECT_TRUE(data.IsValid()); | 113 EXPECT_TRUE(data.IsValid()); |
116 EXPECT_FALSE(data.IsLocal()); | 114 EXPECT_FALSE(data.IsLocal()); |
117 EXPECT_EQ(kId, SyncDataRemote(data).GetId()); | 115 EXPECT_EQ(kId, SyncDataRemote(data).GetId()); |
118 EXPECT_EQ(kLastModifiedTime, SyncDataRemote(data).GetModifiedTime()); | 116 EXPECT_EQ(kLastModifiedTime, SyncDataRemote(data).GetModifiedTime()); |
119 EXPECT_TRUE(data.GetSpecifics().has_preference()); | 117 EXPECT_TRUE(data.GetSpecifics().has_preference()); |
120 EXPECT_TRUE(data.GetAttachmentIds().empty()); | 118 EXPECT_TRUE(data.GetAttachmentIds().empty()); |
121 } | 119 } |
122 | 120 |
123 // TODO(maniscalco): Add test cases that verify GetLocalAttachmentsForUpload | 121 // TODO(maniscalco): Add test cases that verify GetLocalAttachmentsForUpload |
124 // calls are passed through to the underlying AttachmentService. | 122 // calls are passed through to the underlying AttachmentService. |
125 | 123 |
126 } // namespace | 124 } // namespace |
127 | 125 |
128 } // namespace syncer | 126 } // namespace syncer |
OLD | NEW |