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

Side by Side Diff: sync/internal_api/attachments/attachment_store_frontend_unittest.cc

Issue 1866243002: Convert //sync from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/attachment_store_frontend.h" 5 #include "sync/internal_api/public/attachments/attachment_store_frontend.h"
6 6
7 #include <memory>
7 #include <utility> 8 #include <utility>
8 9
9 #include "base/bind.h" 10 #include "base/bind.h"
10 #include "base/callback.h" 11 #include "base/callback.h"
11 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/run_loop.h" 14 #include "base/run_loop.h"
15 #include "base/thread_task_runner_handle.h" 15 #include "base/thread_task_runner_handle.h"
16 #include "sync/api/attachments/attachment.h" 16 #include "sync/api/attachments/attachment.h"
17 #include "sync/api/attachments/attachment_id.h" 17 #include "sync/api/attachments/attachment_id.h"
18 #include "sync/api/attachments/attachment_store_backend.h" 18 #include "sync/api/attachments/attachment_store_backend.h"
19 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
20 20
21 namespace syncer { 21 namespace syncer {
22 22
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 : init_call_count_(0), 102 : init_call_count_(0),
103 read_call_count_(0), 103 read_call_count_(0),
104 write_call_count_(0), 104 write_call_count_(0),
105 add_component_call_count_(0), 105 add_component_call_count_(0),
106 drop_call_count_(0), 106 drop_call_count_(0),
107 read_metadata_by_id_call_count_(0), 107 read_metadata_by_id_call_count_(0),
108 read_metadata_call_count_(0), 108 read_metadata_call_count_(0),
109 dtor_call_count_(0) {} 109 dtor_call_count_(0) {}
110 110
111 void SetUp() override { 111 void SetUp() override {
112 scoped_ptr<AttachmentStoreBackend> backend(new MockAttachmentStore( 112 std::unique_ptr<AttachmentStoreBackend> backend(new MockAttachmentStore(
113 base::Bind(&AttachmentStoreFrontendTest::InitCalled, 113 base::Bind(&AttachmentStoreFrontendTest::InitCalled,
114 base::Unretained(this)), 114 base::Unretained(this)),
115 base::Bind(&AttachmentStoreFrontendTest::ReadCalled, 115 base::Bind(&AttachmentStoreFrontendTest::ReadCalled,
116 base::Unretained(this)), 116 base::Unretained(this)),
117 base::Bind(&AttachmentStoreFrontendTest::WriteCalled, 117 base::Bind(&AttachmentStoreFrontendTest::WriteCalled,
118 base::Unretained(this)), 118 base::Unretained(this)),
119 base::Bind(&AttachmentStoreFrontendTest::SetReferenceCalled, 119 base::Bind(&AttachmentStoreFrontendTest::SetReferenceCalled,
120 base::Unretained(this)), 120 base::Unretained(this)),
121 base::Bind(&AttachmentStoreFrontendTest::DropReferenceCalled, 121 base::Bind(&AttachmentStoreFrontendTest::DropReferenceCalled,
122 base::Unretained(this)), 122 base::Unretained(this)),
123 base::Bind(&AttachmentStoreFrontendTest::ReadMetadataByIdCalled, 123 base::Bind(&AttachmentStoreFrontendTest::ReadMetadataByIdCalled,
124 base::Unretained(this)), 124 base::Unretained(this)),
125 base::Bind(&AttachmentStoreFrontendTest::ReadMetadataCalled, 125 base::Bind(&AttachmentStoreFrontendTest::ReadMetadataCalled,
126 base::Unretained(this)), 126 base::Unretained(this)),
127 base::Bind(&AttachmentStoreFrontendTest::DtorCalled, 127 base::Bind(&AttachmentStoreFrontendTest::DtorCalled,
128 base::Unretained(this)))); 128 base::Unretained(this))));
129 attachment_store_frontend_ = new AttachmentStoreFrontend( 129 attachment_store_frontend_ = new AttachmentStoreFrontend(
130 std::move(backend), base::ThreadTaskRunnerHandle::Get()); 130 std::move(backend), base::ThreadTaskRunnerHandle::Get());
131 } 131 }
132 132
133 static void DoneWithResult(const AttachmentStore::Result& result) { 133 static void DoneWithResult(const AttachmentStore::Result& result) {
134 NOTREACHED(); 134 NOTREACHED();
135 } 135 }
136 136
137 static void ReadDone(const AttachmentStore::Result& result, 137 static void ReadDone(
138 scoped_ptr<AttachmentMap> attachments, 138 const AttachmentStore::Result& result,
139 scoped_ptr<AttachmentIdList> unavailable_attachments) { 139 std::unique_ptr<AttachmentMap> attachments,
140 std::unique_ptr<AttachmentIdList> unavailable_attachments) {
140 NOTREACHED(); 141 NOTREACHED();
141 } 142 }
142 143
143 static void ReadMetadataDone(const AttachmentStore::Result& result, 144 static void ReadMetadataDone(
144 scoped_ptr<AttachmentMetadataList> metadata) { 145 const AttachmentStore::Result& result,
146 std::unique_ptr<AttachmentMetadataList> metadata) {
145 NOTREACHED(); 147 NOTREACHED();
146 } 148 }
147 149
148 void InitCalled() { ++init_call_count_; } 150 void InitCalled() { ++init_call_count_; }
149 151
150 void ReadCalled() { ++read_call_count_; } 152 void ReadCalled() { ++read_call_count_; }
151 153
152 void WriteCalled() { ++write_call_count_; } 154 void WriteCalled() { ++write_call_count_; }
153 155
154 void SetReferenceCalled() { ++add_component_call_count_; } 156 void SetReferenceCalled() { ++add_component_call_count_; }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 230
229 // Releasing referehce to AttachmentStoreFrontend should result in 231 // Releasing referehce to AttachmentStoreFrontend should result in
230 // MockAttachmentStore being deleted on backend loop. 232 // MockAttachmentStore being deleted on backend loop.
231 attachment_store_frontend_ = NULL; 233 attachment_store_frontend_ = NULL;
232 EXPECT_EQ(dtor_call_count_, 0); 234 EXPECT_EQ(dtor_call_count_, 0);
233 RunMessageLoop(); 235 RunMessageLoop();
234 EXPECT_EQ(dtor_call_count_, 1); 236 EXPECT_EQ(dtor_call_count_, 1);
235 } 237 }
236 238
237 } // namespace syncer 239 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698