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 #ifndef SYNC_INTERNAL_API_ATTACHMENTS_ATTACHMENT_STORE_TEST_TEMPLATE_H_ | 5 #ifndef COMPONENTS_SYNC_CORE_IMPL_ATTACHMENTS_ATTACHMENT_STORE_TEST_TEMPLATE_H_ |
6 #define SYNC_INTERNAL_API_ATTACHMENTS_ATTACHMENT_STORE_TEST_TEMPLATE_H_ | 6 #define COMPONENTS_SYNC_CORE_IMPL_ATTACHMENTS_ATTACHMENT_STORE_TEST_TEMPLATE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
13 #include "base/memory/ref_counted_memory.h" | 13 #include "base/memory/ref_counted_memory.h" |
14 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
15 #include "base/threading/thread_task_runner_handle.h" | 15 #include "base/threading/thread_task_runner_handle.h" |
16 #include "sync/api/attachments/attachment.h" | 16 #include "components/sync/api/attachments/attachment.h" |
17 #include "sync/api/attachments/attachment_store.h" | 17 #include "components/sync/api/attachments/attachment_store.h" |
18 #include "sync/internal_api/public/attachments/attachment_util.h" | 18 #include "components/sync/core/attachments/attachment_util.h" |
19 #include "sync/protocol/sync.pb.h" | 19 #include "components/sync/protocol/sync.pb.h" |
20 #include "testing/gmock/include/gmock/gmock-matchers.h" | 20 #include "testing/gmock/include/gmock/gmock-matchers.h" |
21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
22 | 22 |
23 // AttachmentStoreTest defines tests for AttachmentStore. To instantiate these | 23 // AttachmentStoreTest defines tests for AttachmentStore. To instantiate these |
24 // tests for a particular implementation you need to: | 24 // tests for a particular implementation you need to: |
25 // - Include this file in test. | 25 // - Include this file in test. |
26 // - Create factory class for attachment store that implements factory method. | 26 // - Create factory class for attachment store that implements factory method. |
27 // - add INSTANTIATE_TYPED_TEST_CASE_P statement. | 27 // - add INSTANTIATE_TYPED_TEST_CASE_P statement. |
28 // Here is how to do it for MyAttachmentStore: | 28 // Here is how to do it for MyAttachmentStore: |
29 // | 29 // |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 scoped_refptr<base::RefCountedString> some_data2; | 64 scoped_refptr<base::RefCountedString> some_data2; |
65 | 65 |
66 AttachmentStoreTest() {} | 66 AttachmentStoreTest() {} |
67 | 67 |
68 void SetUp() override { | 68 void SetUp() override { |
69 store = attachment_store_factory.CreateAttachmentStore(); | 69 store = attachment_store_factory.CreateAttachmentStore(); |
70 store_for_sync = store->CreateAttachmentStoreForSync(); | 70 store_for_sync = store->CreateAttachmentStoreForSync(); |
71 | 71 |
72 Clear(); | 72 Clear(); |
73 read_callback = base::Bind(&AttachmentStoreTest::CopyResultAttachments, | 73 read_callback = base::Bind(&AttachmentStoreTest::CopyResultAttachments, |
74 base::Unretained(this), | 74 base::Unretained(this), &result, &attachments, |
75 &result, | |
76 &attachments, | |
77 &failed_attachment_ids); | 75 &failed_attachment_ids); |
78 write_callback = base::Bind( | 76 write_callback = base::Bind(&AttachmentStoreTest::CopyResult, |
79 &AttachmentStoreTest::CopyResult, base::Unretained(this), &result); | 77 base::Unretained(this), &result); |
80 drop_callback = write_callback; | 78 drop_callback = write_callback; |
81 read_metadata_callback = | 79 read_metadata_callback = |
82 base::Bind(&AttachmentStoreTest::CopyResultMetadata, | 80 base::Bind(&AttachmentStoreTest::CopyResultMetadata, |
83 base::Unretained(this), &result, &attachment_metadata); | 81 base::Unretained(this), &result, &attachment_metadata); |
84 | 82 |
85 some_data1 = new base::RefCountedString; | 83 some_data1 = new base::RefCountedString; |
86 some_data1->data() = kTestData1; | 84 some_data1->data() = kTestData1; |
87 | 85 |
88 some_data2 = new base::RefCountedString; | 86 some_data2 = new base::RefCountedString; |
89 some_data2->data() = kTestData2; | 87 some_data2->data() = kTestData2; |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 Write_RoundTrip, | 512 Write_RoundTrip, |
515 Read_OneNotFound, | 513 Read_OneNotFound, |
516 Drop_DropTwoButOnlyOneExists, | 514 Drop_DropTwoButOnlyOneExists, |
517 Drop_DoesNotExist, | 515 Drop_DoesNotExist, |
518 ReadMetadataById, | 516 ReadMetadataById, |
519 ReadMetadata, | 517 ReadMetadata, |
520 SetSyncReference_DropSyncReference); | 518 SetSyncReference_DropSyncReference); |
521 | 519 |
522 } // namespace syncer | 520 } // namespace syncer |
523 | 521 |
524 #endif // SYNC_INTERNAL_API_ATTACHMENTS_ATTACHMENT_STORE_TEST_TEMPLATE_H_ | 522 #endif // COMPONENTS_SYNC_CORE_IMPL_ATTACHMENTS_ATTACHMENT_STORE_TEST_TEMPLATE_
H_ |
OLD | NEW |