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_url_request_job.h" | 5 #include "content/browser/service_worker/service_worker_url_request_job.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "content/browser/service_worker/service_worker_registration.h" | 27 #include "content/browser/service_worker/service_worker_registration.h" |
28 #include "content/browser/service_worker/service_worker_response_info.h" | 28 #include "content/browser/service_worker/service_worker_response_info.h" |
29 #include "content/browser/service_worker/service_worker_test_utils.h" | 29 #include "content/browser/service_worker/service_worker_test_utils.h" |
30 #include "content/browser/service_worker/service_worker_version.h" | 30 #include "content/browser/service_worker/service_worker_version.h" |
31 #include "content/browser/streams/stream.h" | 31 #include "content/browser/streams/stream.h" |
32 #include "content/browser/streams/stream_context.h" | 32 #include "content/browser/streams/stream_context.h" |
33 #include "content/browser/streams/stream_registry.h" | 33 #include "content/browser/streams/stream_registry.h" |
34 #include "content/common/resource_request_body_impl.h" | 34 #include "content/common/resource_request_body_impl.h" |
35 #include "content/common/service_worker/service_worker_messages.h" | 35 #include "content/common/service_worker/service_worker_messages.h" |
36 #include "content/common/service_worker/service_worker_status_code.h" | 36 #include "content/common/service_worker/service_worker_status_code.h" |
| 37 #include "content/common/service_worker/service_worker_types.h" |
37 #include "content/public/browser/blob_handle.h" | 38 #include "content/public/browser/blob_handle.h" |
38 #include "content/public/common/request_context_frame_type.h" | 39 #include "content/public/common/request_context_frame_type.h" |
39 #include "content/public/common/request_context_type.h" | 40 #include "content/public/common/request_context_type.h" |
40 #include "content/public/common/resource_type.h" | 41 #include "content/public/common/resource_type.h" |
41 #include "content/public/test/mock_resource_context.h" | 42 #include "content/public/test/mock_resource_context.h" |
42 #include "content/public/test/test_browser_context.h" | 43 #include "content/public/test/test_browser_context.h" |
43 #include "content/public/test/test_browser_thread_bundle.h" | 44 #include "content/public/test/test_browser_thread_bundle.h" |
44 #include "net/base/io_buffer.h" | 45 #include "net/base/io_buffer.h" |
45 #include "net/http/http_request_headers.h" | 46 #include "net/http/http_request_headers.h" |
46 #include "net/http/http_response_headers.h" | 47 #include "net/http/http_response_headers.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 "PASS", true); | 96 "PASS", true); |
96 } | 97 } |
97 | 98 |
98 job_ = new ServiceWorkerURLRequestJob( | 99 job_ = new ServiceWorkerURLRequestJob( |
99 request, network_delegate, provider_host_->client_uuid(), | 100 request, network_delegate, provider_host_->client_uuid(), |
100 blob_storage_context_, resource_context_, FETCH_REQUEST_MODE_NO_CORS, | 101 blob_storage_context_, resource_context_, FETCH_REQUEST_MODE_NO_CORS, |
101 FETCH_CREDENTIALS_MODE_OMIT, FetchRedirectMode::FOLLOW_MODE, | 102 FETCH_CREDENTIALS_MODE_OMIT, FetchRedirectMode::FOLLOW_MODE, |
102 resource_type_, REQUEST_CONTEXT_TYPE_HYPERLINK, | 103 resource_type_, REQUEST_CONTEXT_TYPE_HYPERLINK, |
103 REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL, | 104 REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL, |
104 scoped_refptr<ResourceRequestBodyImpl>(), ServiceWorkerFetchType::FETCH, | 105 scoped_refptr<ResourceRequestBodyImpl>(), ServiceWorkerFetchType::FETCH, |
105 delegate_); | 106 MojoURLLoaderFactoryGetter(), delegate_); |
106 job_->ForwardToServiceWorker(); | 107 job_->ForwardToServiceWorker(); |
107 return job_; | 108 return job_; |
108 } | 109 } |
109 ServiceWorkerURLRequestJob* job() { return job_; } | 110 ServiceWorkerURLRequestJob* job() { return job_; } |
110 | 111 |
111 private: | 112 private: |
112 base::WeakPtr<ServiceWorkerProviderHost> provider_host_; | 113 base::WeakPtr<ServiceWorkerProviderHost> provider_host_; |
113 const ResourceContext* resource_context_; | 114 const ResourceContext* resource_context_; |
114 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_; | 115 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_; |
115 mutable ServiceWorkerURLRequestJob* job_; | 116 mutable ServiceWorkerURLRequestJob* job_; |
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1074 base::RunLoop().RunUntilIdle(); | 1075 base::RunLoop().RunUntilIdle(); |
1075 | 1076 |
1076 // The fetch event request should no longer be in-flight. | 1077 // The fetch event request should no longer be in-flight. |
1077 EXPECT_FALSE(version_->HasWork()); | 1078 EXPECT_FALSE(version_->HasWork()); |
1078 } | 1079 } |
1079 | 1080 |
1080 // TODO(kinuko): Add more tests with different response data and also for | 1081 // TODO(kinuko): Add more tests with different response data and also for |
1081 // FallbackToNetwork case. | 1082 // FallbackToNetwork case. |
1082 | 1083 |
1083 } // namespace content | 1084 } // namespace content |
OLD | NEW |