| 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/internal_api/public/attachments/on_disk_attachment_store.h" | 5 #include "sync/internal_api/public/attachments/on_disk_attachment_store.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | |
| 9 #include <string> | 8 #include <string> |
| 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
| 13 #include "base/files/scoped_temp_dir.h" | 13 #include "base/files/scoped_temp_dir.h" |
| 14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 15 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
| 16 #include "base/thread_task_runner_handle.h" | 16 #include "base/thread_task_runner_handle.h" |
| 17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 18 #include "sync/internal_api/attachments/attachment_store_test_template.h" | 18 #include "sync/internal_api/attachments/attachment_store_test_template.h" |
| 19 #include "sync/internal_api/attachments/proto/attachment_store.pb.h" | 19 #include "sync/internal_api/attachments/proto/attachment_store.pb.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 CopyResult(destination_result, source_result); | 92 CopyResult(destination_result, source_result); |
| 93 *destination_failed_attachment_ids = *source_failed_attachment_ids; | 93 *destination_failed_attachment_ids = *source_failed_attachment_ids; |
| 94 } | 94 } |
| 95 | 95 |
| 96 void CopyResultMetadata( | 96 void CopyResultMetadata( |
| 97 AttachmentStore::Result* destination_result, | 97 AttachmentStore::Result* destination_result, |
| 98 scoped_ptr<AttachmentMetadataList>* destination_metadata, | 98 scoped_ptr<AttachmentMetadataList>* destination_metadata, |
| 99 const AttachmentStore::Result& source_result, | 99 const AttachmentStore::Result& source_result, |
| 100 scoped_ptr<AttachmentMetadataList> source_metadata) { | 100 scoped_ptr<AttachmentMetadataList> source_metadata) { |
| 101 CopyResult(destination_result, source_result); | 101 CopyResult(destination_result, source_result); |
| 102 *destination_metadata = source_metadata.Pass(); | 102 *destination_metadata = std::move(source_metadata); |
| 103 } | 103 } |
| 104 | 104 |
| 105 scoped_ptr<leveldb::DB> OpenLevelDB() { | 105 scoped_ptr<leveldb::DB> OpenLevelDB() { |
| 106 leveldb::DB* db; | 106 leveldb::DB* db; |
| 107 leveldb::Options options; | 107 leveldb::Options options; |
| 108 options.create_if_missing = true; | 108 options.create_if_missing = true; |
| 109 leveldb::Status s = | 109 leveldb::Status s = |
| 110 leveldb::DB::Open(options, db_path_.AsUTF8Unsafe(), &db); | 110 leveldb::DB::Open(options, db_path_.AsUTF8Unsafe(), &db); |
| 111 EXPECT_TRUE(s.ok()); | 111 EXPECT_TRUE(s.ok()); |
| 112 return make_scoped_ptr(db); | 112 return make_scoped_ptr(db); |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 store_->ReadMetadata( | 513 store_->ReadMetadata( |
| 514 base::Bind(&OnDiskAttachmentStoreSpecificTest::CopyResultMetadata, | 514 base::Bind(&OnDiskAttachmentStoreSpecificTest::CopyResultMetadata, |
| 515 base::Unretained(this), &metadata_result, &metadata_list)); | 515 base::Unretained(this), &metadata_result, &metadata_list)); |
| 516 RunLoop(); | 516 RunLoop(); |
| 517 EXPECT_EQ(AttachmentStore::SUCCESS, create_result); | 517 EXPECT_EQ(AttachmentStore::SUCCESS, create_result); |
| 518 EXPECT_EQ(AttachmentStore::UNSPECIFIED_ERROR, metadata_result); | 518 EXPECT_EQ(AttachmentStore::UNSPECIFIED_ERROR, metadata_result); |
| 519 EXPECT_EQ(2U, metadata_list->size()); | 519 EXPECT_EQ(2U, metadata_list->size()); |
| 520 } | 520 } |
| 521 | 521 |
| 522 } // namespace syncer | 522 } // namespace syncer |
| OLD | NEW |