OLD | NEW |
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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "net/disk_cache/simple/simple_index.h" | 24 #include "net/disk_cache/simple/simple_index.h" |
25 #include "net/test/gtest_util.h" | 25 #include "net/test/gtest_util.h" |
26 #include "testing/gmock/include/gmock/gmock.h" | 26 #include "testing/gmock/include/gmock/gmock.h" |
27 #include "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" |
28 | 28 |
29 using net::test::IsOk; | 29 using net::test::IsOk; |
30 | 30 |
31 DiskCacheTest::DiskCacheTest() { | 31 DiskCacheTest::DiskCacheTest() { |
32 CHECK(temp_dir_.CreateUniqueTempDir()); | 32 CHECK(temp_dir_.CreateUniqueTempDir()); |
33 cache_path_ = temp_dir_.GetPath(); | 33 cache_path_ = temp_dir_.GetPath(); |
34 if (!base::MessageLoop::current()) | |
35 message_loop_.reset(new base::MessageLoopForIO()); | |
36 } | 34 } |
37 | 35 |
38 DiskCacheTest::~DiskCacheTest() { | 36 DiskCacheTest::~DiskCacheTest() { |
39 } | 37 } |
40 | 38 |
41 bool DiskCacheTest::CopyTestCache(const std::string& name) { | 39 bool DiskCacheTest::CopyTestCache(const std::string& name) { |
42 base::FilePath path; | 40 base::FilePath path; |
43 PathService::Get(base::DIR_SOURCE_ROOT, &path); | 41 PathService::Get(base::DIR_SOURCE_ROOT, &path); |
44 path = path.AppendASCII("net"); | 42 path = path.AppendASCII("net"); |
45 path = path.AppendASCII("data"); | 43 path = path.AppendASCII("data"); |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 if (size_) | 350 if (size_) |
353 EXPECT_TRUE(cache_impl_->SetMaxSize(size_)); | 351 EXPECT_TRUE(cache_impl_->SetMaxSize(size_)); |
354 if (new_eviction_) | 352 if (new_eviction_) |
355 cache_impl_->SetNewEviction(); | 353 cache_impl_->SetNewEviction(); |
356 cache_impl_->SetType(type_); | 354 cache_impl_->SetType(type_); |
357 cache_impl_->SetFlags(flags); | 355 cache_impl_->SetFlags(flags); |
358 net::TestCompletionCallback cb; | 356 net::TestCompletionCallback cb; |
359 int rv = cache_impl_->Init(cb.callback()); | 357 int rv = cache_impl_->Init(cb.callback()); |
360 ASSERT_THAT(cb.GetResult(rv), IsOk()); | 358 ASSERT_THAT(cb.GetResult(rv), IsOk()); |
361 } | 359 } |
OLD | NEW |