| OLD | NEW |
| 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 "content/browser/cache_storage/cache_storage_manager.h" | 5 #include "content/browser/cache_storage/cache_storage_manager.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 void SetUp() override { | 35 void SetUp() override { |
| 36 ChromeBlobStorageContext* blob_storage_context( | 36 ChromeBlobStorageContext* blob_storage_context( |
| 37 ChromeBlobStorageContext::GetFor(&browser_context_)); | 37 ChromeBlobStorageContext::GetFor(&browser_context_)); |
| 38 // Wait for ChromeBlobStorageContext to finish initializing. | 38 // Wait for ChromeBlobStorageContext to finish initializing. |
| 39 base::RunLoop().RunUntilIdle(); | 39 base::RunLoop().RunUntilIdle(); |
| 40 | 40 |
| 41 quota_manager_proxy_ = new MockQuotaManagerProxy( | 41 quota_manager_proxy_ = new MockQuotaManagerProxy( |
| 42 nullptr, base::ThreadTaskRunnerHandle::Get().get()); | 42 nullptr, base::ThreadTaskRunnerHandle::Get().get()); |
| 43 | 43 |
| 44 net::URLRequestContext* url_request_context = | |
| 45 browser_context_.GetRequestContext()->GetURLRequestContext(); | |
| 46 if (MemoryOnly()) { | 44 if (MemoryOnly()) { |
| 47 cache_manager_ = CacheStorageManager::Create( | 45 cache_manager_ = CacheStorageManager::Create( |
| 48 base::FilePath(), base::ThreadTaskRunnerHandle::Get(), | 46 base::FilePath(), base::ThreadTaskRunnerHandle::Get(), |
| 49 quota_manager_proxy_); | 47 quota_manager_proxy_); |
| 50 } else { | 48 } else { |
| 51 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 49 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 52 cache_manager_ = CacheStorageManager::Create( | 50 cache_manager_ = CacheStorageManager::Create( |
| 53 temp_dir_.path(), base::ThreadTaskRunnerHandle::Get(), | 51 temp_dir_.path(), base::ThreadTaskRunnerHandle::Get(), |
| 54 quota_manager_proxy_); | 52 quota_manager_proxy_); |
| 55 } | 53 } |
| 56 | 54 |
| 57 cache_manager_->SetBlobParametersForCache( | 55 cache_manager_->SetBlobParametersForCache( |
| 58 url_request_context, blob_storage_context->context()->AsWeakPtr()); | 56 browser_context_.GetRequestContext(), |
| 57 blob_storage_context->context()->AsWeakPtr()); |
| 59 } | 58 } |
| 60 | 59 |
| 61 void TearDown() override { | 60 void TearDown() override { |
| 62 quota_manager_proxy_->SimulateQuotaManagerDestroyed(); | 61 quota_manager_proxy_->SimulateQuotaManagerDestroyed(); |
| 63 base::RunLoop().RunUntilIdle(); | 62 base::RunLoop().RunUntilIdle(); |
| 64 } | 63 } |
| 65 | 64 |
| 66 virtual bool MemoryOnly() { return false; } | 65 virtual bool MemoryOnly() { return false; } |
| 67 | 66 |
| 68 void BoolAndErrorCallback(base::RunLoop* run_loop, | 67 void BoolAndErrorCallback(base::RunLoop* run_loop, |
| (...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 | 790 |
| 792 INSTANTIATE_TEST_CASE_P(CacheStorageManagerTests, | 791 INSTANTIATE_TEST_CASE_P(CacheStorageManagerTests, |
| 793 CacheStorageManagerTestP, | 792 CacheStorageManagerTestP, |
| 794 ::testing::Values(false, true)); | 793 ::testing::Values(false, true)); |
| 795 | 794 |
| 796 INSTANTIATE_TEST_CASE_P(CacheStorageQuotaClientTests, | 795 INSTANTIATE_TEST_CASE_P(CacheStorageQuotaClientTests, |
| 797 CacheStorageQuotaClientTestP, | 796 CacheStorageQuotaClientTestP, |
| 798 ::testing::Values(false, true)); | 797 ::testing::Values(false, true)); |
| 799 | 798 |
| 800 } // namespace content | 799 } // namespace content |
| OLD | NEW |