Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(528)

Side by Side Diff: components/sync/core_impl/attachments/on_disk_attachment_store_unittest.cc

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "components/sync/core/attachments/on_disk_attachment_store.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/files/file_util.h" 13 #include "base/files/file_util.h"
14 #include "base/files/scoped_temp_dir.h" 14 #include "base/files/scoped_temp_dir.h"
15 #include "base/memory/ptr_util.h" 15 #include "base/memory/ptr_util.h"
16 #include "base/message_loop/message_loop.h" 16 #include "base/message_loop/message_loop.h"
17 #include "base/run_loop.h" 17 #include "base/run_loop.h"
18 #include "base/threading/thread_task_runner_handle.h" 18 #include "base/threading/thread_task_runner_handle.h"
19 #include "base/time/time.h" 19 #include "base/time/time.h"
20 #include "sync/internal_api/attachments/attachment_store_test_template.h" 20 #include "components/sync/core_impl/attachments/attachment_store_test_template.h "
21 #include "sync/internal_api/attachments/proto/attachment_store.pb.h" 21 #include "components/sync/core_impl/attachments/proto/attachment_store.pb.h"
22 #include "testing/gmock/include/gmock/gmock.h" 22 #include "testing/gmock/include/gmock/gmock.h"
23 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
24 #include "third_party/leveldatabase/src/include/leveldb/db.h" 24 #include "third_party/leveldatabase/src/include/leveldb/db.h"
25 #include "third_party/leveldatabase/src/include/leveldb/options.h" 25 #include "third_party/leveldatabase/src/include/leveldb/options.h"
26 #include "third_party/leveldatabase/src/include/leveldb/slice.h" 26 #include "third_party/leveldatabase/src/include/leveldb/slice.h"
27 #include "third_party/leveldatabase/src/include/leveldb/status.h" 27 #include "third_party/leveldatabase/src/include/leveldb/status.h"
28 28
29 namespace syncer { 29 namespace syncer {
30 30
31 namespace { 31 namespace {
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 EXPECT_EQ(AttachmentStore::SUCCESS, result); 180 EXPECT_EQ(AttachmentStore::SUCCESS, result);
181 181
182 result = AttachmentStore::UNSPECIFIED_ERROR; 182 result = AttachmentStore::UNSPECIFIED_ERROR;
183 std::string some_data = "data"; 183 std::string some_data = "data";
184 Attachment attachment = 184 Attachment attachment =
185 Attachment::Create(base::RefCountedString::TakeString(&some_data)); 185 Attachment::Create(base::RefCountedString::TakeString(&some_data));
186 AttachmentList attachments; 186 AttachmentList attachments;
187 attachments.push_back(attachment); 187 attachments.push_back(attachment);
188 store_->Write(attachments, 188 store_->Write(attachments,
189 base::Bind(&OnDiskAttachmentStoreSpecificTest::CopyResult, 189 base::Bind(&OnDiskAttachmentStoreSpecificTest::CopyResult,
190 base::Unretained(this), 190 base::Unretained(this), &result));
191 &result));
192 RunLoop(); 191 RunLoop();
193 EXPECT_EQ(AttachmentStore::SUCCESS, result); 192 EXPECT_EQ(AttachmentStore::SUCCESS, result);
194 193
195 // Close and reopen attachment store. 194 // Close and reopen attachment store.
196 store_ = nullptr; 195 store_ = nullptr;
197 result = AttachmentStore::UNSPECIFIED_ERROR; 196 result = AttachmentStore::UNSPECIFIED_ERROR;
198 store_ = AttachmentStore::CreateOnDiskStore( 197 store_ = AttachmentStore::CreateOnDiskStore(
199 temp_dir_.path(), base::ThreadTaskRunnerHandle::Get(), 198 temp_dir_.path(), base::ThreadTaskRunnerHandle::Get(),
200 base::Bind(&AttachmentStoreCreated, &result)); 199 base::Bind(&AttachmentStoreCreated, &result));
201 RunLoop(); 200 RunLoop();
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 store_->ReadMetadata( 514 store_->ReadMetadata(
516 base::Bind(&OnDiskAttachmentStoreSpecificTest::CopyResultMetadata, 515 base::Bind(&OnDiskAttachmentStoreSpecificTest::CopyResultMetadata,
517 base::Unretained(this), &metadata_result, &metadata_list)); 516 base::Unretained(this), &metadata_result, &metadata_list));
518 RunLoop(); 517 RunLoop();
519 EXPECT_EQ(AttachmentStore::SUCCESS, create_result); 518 EXPECT_EQ(AttachmentStore::SUCCESS, create_result);
520 EXPECT_EQ(AttachmentStore::UNSPECIFIED_ERROR, metadata_result); 519 EXPECT_EQ(AttachmentStore::UNSPECIFIED_ERROR, metadata_result);
521 EXPECT_EQ(2U, metadata_list->size()); 520 EXPECT_EQ(2U, metadata_list->size());
522 } 521 }
523 522
524 } // namespace syncer 523 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698