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

Side by Side Diff: net/disk_cache/disk_cache_test_base.cc

Issue 1535363003: Switch to standard integer types in net/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stddef Created 5 years 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
« no previous file with comments | « net/disk_cache/disk_cache_test_base.h ('k') | net/disk_cache/disk_cache_test_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "net/disk_cache/disk_cache_test_base.h" 5 #include "net/disk_cache/disk_cache_test_base.h"
6 6
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 207
208 int DiskCacheTestWithCache::WriteData(disk_cache::Entry* entry, int index, 208 int DiskCacheTestWithCache::WriteData(disk_cache::Entry* entry, int index,
209 int offset, net::IOBuffer* buf, int len, 209 int offset, net::IOBuffer* buf, int len,
210 bool truncate) { 210 bool truncate) {
211 net::TestCompletionCallback cb; 211 net::TestCompletionCallback cb;
212 int rv = entry->WriteData(index, offset, buf, len, cb.callback(), truncate); 212 int rv = entry->WriteData(index, offset, buf, len, cb.callback(), truncate);
213 return cb.GetResult(rv); 213 return cb.GetResult(rv);
214 } 214 }
215 215
216 int DiskCacheTestWithCache::ReadSparseData(disk_cache::Entry* entry, 216 int DiskCacheTestWithCache::ReadSparseData(disk_cache::Entry* entry,
217 int64 offset, net::IOBuffer* buf, 217 int64_t offset,
218 net::IOBuffer* buf,
218 int len) { 219 int len) {
219 net::TestCompletionCallback cb; 220 net::TestCompletionCallback cb;
220 int rv = entry->ReadSparseData(offset, buf, len, cb.callback()); 221 int rv = entry->ReadSparseData(offset, buf, len, cb.callback());
221 return cb.GetResult(rv); 222 return cb.GetResult(rv);
222 } 223 }
223 224
224 int DiskCacheTestWithCache::WriteSparseData(disk_cache::Entry* entry, 225 int DiskCacheTestWithCache::WriteSparseData(disk_cache::Entry* entry,
225 int64 offset, 226 int64_t offset,
226 net::IOBuffer* buf, int len) { 227 net::IOBuffer* buf,
228 int len) {
227 net::TestCompletionCallback cb; 229 net::TestCompletionCallback cb;
228 int rv = entry->WriteSparseData(offset, buf, len, cb.callback()); 230 int rv = entry->WriteSparseData(offset, buf, len, cb.callback());
229 return cb.GetResult(rv); 231 return cb.GetResult(rv);
230 } 232 }
231 233
232 void DiskCacheTestWithCache::TrimForTest(bool empty) { 234 void DiskCacheTestWithCache::TrimForTest(bool empty) {
233 RunTaskForTest(base::Bind(&disk_cache::BackendImpl::TrimForTest, 235 RunTaskForTest(base::Bind(&disk_cache::BackendImpl::TrimForTest,
234 base::Unretained(cache_impl_), 236 base::Unretained(cache_impl_),
235 empty)); 237 empty));
236 } 238 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 294
293 if (!cache_thread_.IsRunning()) { 295 if (!cache_thread_.IsRunning()) {
294 ASSERT_TRUE(cache_thread_.StartWithOptions( 296 ASSERT_TRUE(cache_thread_.StartWithOptions(
295 base::Thread::Options(base::MessageLoop::TYPE_IO, 0))); 297 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)));
296 } 298 }
297 ASSERT_TRUE(cache_thread_.message_loop() != NULL); 299 ASSERT_TRUE(cache_thread_.message_loop() != NULL);
298 300
299 CreateBackend(disk_cache::kNoRandom, &cache_thread_); 301 CreateBackend(disk_cache::kNoRandom, &cache_thread_);
300 } 302 }
301 303
302 void DiskCacheTestWithCache::CreateBackend(uint32 flags, base::Thread* thread) { 304 void DiskCacheTestWithCache::CreateBackend(uint32_t flags,
305 base::Thread* thread) {
303 scoped_refptr<base::SingleThreadTaskRunner> runner; 306 scoped_refptr<base::SingleThreadTaskRunner> runner;
304 if (use_current_thread_) 307 if (use_current_thread_)
305 runner = base::ThreadTaskRunnerHandle::Get(); 308 runner = base::ThreadTaskRunnerHandle::Get();
306 else 309 else
307 runner = thread->task_runner(); 310 runner = thread->task_runner();
308 311
309 if (simple_cache_mode_) { 312 if (simple_cache_mode_) {
310 net::TestCompletionCallback cb; 313 net::TestCompletionCallback cb;
311 scoped_ptr<disk_cache::SimpleBackendImpl> simple_backend( 314 scoped_ptr<disk_cache::SimpleBackendImpl> simple_backend(
312 new disk_cache::SimpleBackendImpl( 315 new disk_cache::SimpleBackendImpl(
(...skipping 20 matching lines...) Expand all
333 if (size_) 336 if (size_)
334 EXPECT_TRUE(cache_impl_->SetMaxSize(size_)); 337 EXPECT_TRUE(cache_impl_->SetMaxSize(size_));
335 if (new_eviction_) 338 if (new_eviction_)
336 cache_impl_->SetNewEviction(); 339 cache_impl_->SetNewEviction();
337 cache_impl_->SetType(type_); 340 cache_impl_->SetType(type_);
338 cache_impl_->SetFlags(flags); 341 cache_impl_->SetFlags(flags);
339 net::TestCompletionCallback cb; 342 net::TestCompletionCallback cb;
340 int rv = cache_impl_->Init(cb.callback()); 343 int rv = cache_impl_->Init(cb.callback());
341 ASSERT_EQ(net::OK, cb.GetResult(rv)); 344 ASSERT_EQ(net::OK, cb.GetResult(rv));
342 } 345 }
OLDNEW
« no previous file with comments | « net/disk_cache/disk_cache_test_base.h ('k') | net/disk_cache/disk_cache_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698