summaryrefslogtreecommitdiffstats
path: root/sync/internal_api/attachments/attachment_store_test_template.h
blob: 86ea20e9bc90c3cea4022476765529de90904936 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef SYNC_INTERNAL_API_ATTACHMENTS_ATTACHMENT_STORE_TEST_TEMPLATE_H_
#define SYNC_INTERNAL_API_ATTACHMENTS_ATTACHMENT_STORE_TEST_TEMPLATE_H_

#include "sync/api/attachments/attachment_store.h"

#include "base/bind.h"
#include "base/files/scoped_temp_dir.h"
#include "base/memory/ref_counted_memory.h"
#include "base/memory/scoped_ptr.h"
#include "base/run_loop.h"
#include "base/thread_task_runner_handle.h"
#include "sync/api/attachments/attachment.h"
#include "sync/internal_api/public/attachments/attachment_util.h"
#include "sync/protocol/sync.pb.h"
#include "testing/gmock/include/gmock/gmock-matchers.h"
#include "testing/gtest/include/gtest/gtest.h"

// AttachmentStoreTest defines tests for AttachmentStore. To instantiate these
// tests for a particular implementation you need to:
//  - Include this file in test.
//  - Create factory class for attachment store that implements factory method.
//  - add INSTANTIATE_TYPED_TEST_CASE_P statement.
// Here is how to do it for MyAttachmentStore:
//
// class MyAttachmentStoreFactory {
//  public:
//   scoped_refptr<AttachmentStore> CreateAttachmentStore() {
//     return new MyAttachmentStore();
//   }
// };
//
// INSTANTIATE_TYPED_TEST_CASE_P(My,
//                               AttachmentStoreTest,
//                               MyAttachmentStoreFactory);

namespace syncer {

const char kTestData1[] = "test data 1";
const char kTestData2[] = "test data 2";

template <typename AttachmentStoreFactory>
class AttachmentStoreTest : public testing::Test {
 protected:
  AttachmentStoreFactory attachment_store_factory;
  base::MessageLoop message_loop;
  scoped_ptr<AttachmentStore> store;
  scoped_ptr<AttachmentStoreForSync> store_for_sync;
  AttachmentStore::Result result;
  scoped_ptr<AttachmentMap> attachments;
  scoped_ptr<AttachmentIdList> failed_attachment_ids;
  scoped_ptr<AttachmentMetadataList> attachment_metadata;

  AttachmentStore::ReadCallback read_callback;
  AttachmentStore::WriteCallback write_callback;
  AttachmentStore::DropCallback drop_callback;
  AttachmentStore::ReadMetadataCallback read_metadata_callback;

  scoped_refptr<base::RefCountedString> some_data1;
  scoped_refptr<base::RefCountedString> some_data2;

  AttachmentStoreTest() {}

  void SetUp() override {
    store = attachment_store_factory.CreateAttachmentStore();
    store_for_sync = store->CreateAttachmentStoreForSync();

    Clear();
    read_callback = base::Bind(&AttachmentStoreTest::CopyResultAttachments,
                               base::Unretained(this),
                               &result,
                               &attachments,
                               &failed_attachment_ids);
    write_callback = base::Bind(
        &AttachmentStoreTest::CopyResult, base::Unretained(this), &result);
    drop_callback = write_callback;
    read_metadata_callback =
        base::Bind(&AttachmentStoreTest::CopyResultMetadata,
                   base::Unretained(this), &result, &attachment_metadata);

    some_data1 = new base::RefCountedString;
    some_data1->data() = kTestData1;

    some_data2 = new base::RefCountedString;
    some_data2->data() = kTestData2;
  }

  void ClearAndPumpLoop() {
    Clear();
    base::RunLoop().RunUntilIdle();
  }

 private:
  void Clear() {
    result = AttachmentStore::UNSPECIFIED_ERROR;
    attachments.reset();
    failed_attachment_ids.reset();
    attachment_metadata.reset();
  }

