| 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/service_worker/service_worker_cache.h" | 5 #include "content/browser/service_worker/service_worker_cache.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 net::URLRequestContext* url_request_context = | 60 net::URLRequestContext* url_request_context = |
| 61 browser_context_.GetRequestContext()->GetURLRequestContext(); | 61 browser_context_.GetRequestContext()->GetURLRequestContext(); |
| 62 | 62 |
| 63 url_request_context->set_job_factory(url_request_job_factory_.get()); | 63 url_request_context->set_job_factory(url_request_job_factory_.get()); |
| 64 | 64 |
| 65 CreateRequests(blob_storage_context); | 65 CreateRequests(blob_storage_context); |
| 66 | 66 |
| 67 if (MemoryOnly()) { | 67 if (MemoryOnly()) { |
| 68 cache_ = ServiceWorkerCache::CreateMemoryCache( | 68 cache_ = ServiceWorkerCache::CreateMemoryCache( |
| 69 "test", | |
| 70 url_request_context, | 69 url_request_context, |
| 71 blob_storage_context->context()->AsWeakPtr()); | 70 blob_storage_context->context()->AsWeakPtr()); |
| 72 } else { | 71 } else { |
| 73 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 72 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 74 cache_ = ServiceWorkerCache::CreatePersistentCache( | 73 cache_ = ServiceWorkerCache::CreatePersistentCache( |
| 75 temp_dir_.path(), | 74 temp_dir_.path(), |
| 76 "test", | |
| 77 url_request_context, | 75 url_request_context, |
| 78 blob_storage_context->context()->AsWeakPtr()); | 76 blob_storage_context->context()->AsWeakPtr()); |
| 79 } | 77 } |
| 80 CreateBackend(); | 78 CreateBackend(); |
| 81 } | 79 } |
| 82 | 80 |
| 83 void CreateRequests(ChromeBlobStorageContext* blob_storage_context) { | 81 void CreateRequests(ChromeBlobStorageContext* blob_storage_context) { |
| 84 std::map<std::string, std::string> headers; | 82 std::map<std::string, std::string> headers; |
| 85 headers.insert(std::make_pair("a", "a")); | 83 headers.insert(std::make_pair("a", "a")); |
| 86 headers.insert(std::make_pair("b", "b")); | 84 headers.insert(std::make_pair("b", "b")); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 ASSERT_TRUE(Match(body_request_.get())); | 301 ASSERT_TRUE(Match(body_request_.get())); |
| 304 ASSERT_TRUE(Delete(body_request_.get())); | 302 ASSERT_TRUE(Delete(body_request_.get())); |
| 305 } | 303 } |
| 306 } | 304 } |
| 307 | 305 |
| 308 INSTANTIATE_TEST_CASE_P(ServiceWorkerCacheTest, | 306 INSTANTIATE_TEST_CASE_P(ServiceWorkerCacheTest, |
| 309 ServiceWorkerCacheTestP, | 307 ServiceWorkerCacheTestP, |
| 310 ::testing::Values(false, true)); | 308 ::testing::Values(false, true)); |
| 311 | 309 |
| 312 } // namespace content | 310 } // namespace content |
| OLD | NEW |