| 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_request_handler.h" | 5 #include "content/browser/service_worker/service_worker_request_handler.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "content/browser/service_worker/embedded_worker_test_helper.h" | 10 #include "content/browser/service_worker/embedded_worker_test_helper.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 return request; | 71 return request; |
| 72 } | 72 } |
| 73 | 73 |
| 74 void InitializeHandler(net::URLRequest* request, | 74 void InitializeHandler(net::URLRequest* request, |
| 75 bool skip_service_worker, | 75 bool skip_service_worker, |
| 76 ResourceType resource_type) { | 76 ResourceType resource_type) { |
| 77 ServiceWorkerRequestHandler::InitializeHandler( | 77 ServiceWorkerRequestHandler::InitializeHandler( |
| 78 request, context_wrapper(), &blob_storage_context_, | 78 request, context_wrapper(), &blob_storage_context_, |
| 79 helper_->mock_render_process_id(), kMockProviderId, skip_service_worker, | 79 helper_->mock_render_process_id(), kMockProviderId, skip_service_worker, |
| 80 FETCH_REQUEST_MODE_NO_CORS, FETCH_CREDENTIALS_MODE_OMIT, | 80 FETCH_REQUEST_MODE_NO_CORS, FETCH_CREDENTIALS_MODE_OMIT, |
| 81 FetchRedirectMode::FOLLOW_MODE, resource_type, | 81 FetchRedirectMode::FOLLOW_MODE, "" /*integrity*/, resource_type, |
| 82 REQUEST_CONTEXT_TYPE_HYPERLINK, REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL, | 82 REQUEST_CONTEXT_TYPE_HYPERLINK, REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL, |
| 83 nullptr); | 83 nullptr); |
| 84 } | 84 } |
| 85 | 85 |
| 86 static ServiceWorkerRequestHandler* GetHandler(net::URLRequest* request) { | 86 static ServiceWorkerRequestHandler* GetHandler(net::URLRequest* request) { |
| 87 return ServiceWorkerRequestHandler::GetHandler(request); | 87 return ServiceWorkerRequestHandler::GetHandler(request); |
| 88 } | 88 } |
| 89 | 89 |
| 90 std::unique_ptr<net::URLRequestJob> MaybeCreateJob(net::URLRequest* request) { | 90 std::unique_ptr<net::URLRequestJob> MaybeCreateJob(net::URLRequest* request) { |
| 91 return std::unique_ptr<net::URLRequestJob>( | 91 return std::unique_ptr<net::URLRequestJob>( |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 // Check provider host's URL after initializing a handler for an image. | 162 // Check provider host's URL after initializing a handler for an image. |
| 163 provider_host_->SetDocumentUrl(GURL("https://host/scope/doc")); | 163 provider_host_->SetDocumentUrl(GURL("https://host/scope/doc")); |
| 164 std::unique_ptr<net::URLRequest> request = | 164 std::unique_ptr<net::URLRequest> request = |
| 165 CreateRequest("https://host/scope/image", "GET"); | 165 CreateRequest("https://host/scope/image", "GET"); |
| 166 InitializeHandler(request.get(), true, RESOURCE_TYPE_IMAGE); | 166 InitializeHandler(request.get(), true, RESOURCE_TYPE_IMAGE); |
| 167 ASSERT_FALSE(GetHandler(request.get())); | 167 ASSERT_FALSE(GetHandler(request.get())); |
| 168 EXPECT_EQ(GURL("https://host/scope/doc"), provider_host_->document_url()); | 168 EXPECT_EQ(GURL("https://host/scope/doc"), provider_host_->document_url()); |
| 169 } | 169 } |
| 170 | 170 |
| 171 } // namespace content | 171 } // namespace content |
| OLD | NEW |