  void CopyResult(AttachmentStore::Result* destination_result,
                  const AttachmentStore::Result& source_result) {
    *destination_result = source_result;
  }

  void CopyResultAttachments(
      AttachmentStore::Result* destination_result,
      scoped_ptr<AttachmentMap>* destination_attachments,
      scoped_ptr<AttachmentIdList>* destination_failed_attachment_ids,
      const AttachmentStore::Result& source_result,
      scoped_ptr<AttachmentMap> source_attachments,
      scoped_ptr<AttachmentIdList> source_failed_attachment_ids) {
    CopyResult(destination_result, source_result);
    *destination_attachments = source_attachments.Pass();
    *destination_failed_attachment_ids = source_failed_attachment_ids.Pass();
  }

  void CopyResultMetadata(
      AttachmentStore::Result* destination_result,
      scoped_ptr<AttachmentMetadataList>* destination_metadata,
      const AttachmentStore::Result& source_result,
      scoped_ptr<AttachmentMetadataList> source_metadata) {
    CopyResult(destination_result, source_result);
    *destination_metadata = source_metadata.Pass();
  }
};

TYPED_TEST_CASE_P(AttachmentStoreTest);

// Verify that CreateAttachmentStoreForSync() creates valid object.
TYPED_TEST_P(AttachmentStoreTest, CreateAttachmentStoreForSync) {
  scoped_ptr<AttachmentStoreForSync> attachment_store_for_sync =
      this->store->CreateAttachmentStoreForSync();
  EXPECT_NE(nullptr, attachment_store_for_sync);
}

// Verify that we do not overwrite existing attachments and that we do not treat
// it as an error.
TYPED_TEST_P(AttachmentStoreTest, Write_NoOverwriteNoError) {
  // Create two attachments with the same id but different data.
  Attachment attachment1 = Attachment::Create(this->some_data1);
  Attachment attachment2 =
      Attachment::CreateFromParts(attachment1.GetId(), this->some_data2);

  // Write the first one.
  AttachmentList some_attachments;
  some_attachments.push_back(attachment1);
  this->store->Write(some_attachments, this->write_callback);
  this->ClearAndPumpLoop();
  EXPECT_EQ(AttachmentStore::SUCCESS, this->result);

  // Write the second one.
  some_attachments.clear();
  some_attachments.push_back(attachment2);
  this->store->Write(some_attachments, this->write_callback);
  this->ClearAndPumpLoop();
  EXPECT_EQ(AttachmentStore::SUCCESS, this->result);

  // Read it back and see that it was not overwritten.
  AttachmentIdList some_attachment_ids;
  some_attachment_ids.push_back(attachment1.GetId());
  this->store->Read(some_attachment_ids, this->read_callback);
  this->ClearAndPumpLoop();
  EXPECT_EQ(AttachmentStore::SUCCESS, this->result);
  EXPECT_EQ(1U, this->attachments->size());
  EXPECT_EQ(0U, this->failed_attachment_ids->size());
  AttachmentMap::const_iterator a1 =
      this->attachments->find(attachment1.GetId());
  EXPECT_TRUE(a1 != this->attachments->end());
  EXPECT_TRUE(attachment1.GetData()->Equals(a1->second.GetData()));
}

// Verify that we can write some attachments and read them back.
TYPED_TEST_P(AttachmentStoreTest, Write_RoundTrip) {
  Attachment attachment1 = Attachment::Create(this->some_data1);
  Attachment attachment2 = Attachment::Create(this->some_data2);
  AttachmentList some_attachments;
  some_attachments.push_back(attachment1);
  some_attachments.push_back(attachment2);

  this->store->Write(some_attachments, this->write_callback);
  this->ClearAndPumpLoop();
  EXPECT_EQ(AttachmentStore::SUCCESS, this->result);

  AttachmentIdList some_attachment_ids;
  some_attachment_ids.push_back(attachment1.GetId());
  some_attachment_ids.push_back(attachment2.GetId());
  this->store->Read(some_attachment_ids, this->read_callback);
  this->ClearAndPumpLoop();
  EXPECT_EQ(AttachmentStore::SUCCESS, this->result);
  EXPECT_EQ(2U, this->attachments->size());
  EXPECT_EQ(0U, this->failed_attachment_ids->size());

  AttachmentMap::const_iterator a1 =
      this->attachments->find(attachment1.GetId());
  EXPECT_TRUE(a1 != this->attachments->end());
  EXPECT_TRUE(attachment1.GetData()->Equals(a1->second.GetData()));

  AttachmentMap::const_iterator a2 =
      this->attachments->find(attachment2.GetId());
  EXPECT_TRUE(a2 != this->attachments->end());
  EXPECT_TRUE(attachment2.GetData()->Equals(a2->second.GetData()));
}

// Try to read two attachments when only one exists.
TYPED_TEST_P(AttachmentStoreTest, Read_OneNotFound) {
  Attachment attachment1 = Attachment::Create(this->some_data1);
  Attachment attachment2 = Attachment::Create(this->some_data2);

  AttachmentList some_attachments;
  // Write attachment1 only.
  some_attachments.push_back(attachment1);
  this->store->Write(some_attachments, this->write_callback);
  this->ClearAndPumpLoop();
  EXPECT_EQ(AttachmentStore::SUCCESS, this->result);

  // Try to read both attachment1 and attachment2.
  AttachmentIdList ids;
  ids.push_back(attachment1.GetId());
  ids.push_back(attachment2.GetId());
  this->store->Read(ids, this->read_callback);
  this->ClearAndPumpLoop();

  // See that only attachment1 was read.
  EXPECT_EQ(AttachmentStore::UNSPECIFIED_ERROR, this->result);
  EXPECT_EQ(1U, this->attachments->size());
  EXPECT_EQ(1U, this->failed_attachment_ids->size());
}

// Try to drop two attachments when only one exists. Verify that no error occurs
// and that the existing attachment was dropped.
TYPED_TEST_P(AttachmentStoreTest, Drop_DropTwoButOnlyOneExists) {
  // First, create two attachments.
  Attachment attachment1 = Attachment::Create(this->some_data1);
  Attachment attachment2 = Attachment::Create(this->some_data2);
  AttachmentList some_attachments;
  some_attachments.push_back(attachment1);
  some_attachments.push_back(attachment2);
  this->store->Write(some_attachments, this->write_callback);
  this->ClearAndPumpLoop();
  EXPECT_EQ(AttachmentStore::SUCCESS, this->result);

  // Drop attachment1 only.
  AttachmentIdList ids;
  ids.push_back(attachment1.GetId());
  this->store->Drop(ids, this->drop_callback);
  this->ClearAndPumpLoop();
  EXPECT_EQ(AttachmentStore::SUCCESS, this->result);

  // See that attachment1 is gone.
  this->store->Read(ids, this->read_callback);
  this->ClearAndPumpLoop();
  EXPECT_EQ(AttachmentStore::UNSPECIFIED_ERROR, this->result);
  EXPECT_EQ(0U, this->attachments->size());
  EXPECT_EQ(1U, this->failed_attachment_ids->size());
  EXPECT_EQ(attachment1.GetId(), (*this->failed_attachment_ids)[0]);

  // Drop both attachment1 and attachment2.
  ids.clear();
  ids.push_back(attachment1.GetId());
  ids.push_back(attachment2.GetId());
  this->store->Drop(ids, this->drop_callback);
  this->ClearAndPumpLoop();
  EXPECT_EQ(AttachmentStore::SUCCESS, this->result);

  // See that attachment2 is now gone.
  ids.clear();
  ids.push_back(attachment2.GetId());
  this->store->Read(ids, this->read_callback);
  this->ClearAndPumpLoop();
  EXPECT_EQ(AttachmentStore::UNSPECIFIED_ERROR, this->result);
  EXPECT_EQ(0U, this->attachments->size());
  EXPECT_EQ(1U, this->failed_attachment_ids->size());
  EXPECT_EQ(attachment2.GetId(), (*this->failed_attachment_ids)[0]);
}

// Verify that attempting to drop an attachment that does not exist is not an
// error.
TYPED_TEST_P(AttachmentStoreTest, Drop_DoesNotExist) {
  Attachment attachment1 = Attachment::Create(this->some_data1);
  AttachmentList some_attachments;
  some_attachments.push_back(attachment1);
  this->store->Write(some_attachments, this->write_callback);
  this->ClearAndPumpLoop();
  EXPECT_EQ(AttachmentStore::SUCCESS, this->result);

  // Drop the attachment.
  AttachmentIdList ids;
  ids.push_back(attachment1.GetId());
  this->store->Drop(ids, this->drop_callback);
  this->ClearAndPumpLoop();
  EXPECT_EQ(AttachmentStore::SUCCESS, this->result);

  // See that it's gone.
  this->store->Read(ids, this->read_callback);
  this->ClearAndPumpLoop();
  EXPECT_EQ(AttachmentStore::UNSPECIFIED_ERROR, this->result);
  EXPECT_EQ(0U, this->attachments->size());
  EXPECT_EQ(1U, this->failed_attachment_ids->size());
  EXPECT_EQ(attachment1.GetId(), (*this->failed_attachment_ids)[0]);

  // Drop again, see that no error occurs.
  ids.clear();
  ids.push_back(attachment1.GetId());
  this->store->Drop(ids, this->drop_callback);
  this->ClearAndPumpLoop();
  EXPECT_EQ(AttachmentStore::SUCCESS, this->result);
}

// Verify getting metadata for specific attachments.
TYPED_TEST_P(AttachmentStoreTest, ReadMetadataById) {
  Attachment attachment1 = Attachment::Create(this->some_data1);
  Attachment attachment2 = Attachment::Create(this->some_data2);

  AttachmentList some_attachments;
  // Write attachment1 only.
  some_attachments.push_back(attachment1);
  this->store->Write(some_attachments, this->write_callback);
  this->ClearAndPumpLoop();
  EXPECT_EQ(AttachmentStore::SUCCESS, this->result);

  // Try to read metadata for both attachment1 and attachment2.
  AttachmentIdList ids;
  ids.push_back(attachment1.GetId());
  ids.push_back(attachment2.GetId());
  this->store->ReadMetadataById(ids, this->read_metadata_callback);
  this->ClearAndPumpLoop();

  // See that only one entry was read.
  EXPECT_EQ(AttachmentStore::UNSPECIFIED_ERROR, this->result);
  EXPECT_EQ(1U, this->attachment_metadata->size());

  // Now write attachment2.
  some_attachments[0] = attachment2;
  this->store->Write(some_attachments, this->write_callback);
  this->ClearAndPumpLoop();
  EXPECT_EQ(AttachmentStore::SUCCESS, this->result);

  // Try to read metadata for both attachment1 and attachment2 again.
  this->store->ReadMetadataById(ids, this->read_metadata_callback);
  this->ClearAndPumpLoop();
  EXPECT_EQ(AttachmentStore::SUCCESS, this->result);
  EXPECT_EQ(2U, this->attachment_metadata->size());

  // Verify that we've got both entries back in the right order.
  AttachmentMetadataList::const_iterator iter =
      this->attachment_metadata->begin();
  EXPECT_EQ(attachment1.GetId(), iter->GetId());
  ++iter;
  EXPECT_EQ(attachment2.GetId(), iter->GetId());
}

// Verify that ReadMetadata/ReadMetadataForSync returns metadata for correct
// set of attachments.
TYPED_TEST_P(AttachmentStoreTest, ReadMetadata) {
  // Try to read all metadata from an empty store.
  this->store->ReadMetadata(this->read_metadata_callback);
  this->ClearAndPumpLoop();
  EXPECT_EQ(AttachmentStore::SUCCESS, this->result);
  EXPECT_EQ(0U, this->attachment_metadata->size());

  // Create and write attachments with different set of references.
  Attachment attachment_mt = Attachment::Create(this->some_data1);
  Attachment attachment_sync = Attachment::Create(this->some_data1);
  Attachment attachment_both = Attachment::Create(this->some_data1);

  AttachmentList attachments;
  attachments.push_back(attachment_mt);
  attachments.push_back(attachment_sync);
  attachments.push_back(attachment_both);
  this->store->Write(attachments, this->write_callback);
  this->ClearAndPumpLoop();
  EXPECT_EQ(AttachmentStore::SUCCESS, this->result);

  AttachmentIdList ids;
  ids.push_back(attachment_sync.GetId());
  ids.push_back(attachment_both.GetId());
  this->store_for_sync->SetSyncReference(ids);

  ids.clear();
  ids.push_back(attachment_sync.GetId());
  this->store->Drop(ids, this->drop_callback);
  this->ClearAndPumpLoop();

  // Calling ReadMetadataById for above three attachments should only return
  // attachments with model type reference.
  ids.clear();
  ids.push_back(attachment_mt.GetId());
  ids.push_back(attachment_sync.GetId());
  ids.push_back(attachment_both.GetId());
  this->store->ReadMetadataById(ids, this->read_metadata_callback);
  this->ClearAndPumpLoop();
  EXPECT_EQ(AttachmentStore::UNSPECIFIED_ERROR, this->result);
  EXPECT_EQ(2U, this->attachment_metadata->size());
  AttachmentIdSet model_type_id_set;
  model_type_id_set.insert(attachment_mt.GetId());
  model_type_id_set.insert(attachment_both.GetId());
  EXPECT_THAT(model_type_id_set,
              testing::Contains((*this->attachment_metadata)[0].GetId()));
  EXPECT_THAT(model_type_id_set,
              testing::Contains((*this->attachment_metadata)[1].GetId()));

  // Call to ReadMetadata() should only return attachments with model type
  // reference.
  this->store->ReadMetadata(this->read_metadata_callback);
  this->ClearAndPumpLoop();
  EXPECT_EQ(AttachmentStore::SUCCESS, this->result);
  EXPECT_EQ(2U, this->attachment_metadata->size());

  // Verify that we get all attachments back (the order is undefined).
  EXPECT_THAT(model_type_id_set,
              testing::Contains((*this->attachment_metadata)[0].GetId()));
  EXPECT_THAT(model_type_id_set,
              testing::Contains((*this->attachment_metadata)[1].GetId()));

  // Call to ReadMetadataForSync() should only return attachments with sync
  // reference.
  this->store_for_sync->ReadMetadataForSync(this->read_metadata_callback);
  this->ClearAndPumpLoop();
  EXPECT_EQ(AttachmentStore::SUCCESS, this->result);
  EXPECT_EQ(2U, this->attachment_metadata->size());

  AttachmentIdSet sync_id_set;
  sync_id_set.insert(attachment_sync.GetId());
  sync_id_set.insert(attachment_both.GetId());
  EXPECT_THAT(sync_id_set,
              testing::Contains((*this->attachment_metadata)[0].GetId()));
  EXPECT_THAT(sync_id_set,
              testing::Contains((*this->attachment_metadata)[1].GetId()));
}

// Verify that setting/droping references gets reflected in ReadMetadata and
// that attachment is only deleted after last reference is droped.
TYPED_TEST_P(AttachmentStoreTest, SetSyncReference_DropSyncReference) {
  Attachment attachment = Attachment::Create(this->some_data1);
  AttachmentList attachments;
  attachments.push_back(attachment);
  AttachmentIdList ids;
  ids.push_back(attachment.GetId());

  // When writing attachment to store only model type reference should be set.
  this->store->Write(attachments, this->write_callback);

  this->store->ReadMetadata(this->read_metadata_callback);
  this->ClearAndPumpLoop();
  EXPECT_EQ(AttachmentStore::SUCCESS, this->result);
  EXPECT_EQ(1U, this->attachment_metadata->size());
  EXPECT_EQ(attachment.GetId(), this->attachment_metadata->begin()->GetId());

  this->store_for_sync->ReadMetadataForSync(this->read_metadata_callback);
  this->ClearAndPumpLoop();
  EXPECT_EQ(AttachmentStore::SUCCESS, this->result);
  EXPECT_EQ(0U, this->attachment_metadata->size());

  // After call to SetSyncReference() ReadMetadataForSync should start returning
  // attachment.
  this->store_for_sync->SetSyncReference(ids);

  this->store_for_sync->ReadMetadataForSync(this->read_metadata_callback);
  this->ClearAndPumpLoop();
  EXPECT_EQ(AttachmentStore::SUCCESS, this->result);
  EXPECT_EQ(1U, this->attachment_metadata->size());

  // Call SetSyncReference() to verify it is idempotent.
  this->store_for_sync->SetSyncReference(ids);
  this->ClearAndPumpLoop();

  // Droping attachment should remove model type reference, but there is still
  // sync reference.
  this->store->Drop(ids, this->drop_callback);
  this->ClearAndPumpLoop();
  EXPECT_EQ(AttachmentStore::SUCCESS, this->result);

  this->store->ReadMetadata(this->read_metadata_callback);
  this->ClearAndPumpLoop();
  EXPECT_EQ(AttachmentStore::SUCCESS, this->result);
  EXPECT_EQ(0U, this->attachment_metadata->size());

  this->store_for_sync->ReadMetadataForSync(this->read_metadata_callback);
  this->ClearAndPumpLoop();
  EXPECT_EQ(AttachmentStore::SUCCESS, this->result);
  EXPECT_EQ(1U, this->attachment_metadata->size());

  // ReadMetadataById should return UNSPECIFIED_ERROR, attachment doesn't have
  // model type reference.
  this->store->ReadMetadataById(ids, this->read_metadata_callback);
  this->ClearAndPumpLoop();
  EXPECT_EQ(AttachmentStore::UNSPECIFIED_ERROR, this->result);
  EXPECT_EQ(0U, this->attachment_metadata->size());

  // Call Drop() again to ensure it doesn't fail.
  this->store->Drop(ids, this->drop_callback);
  this->ClearAndPumpLoop();
  EXPECT_EQ(AttachmentStore::SUCCESS, this->result);

  // After droping sync reference attachment should be deleted from store.
  // ReadMetadataForSync should return empty result.
  this->store_for_sync->DropSyncReference(ids);

  this->store_for_sync->ReadMetadataForSync(this->read_metadata_callback);
  this->ClearAndPumpLoop();
  EXPECT_EQ(AttachmentStore::SUCCESS, this->result);
  EXPECT_EQ(0U, this->attachment_metadata->size());
}

REGISTER_TYPED_TEST_CASE_P(AttachmentStoreTest,
                           CreateAttachmentStoreForSync,
                           Write_NoOverwriteNoError,
                           Write_RoundTrip,
                           Read_OneNotFound,
                           Drop_DropTwoButOnlyOneExists,
                           Drop_DoesNotExist,
                           ReadMetadataById,
                           ReadMetadata,
                           SetSyncReference_DropSyncReference);

}  // namespace syncer

#endif  // SYNC_INTERNAL_API_ATTACHMENTS_ATTACHMENT_STORE_TEST_TEMPLATE_H_