blob: eed8e82f9f3266a6722aea06bcba1a0717adfc4e [file] [log] [blame]
[email protected]05f8087d2012-06-29 18:58:371// Copyright (c) 2012 The Chromium Authors. All rights reserved.
license.botbf09a502008-08-24 00:55:552// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
initial.commit586acc5fe2008-07-26 22:42:524
5#include "net/disk_cache/disk_cache_test_base.h"
6
dchengc7eeda422015-12-26 03:56:487#include <utility>
8
thestigd8df0332014-09-04 06:33:299#include "base/files/file_util.h"
gabf64a25e2017-05-12 19:42:5610#include "base/message_loop/message_loop.h"
[email protected]79b3fec2011-11-15 22:33:4711#include "base/path_service.h"
[email protected]94a9d1a2013-03-24 09:50:3112#include "base/run_loop.h"
[email protected]81e549a2014-08-21 04:19:5513#include "base/single_thread_task_runner.h"
Maks Orlovichb6d2d882017-10-27 12:09:2114#include "base/test/scoped_task_environment.h"
[email protected]8b2f8a52013-08-28 08:45:3515#include "base/threading/platform_thread.h"
gabf767595f2016-05-11 18:50:3516#include "base/threading/thread_task_runner_handle.h"
[email protected]e1fcf142010-08-23 18:47:2517#include "net/base/io_buffer.h"
[email protected]fb2622f2010-07-13 18:00:5618#include "net/base/net_errors.h"
[email protected]bc4fb8e2010-03-18 23:58:1719#include "net/base/test_completion_callback.h"
Maks Orlovich036fd1f2017-08-07 17:51:1120#include "net/disk_cache/backend_cleanup_tracker.h"
[email protected]c2c5cfc2014-03-03 16:35:2821#include "net/disk_cache/blockfile/backend_impl.h"
[email protected]398ad132013-04-02 15:11:0122#include "net/disk_cache/cache_util.h"
23#include "net/disk_cache/disk_cache.h"
initial.commit586acc5fe2008-07-26 22:42:5224#include "net/disk_cache/disk_cache_test_util.h"
[email protected]c2c5cfc2014-03-03 16:35:2825#include "net/disk_cache/memory/mem_backend_impl.h"
[email protected]398ad132013-04-02 15:11:0126#include "net/disk_cache/simple/simple_backend_impl.h"
Maks Orlovichf378b3a2017-10-31 16:27:3027#include "net/disk_cache/simple/simple_file_tracker.h"
[email protected]7e48c1b2013-07-12 12:15:4328#include "net/disk_cache/simple/simple_index.h"
robpercival214763f2016-07-01 23:27:0129#include "net/test/gtest_util.h"
Maks Orlovichb6d2d882017-10-27 12:09:2130#include "net/test/net_test_suite.h"
robpercival214763f2016-07-01 23:27:0131#include "testing/gmock/include/gmock/gmock.h"
32#include "testing/gtest/include/gtest/gtest.h"
33
34using net::test::IsOk;
initial.commit586acc5fe2008-07-26 22:42:5235
[email protected]79b3fec2011-11-15 22:33:4736DiskCacheTest::DiskCacheTest() {
[email protected]784f9302012-08-17 00:13:4337 CHECK(temp_dir_.CreateUniqueTempDir());
vabrb8582322016-09-09 08:05:3738 cache_path_ = temp_dir_.GetPath();
[email protected]79b3fec2011-11-15 22:33:4739}
40
Chris Watkins68b15032017-12-01 03:07:1341DiskCacheTest::~DiskCacheTest() = default;
[email protected]79b3fec2011-11-15 22:33:4742
43bool DiskCacheTest::CopyTestCache(const std::string& name) {
[email protected]6cdfd7f2013-02-08 20:40:1544 base::FilePath path;
[email protected]79b3fec2011-11-15 22:33:4745 PathService::Get(base::DIR_SOURCE_ROOT, &path);
46 path = path.AppendASCII("net");
47 path = path.AppendASCII("data");
48 path = path.AppendASCII("cache_tests");
49 path = path.AppendASCII(name);
50
51 if (!CleanupCacheDir())
52 return false;
[email protected]f0ff2ad2013-07-09 17:42:2653 return base::CopyDirectory(path, cache_path_, false);
[email protected]79b3fec2011-11-15 22:33:4754}
55
56bool DiskCacheTest::CleanupCacheDir() {
57 return DeleteCache(cache_path_);
58}
59
[email protected]17b89142008-11-07 21:52:1560void DiskCacheTest::TearDown() {
[email protected]94a9d1a2013-03-24 09:50:3161 base::RunLoop().RunUntilIdle();
[email protected]17b89142008-11-07 21:52:1562}
63
gavinpb1aaa052014-09-24 14:54:3564DiskCacheTestWithCache::TestIterator::TestIterator(
danakjd04b92d2016-04-16 01:16:4965 std::unique_ptr<disk_cache::Backend::Iterator> iterator)
dchengc7eeda422015-12-26 03:56:4866 : iterator_(std::move(iterator)) {}
gavinpb1aaa052014-09-24 14:54:3567
Chris Watkins68b15032017-12-01 03:07:1368DiskCacheTestWithCache::TestIterator::~TestIterator() = default;
gavinpb1aaa052014-09-24 14:54:3569
70int DiskCacheTestWithCache::TestIterator::OpenNextEntry(
71 disk_cache::Entry** next_entry) {
72 net::TestCompletionCallback cb;
73 int rv = iterator_->OpenNextEntry(next_entry, cb.callback());
74 return cb.GetResult(rv);
75}
76
[email protected]7aefb152011-01-21 23:46:4977DiskCacheTestWithCache::DiskCacheTestWithCache()
Maks Orlovich369c8f142017-11-02 16:22:1078 : DiskCacheTestWithCache(NetTestSuite::GetScopedTaskEnvironment()) {}
79
80DiskCacheTestWithCache::DiskCacheTestWithCache(
81 base::test::ScopedTaskEnvironment* scoped_task_env)
[email protected]8c3f5a32013-08-01 11:57:5382 : cache_impl_(NULL),
[email protected]1ed95752013-04-23 00:12:3683 simple_cache_impl_(NULL),
[email protected]7aefb152011-01-21 23:46:4984 mem_cache_(NULL),
85 mask_(0),
86 size_(0),
87 type_(net::DISK_CACHE),
88 memory_only_(false),
[email protected]398ad132013-04-02 15:11:0189 simple_cache_mode_(false),
[email protected]7e48c1b2013-07-12 12:15:4390 simple_cache_wait_for_index_(true),
[email protected]7aefb152011-01-21 23:46:4991 force_creation_(false),
92 new_eviction_(false),
93 first_cleanup_(true),
94 integrity_(true),
Maks Orlovich369c8f142017-11-02 16:22:1095 use_current_thread_(false),
96 scoped_task_env_(scoped_task_env) {}
initial.commit586acc5fe2008-07-26 22:42:5297
Chris Watkins68b15032017-12-01 03:07:1398DiskCacheTestWithCache::~DiskCacheTestWithCache() = default;
[email protected]7aefb152011-01-21 23:46:4999
[email protected]4d5e0362008-08-28 00:59:06100void DiskCacheTestWithCache::InitCache() {
initial.commit586acc5fe2008-07-26 22:42:52101 if (memory_only_)
102 InitMemoryCache();
103 else
104 InitDiskCache();
105
106 ASSERT_TRUE(NULL != cache_);
[email protected]a2553842013-04-19 14:25:18107 if (first_cleanup_)
[email protected]a9da16d2008-07-30 21:41:54108 ASSERT_EQ(0, cache_->GetEntryCount());
initial.commit586acc5fe2008-07-26 22:42:52109}
110
initial.commit586acc5fe2008-07-26 22:42:52111// We are expected to leak memory when simulating crashes.
[email protected]4d5e0362008-08-28 00:59:06112void DiskCacheTestWithCache::SimulateCrash() {
[email protected]398ad132013-04-02 15:11:01113 ASSERT_TRUE(!memory_only_);
[email protected]2a65aceb82011-12-19 20:59:27114 net::TestCompletionCallback cb;
115 int rv = cache_impl_->FlushQueueForTest(cb.callback());
robpercival214763f2016-07-01 23:27:01116 ASSERT_THAT(cb.GetResult(rv), IsOk());
initial.commit586acc5fe2008-07-26 22:42:52117 cache_impl_->ClearRefCountForTest();
118
[email protected]8c3f5a32013-08-01 11:57:53119 cache_.reset();
Maks Orlovichf3860652017-12-13 18:03:16120 EXPECT_TRUE(CheckCacheIntegrity(cache_path_, new_eviction_, size_, mask_));
initial.commit586acc5fe2008-07-26 22:42:52121
Maks Orlovich463dc502017-07-25 14:52:49122 CreateBackend(disk_cache::kNoRandom);
initial.commit586acc5fe2008-07-26 22:42:52123}
[email protected]a9da16d2008-07-30 21:41:54124
[email protected]4d5e0362008-08-28 00:59:06125void DiskCacheTestWithCache::SetTestMode() {
[email protected]398ad132013-04-02 15:11:01126 ASSERT_TRUE(!memory_only_);
[email protected]a9da16d2008-07-30 21:41:54127 cache_impl_->SetUnitTestMode();
128}
[email protected]bc4fb8e2010-03-18 23:58:17129
[email protected]7aefb152011-01-21 23:46:49130void DiskCacheTestWithCache::SetMaxSize(int size) {
131 size_ = size;
[email protected]1ed95752013-04-23 00:12:36132 if (simple_cache_impl_)
133 EXPECT_TRUE(simple_cache_impl_->SetMaxSize(size));
134
[email protected]7aefb152011-01-21 23:46:49135 if (cache_impl_)
136 EXPECT_TRUE(cache_impl_->SetMaxSize(size));
137
138 if (mem_cache_)
139 EXPECT_TRUE(mem_cache_->SetMaxSize(size));
140}
141
[email protected]bc4fb8e2010-03-18 23:58:17142int DiskCacheTestWithCache::OpenEntry(const std::string& key,
143 disk_cache::Entry** entry) {
[email protected]2a65aceb82011-12-19 20:59:27144 net::TestCompletionCallback cb;
145 int rv = cache_->OpenEntry(key, entry, cb.callback());
[email protected]bc4fb8e2010-03-18 23:58:17146 return cb.GetResult(rv);
147}
148
149int DiskCacheTestWithCache::CreateEntry(const std::string& key,
150 disk_cache::Entry** entry) {
[email protected]2a65aceb82011-12-19 20:59:27151 net::TestCompletionCallback cb;
152 int rv = cache_->CreateEntry(key, entry, cb.callback());
[email protected]bc4fb8e2010-03-18 23:58:17153 return cb.GetResult(rv);
154}
155
156int DiskCacheTestWithCache::DoomEntry(const std::string& key) {
[email protected]42c459632011-12-17 02:20:23157 net::TestCompletionCallback cb;
158 int rv = cache_->DoomEntry(key, cb.callback());
[email protected]bc4fb8e2010-03-18 23:58:17159 return cb.GetResult(rv);
160}
161
162int DiskCacheTestWithCache::DoomAllEntries() {
[email protected]6ad7c0912011-12-15 19:10:19163 net::TestCompletionCallback cb;
164 int rv = cache_->DoomAllEntries(cb.callback());
[email protected]bc4fb8e2010-03-18 23:58:17165 return cb.GetResult(rv);
166}
167
168int DiskCacheTestWithCache::DoomEntriesBetween(const base::Time initial_time,
169 const base::Time end_time) {
[email protected]6ad7c0912011-12-15 19:10:19170 net::TestCompletionCallback cb;
171 int rv = cache_->DoomEntriesBetween(initial_time, end_time, cb.callback());
[email protected]bc4fb8e2010-03-18 23:58:17172 return cb.GetResult(rv);
173}
174
175int DiskCacheTestWithCache::DoomEntriesSince(const base::Time initial_time) {
[email protected]2a65aceb82011-12-19 20:59:27176 net::TestCompletionCallback cb;
177 int rv = cache_->DoomEntriesSince(initial_time, cb.callback());
[email protected]bc4fb8e2010-03-18 23:58:17178 return cb.GetResult(rv);
179}
180
msramekaee01ceb2015-10-07 14:23:33181int DiskCacheTestWithCache::CalculateSizeOfAllEntries() {
182 net::TestCompletionCallback cb;
183 int rv = cache_->CalculateSizeOfAllEntries(cb.callback());
184 return cb.GetResult(rv);
185}
186
dullwebera0030052017-01-16 11:56:04187int DiskCacheTestWithCache::CalculateSizeOfEntriesBetween(
188 const base::Time initial_time,
189 const base::Time end_time) {
190 net::TestCompletionCallback cb;
191 int rv = cache_->CalculateSizeOfEntriesBetween(initial_time, end_time,
192 cb.callback());
193 return cb.GetResult(rv);
194}
195
danakjd04b92d2016-04-16 01:16:49196std::unique_ptr<DiskCacheTestWithCache::TestIterator>
197DiskCacheTestWithCache::CreateIterator() {
198 return std::unique_ptr<TestIterator>(
199 new TestIterator(cache_->CreateIterator()));
[email protected]bc4fb8e2010-03-18 23:58:17200}
[email protected]fb2622f2010-07-13 18:00:56201
202void DiskCacheTestWithCache::FlushQueueForTest() {
203 if (memory_only_ || !cache_impl_)
204 return;
205
[email protected]2a65aceb82011-12-19 20:59:27206 net::TestCompletionCallback cb;
207 int rv = cache_impl_->FlushQueueForTest(cb.callback());
robpercival214763f2016-07-01 23:27:01208 EXPECT_THAT(cb.GetResult(rv), IsOk());
[email protected]fb2622f2010-07-13 18:00:56209}
[email protected]e1fcf142010-08-23 18:47:25210
[email protected]f27bbe002011-12-22 11:29:34211void DiskCacheTestWithCache::RunTaskForTest(const base::Closure& closure) {
[email protected]65188eb2010-09-16 20:59:29212 if (memory_only_ || !cache_impl_) {
[email protected]f27bbe002011-12-22 11:29:34213 closure.Run();
[email protected]65188eb2010-09-16 20:59:29214 return;
215 }
216
[email protected]2a65aceb82011-12-19 20:59:27217 net::TestCompletionCallback cb;
[email protected]f27bbe002011-12-22 11:29:34218 int rv = cache_impl_->RunTaskForTest(closure, cb.callback());
robpercival214763f2016-07-01 23:27:01219 EXPECT_THAT(cb.GetResult(rv), IsOk());
[email protected]65188eb2010-09-16 20:59:29220}
221
[email protected]e1fcf142010-08-23 18:47:25222int DiskCacheTestWithCache::ReadData(disk_cache::Entry* entry, int index,
223 int offset, net::IOBuffer* buf, int len) {
[email protected]2a65aceb82011-12-19 20:59:27224 net::TestCompletionCallback cb;
225 int rv = entry->ReadData(index, offset, buf, len, cb.callback());
[email protected]e1fcf142010-08-23 18:47:25226 return cb.GetResult(rv);
227}
228
[email protected]e1fcf142010-08-23 18:47:25229int DiskCacheTestWithCache::WriteData(disk_cache::Entry* entry, int index,
230 int offset, net::IOBuffer* buf, int len,
231 bool truncate) {
[email protected]2a65aceb82011-12-19 20:59:27232 net::TestCompletionCallback cb;
233 int rv = entry->WriteData(index, offset, buf, len, cb.callback(), truncate);
[email protected]e1fcf142010-08-23 18:47:25234 return cb.GetResult(rv);
235}
236
237int DiskCacheTestWithCache::ReadSparseData(disk_cache::Entry* entry,
Avi Drissman13fc8932015-12-20 04:40:46238 int64_t offset,
239 net::IOBuffer* buf,
[email protected]e1fcf142010-08-23 18:47:25240 int len) {
[email protected]2a65aceb82011-12-19 20:59:27241 net::TestCompletionCallback cb;
242 int rv = entry->ReadSparseData(offset, buf, len, cb.callback());
[email protected]e1fcf142010-08-23 18:47:25243 return cb.GetResult(rv);
244}
245
246int DiskCacheTestWithCache::WriteSparseData(disk_cache::Entry* entry,
Avi Drissman13fc8932015-12-20 04:40:46247 int64_t offset,
248 net::IOBuffer* buf,
249 int len) {
[email protected]2a65aceb82011-12-19 20:59:27250 net::TestCompletionCallback cb;
251 int rv = entry->WriteSparseData(offset, buf, len, cb.callback());
[email protected]e1fcf142010-08-23 18:47:25252 return cb.GetResult(rv);
253}
[email protected]7aefb152011-01-21 23:46:49254
[email protected]ceb61da32011-01-25 23:52:02255void DiskCacheTestWithCache::TrimForTest(bool empty) {
[email protected]f27bbe002011-12-22 11:29:34256 RunTaskForTest(base::Bind(&disk_cache::BackendImpl::TrimForTest,
257 base::Unretained(cache_impl_),
258 empty));
[email protected]ceb61da32011-01-25 23:52:02259}
260
261void DiskCacheTestWithCache::TrimDeletedListForTest(bool empty) {
[email protected]f27bbe002011-12-22 11:29:34262 RunTaskForTest(base::Bind(&disk_cache::BackendImpl::TrimDeletedListForTest,
263 base::Unretained(cache_impl_),
264 empty));
[email protected]ceb61da32011-01-25 23:52:02265}
266
[email protected]05f8087d2012-06-29 18:58:37267void DiskCacheTestWithCache::AddDelay() {
[email protected]8b2f8a52013-08-28 08:45:35268 if (simple_cache_mode_) {
269 // The simple cache uses second resolution for many timeouts, so it's safest
270 // to advance by at least whole seconds before falling back into the normal
271 // disk cache epsilon advance.
272 const base::Time initial_time = base::Time::Now();
273 do {
274 base::PlatformThread::YieldCurrentThread();
275 } while (base::Time::Now() -
276 initial_time < base::TimeDelta::FromSeconds(1));
277 }
278
[email protected]05f8087d2012-06-29 18:58:37279 base::Time initial = base::Time::Now();
280 while (base::Time::Now() <= initial) {
281 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(1));
282 };
283}
284
[email protected]7aefb152011-01-21 23:46:49285void DiskCacheTestWithCache::TearDown() {
Maks Orlovich369c8f142017-11-02 16:22:10286 scoped_task_env_->RunUntilIdle();
[email protected]8c3f5a32013-08-01 11:57:53287 cache_.reset();
[email protected]7aefb152011-01-21 23:46:49288
[email protected]fccce902013-04-15 19:00:51289 if (!memory_only_ && !simple_cache_mode_ && integrity_) {
Maks Orlovichf3860652017-12-13 18:03:16290 EXPECT_TRUE(CheckCacheIntegrity(cache_path_, new_eviction_, size_, mask_));
[email protected]7aefb152011-01-21 23:46:49291 }
Maks Orlovich369c8f142017-11-02 16:22:10292 scoped_task_env_->RunUntilIdle();
Maks Orlovichf378b3a2017-10-31 16:27:30293 if (simple_cache_mode_ && simple_file_tracker_)
294 EXPECT_TRUE(simple_file_tracker_->IsEmptyForTesting());
295
[email protected]de677dc2013-09-13 02:12:25296 DiskCacheTest::TearDown();
Maks Orlovich369c8f142017-11-02 16:22:10297
298 // We are documented as not keeping this past TearDown, and net_perftests
299 // is written under this assumption.
300 scoped_task_env_ = nullptr;
[email protected]7aefb152011-01-21 23:46:49301}
302
303void DiskCacheTestWithCache::InitMemoryCache() {
[email protected]9eb8cdf2011-03-17 18:53:02304 mem_cache_ = new disk_cache::MemBackendImpl(NULL);
[email protected]8c3f5a32013-08-01 11:57:53305 cache_.reset(mem_cache_);
306 ASSERT_TRUE(cache_);
[email protected]7aefb152011-01-21 23:46:49307
308 if (size_)
309 EXPECT_TRUE(mem_cache_->SetMaxSize(size_));
310
311 ASSERT_TRUE(mem_cache_->Init());
312}
313
314void DiskCacheTestWithCache::InitDiskCache() {
[email protected]7aefb152011-01-21 23:46:49315 if (first_cleanup_)
[email protected]79b3fec2011-11-15 22:33:47316 ASSERT_TRUE(CleanupCacheDir());
[email protected]7aefb152011-01-21 23:46:49317
Maks Orlovich463dc502017-07-25 14:52:49318 CreateBackend(disk_cache::kNoRandom);
[email protected]398ad132013-04-02 15:11:01319}
[email protected]7aefb152011-01-21 23:46:49320
Maks Orlovich463dc502017-07-25 14:52:49321void DiskCacheTestWithCache::CreateBackend(uint32_t flags) {
[email protected]81e549a2014-08-21 04:19:55322 scoped_refptr<base::SingleThreadTaskRunner> runner;
[email protected]398ad132013-04-02 15:11:01323 if (use_current_thread_)
[email protected]81e549a2014-08-21 04:19:55324 runner = base::ThreadTaskRunnerHandle::Get();
[email protected]7aefb152011-01-21 23:46:49325 else
Maks Orlovich463dc502017-07-25 14:52:49326 runner = nullptr; // let the backend sort it out.
[email protected]7aefb152011-01-21 23:46:49327
[email protected]398ad132013-04-02 15:11:01328 if (simple_cache_mode_) {
Maks Orlovich922db0c2018-02-21 15:28:46329 DCHECK(!use_current_thread_)
330 << "Using current thread unsupported by SimpleCache";
[email protected]398ad132013-04-02 15:11:01331 net::TestCompletionCallback cb;
Maks Orlovichdb1f0922018-01-31 03:41:17332 // We limit ourselves to 64 fds since OS X by default gives us 256.
333 // (Chrome raises the number on startup, but the test fixture doesn't).
Maks Orlovichf378b3a2017-10-31 16:27:30334 if (!simple_file_tracker_)
Maks Orlovichdb1f0922018-01-31 03:41:17335 simple_file_tracker_ =
336 std::make_unique<disk_cache::SimpleFileTracker>(64);
Maks Orlovichf378b3a2017-10-31 16:27:30337 std::unique_ptr<disk_cache::SimpleBackendImpl> simple_backend =
338 std::make_unique<disk_cache::SimpleBackendImpl>(
339 cache_path_, /* cleanup_tracker = */ nullptr,
Maks Orlovich922db0c2018-02-21 15:28:46340 simple_file_tracker_.get(), size_, type_, /*net_log = */ nullptr);
[email protected]00831c822013-04-10 15:37:12341 int rv = simple_backend->Init(cb.callback());
robpercival214763f2016-07-01 23:27:01342 ASSERT_THAT(cb.GetResult(rv), IsOk());
[email protected]8c3f5a32013-08-01 11:57:53343 simple_cache_impl_ = simple_backend.get();
dchengc7eeda422015-12-26 03:56:48344 cache_ = std::move(simple_backend);
[email protected]7e48c1b2013-07-12 12:15:43345 if (simple_cache_wait_for_index_) {
346 net::TestCompletionCallback wait_for_index_cb;
[email protected]8c3f5a32013-08-01 11:57:53347 rv = simple_cache_impl_->index()->ExecuteWhenReady(
[email protected]7e48c1b2013-07-12 12:15:43348 wait_for_index_cb.callback());
robpercival214763f2016-07-01 23:27:01349 ASSERT_THAT(wait_for_index_cb.GetResult(rv), IsOk());
[email protected]7e48c1b2013-07-12 12:15:43350 }
[email protected]398ad132013-04-02 15:11:01351 return;
352 }
353
354 if (mask_)
Maks Orlovich036fd1f2017-08-07 17:51:11355 cache_impl_ = new disk_cache::BackendImpl(cache_path_, mask_, runner,
356 /* net_log = */ nullptr);
[email protected]398ad132013-04-02 15:11:01357 else
Maks Orlovich036fd1f2017-08-07 17:51:11358 cache_impl_ = new disk_cache::BackendImpl(cache_path_,
359 /* cleanup_tracker = */ nullptr,
360 runner, /* net_log = */ nullptr);
[email protected]8c3f5a32013-08-01 11:57:53361 cache_.reset(cache_impl_);
362 ASSERT_TRUE(cache_);
[email protected]7aefb152011-01-21 23:46:49363 if (size_)
364 EXPECT_TRUE(cache_impl_->SetMaxSize(size_));
[email protected]7aefb152011-01-21 23:46:49365 if (new_eviction_)
366 cache_impl_->SetNewEviction();
[email protected]7aefb152011-01-21 23:46:49367 cache_impl_->SetType(type_);
[email protected]398ad132013-04-02 15:11:01368 cache_impl_->SetFlags(flags);
[email protected]42c459632011-12-17 02:20:23369 net::TestCompletionCallback cb;
370 int rv = cache_impl_->Init(cb.callback());
robpercival214763f2016-07-01 23:27:01371 ASSERT_THAT(cb.GetResult(rv), IsOk());
[email protected]7aefb152011-01-21 23:46:49372}