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

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

Issue 10824336: Run the disk cache tests in scoped temporary directories instead of a fixed directory so that they … (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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 | Annotate | Revision Log
« 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/file_util.h" 7 #include "base/file_util.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "net/base/io_buffer.h" 9 #include "net/base/io_buffer.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
11 #include "net/base/test_completion_callback.h" 11 #include "net/base/test_completion_callback.h"
12 #include "net/disk_cache/backend_impl.h" 12 #include "net/disk_cache/backend_impl.h"
13 #include "net/disk_cache/disk_cache_test_util.h" 13 #include "net/disk_cache/disk_cache_test_util.h"
14 #include "net/disk_cache/mem_backend_impl.h" 14 #include "net/disk_cache/mem_backend_impl.h"
15 15
16 DiskCacheTest::DiskCacheTest() { 16 DiskCacheTest::DiskCacheTest() {
17 cache_path_ = GetCacheFilePath(); 17 CHECK(temp_dir_.CreateUniqueTempDir());
18 cache_path_ = temp_dir_.path();
18 if (!MessageLoop::current()) 19 if (!MessageLoop::current())
19 message_loop_.reset(new MessageLoopForIO()); 20 message_loop_.reset(new MessageLoopForIO());
20 } 21 }
21 22
22 DiskCacheTest::~DiskCacheTest() { 23 DiskCacheTest::~DiskCacheTest() {
23 } 24 }
24 25
25 bool DiskCacheTest::CopyTestCache(const std::string& name) { 26 bool DiskCacheTest::CopyTestCache(const std::string& name) {
26 FilePath path; 27 FilePath path;
27 PathService::Get(base::DIR_SOURCE_ROOT, &path); 28 PathService::Get(base::DIR_SOURCE_ROOT, &path);
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 291
291 if (new_eviction_) 292 if (new_eviction_)
292 cache_impl_->SetNewEviction(); 293 cache_impl_->SetNewEviction();
293 294
294 cache_impl_->SetType(type_); 295 cache_impl_->SetType(type_);
295 cache_impl_->SetFlags(disk_cache::kNoRandom); 296 cache_impl_->SetFlags(disk_cache::kNoRandom);
296 net::TestCompletionCallback cb; 297 net::TestCompletionCallback cb;
297 int rv = cache_impl_->Init(cb.callback()); 298 int rv = cache_impl_->Init(cb.callback());
298 ASSERT_EQ(net::OK, cb.GetResult(rv)); 299 ASSERT_EQ(net::OK, cb.GetResult(rv));
299 } 300 }
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