| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 temp_dir_.path(), | 75 temp_dir_.path(), |
| 76 url_request_context, | 76 url_request_context, |
| 77 blob_storage_context->context()->AsWeakPtr()); | 77 blob_storage_context->context()->AsWeakPtr()); |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 | 80 |
| 81 virtual void TearDown() OVERRIDE { | 81 virtual void TearDown() OVERRIDE { |
| 82 base::RunLoop().RunUntilIdle(); | 82 base::RunLoop().RunUntilIdle(); |
| 83 disk_cache::SimpleBackendImpl::FlushWorkerPoolForTesting(); | 83 disk_cache::SimpleBackendImpl::FlushWorkerPoolForTesting(); |
| 84 base::RunLoop().RunUntilIdle(); | 84 base::RunLoop().RunUntilIdle(); |
| 85 cache_.reset(); | 85 cache_ = NULL; |
| 86 base::RunLoop().RunUntilIdle(); | 86 base::RunLoop().RunUntilIdle(); |
| 87 disk_cache::SimpleBackendImpl::FlushWorkerPoolForTesting(); | 87 disk_cache::SimpleBackendImpl::FlushWorkerPoolForTesting(); |
| 88 base::RunLoop().RunUntilIdle(); | 88 base::RunLoop().RunUntilIdle(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void CreateRequests(ChromeBlobStorageContext* blob_storage_context) { | 91 void CreateRequests(ChromeBlobStorageContext* blob_storage_context) { |
| 92 std::map<std::string, std::string> headers; | 92 std::map<std::string, std::string> headers; |
| 93 headers.insert(std::make_pair("a", "a")); | 93 headers.insert(std::make_pair("a", "a")); |
| 94 headers.insert(std::make_pair("b", "b")); | 94 headers.insert(std::make_pair("b", "b")); |
| 95 body_request_ = ServiceWorkerFetchRequest( | 95 body_request_ = ServiceWorkerFetchRequest( |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 | 248 |
| 249 virtual bool MemoryOnly() { return false; } | 249 virtual bool MemoryOnly() { return false; } |
| 250 | 250 |
| 251 protected: | 251 protected: |
| 252 TestBrowserContext browser_context_; | 252 TestBrowserContext browser_context_; |
| 253 TestBrowserThreadBundle browser_thread_bundle_; | 253 TestBrowserThreadBundle browser_thread_bundle_; |
| 254 scoped_ptr<net::URLRequestJobFactoryImpl> url_request_job_factory_; | 254 scoped_ptr<net::URLRequestJobFactoryImpl> url_request_job_factory_; |
| 255 storage::BlobStorageContext* blob_storage_context_; | 255 storage::BlobStorageContext* blob_storage_context_; |
| 256 | 256 |
| 257 base::ScopedTempDir temp_dir_; | 257 base::ScopedTempDir temp_dir_; |
| 258 scoped_ptr<ServiceWorkerCache> cache_; | 258 scoped_refptr<ServiceWorkerCache> cache_; |
| 259 | 259 |
| 260 ServiceWorkerFetchRequest body_request_; | 260 ServiceWorkerFetchRequest body_request_; |
| 261 ServiceWorkerResponse body_response_; | 261 ServiceWorkerResponse body_response_; |
| 262 ServiceWorkerFetchRequest no_body_request_; | 262 ServiceWorkerFetchRequest no_body_request_; |
| 263 ServiceWorkerResponse no_body_response_; | 263 ServiceWorkerResponse no_body_response_; |
| 264 scoped_ptr<storage::BlobDataHandle> blob_handle_; | 264 scoped_ptr<storage::BlobDataHandle> blob_handle_; |
| 265 std::string expected_blob_data_; | 265 std::string expected_blob_data_; |
| 266 | 266 |
| 267 ServiceWorkerCache::ErrorType callback_error_; | 267 ServiceWorkerCache::ErrorType callback_error_; |
| 268 scoped_ptr<ServiceWorkerResponse> callback_response_; | 268 scoped_ptr<ServiceWorkerResponse> callback_response_; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 ASSERT_TRUE(Delete(body_request_)); | 396 ASSERT_TRUE(Delete(body_request_)); |
| 397 } | 397 } |
| 398 } | 398 } |
| 399 #endif // OS_WIN | 399 #endif // OS_WIN |
| 400 | 400 |
| 401 INSTANTIATE_TEST_CASE_P(ServiceWorkerCacheTest, | 401 INSTANTIATE_TEST_CASE_P(ServiceWorkerCacheTest, |
| 402 ServiceWorkerCacheTestP, | 402 ServiceWorkerCacheTestP, |
| 403 ::testing::Values(false, true)); | 403 ::testing::Values(false, true)); |
| 404 | 404 |
| 405 } // namespace content | 405 } // namespace content |
| OLD | NEW |