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 "sync/api/sync_data.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/memory/ref_counted_memory.h" | 9 #include "base/memory/ref_counted_memory.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "base/message_loop/message_loop_proxy.h" | 11 #include "base/thread_task_runner_handle.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "sync/api/attachments/attachment_id.h" | 13 #include "sync/api/attachments/attachment_id.h" |
14 #include "sync/api/attachments/attachment_service.h" | 14 #include "sync/api/attachments/attachment_service.h" |
15 #include "sync/api/attachments/attachment_service_impl.h" | 15 #include "sync/api/attachments/attachment_service_impl.h" |
16 #include "sync/api/attachments/attachment_service_proxy.h" | 16 #include "sync/api/attachments/attachment_service_proxy.h" |
17 #include "sync/protocol/sync.pb.h" | 17 #include "sync/protocol/sync.pb.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 | 19 |
20 using std::string; | 20 using std::string; |
21 | 21 |
22 namespace syncer { | 22 namespace syncer { |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 const string kSyncTag = "3984729834"; | 26 const string kSyncTag = "3984729834"; |
27 const ModelType kDatatype = syncer::PREFERENCES; | 27 const ModelType kDatatype = syncer::PREFERENCES; |
28 const string kNonUniqueTitle = "my preference"; | 28 const string kNonUniqueTitle = "my preference"; |
29 const int64 kId = 439829; | 29 const int64 kId = 439829; |
30 const base::Time kLastModifiedTime = base::Time(); | 30 const base::Time kLastModifiedTime = base::Time(); |
31 | 31 |
32 class SyncDataTest : public testing::Test { | 32 class SyncDataTest : public testing::Test { |
33 protected: | 33 protected: |
34 SyncDataTest() | 34 SyncDataTest() |
35 : attachment_service(AttachmentServiceImpl::CreateForTest()), | 35 : attachment_service(AttachmentServiceImpl::CreateForTest()), |
36 attachment_service_weak_ptr_factory(attachment_service.get()), | 36 attachment_service_weak_ptr_factory(attachment_service.get()), |
37 attachment_service_proxy( | 37 attachment_service_proxy( |
38 base::MessageLoopProxy::current(), | 38 base::ThreadTaskRunnerHandle::Get(), |
39 attachment_service_weak_ptr_factory.GetWeakPtr()) {} | 39 attachment_service_weak_ptr_factory.GetWeakPtr()) {} |
40 base::MessageLoop loop; | 40 base::MessageLoop loop; |
41 sync_pb::EntitySpecifics specifics; | 41 sync_pb::EntitySpecifics specifics; |
42 scoped_ptr<AttachmentService> attachment_service; | 42 scoped_ptr<AttachmentService> attachment_service; |
43 base::WeakPtrFactory<AttachmentService> attachment_service_weak_ptr_factory; | 43 base::WeakPtrFactory<AttachmentService> attachment_service_weak_ptr_factory; |
44 AttachmentServiceProxy attachment_service_proxy; | 44 AttachmentServiceProxy attachment_service_proxy; |
45 }; | 45 }; |
46 | 46 |
47 TEST_F(SyncDataTest, NoArgCtor) { | 47 TEST_F(SyncDataTest, NoArgCtor) { |
48 SyncData data; | 48 SyncData data; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 EXPECT_TRUE(data.GetSpecifics().has_preference()); | 119 EXPECT_TRUE(data.GetSpecifics().has_preference()); |
120 EXPECT_TRUE(data.GetAttachmentIds().empty()); | 120 EXPECT_TRUE(data.GetAttachmentIds().empty()); |
121 } | 121 } |
122 | 122 |
123 // TODO(maniscalco): Add test cases that verify GetLocalAttachmentsForUpload and | 123 // TODO(maniscalco): Add test cases that verify GetLocalAttachmentsForUpload and |
124 // DropAttachments calls are passed through to the underlying AttachmentService. | 124 // DropAttachments calls are passed through to the underlying AttachmentService. |
125 | 125 |
126 } // namespace | 126 } // namespace |
127 | 127 |
128 } // namespace syncer | 128 } // namespace syncer |
OLD | NEW |