| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/foreign_fetch_request_handler.h" | 5 #include "content/browser/service_worker/foreign_fetch_request_handler.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/test/simple_test_tick_clock.h" | 9 #include "base/test/simple_test_tick_clock.h" |
| 10 #include "content/browser/browser_thread_impl.h" | 10 #include "content/browser/browser_thread_impl.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 ForeignFetchRequestHandler* InitializeHandler(const std::string& url, | 138 ForeignFetchRequestHandler* InitializeHandler(const std::string& url, |
| 139 ResourceType resource_type, | 139 ResourceType resource_type, |
| 140 const char* initiator) { | 140 const char* initiator) { |
| 141 request_ = url_request_context_.CreateRequest( | 141 request_ = url_request_context_.CreateRequest( |
| 142 GURL(url), net::DEFAULT_PRIORITY, &url_request_delegate_); | 142 GURL(url), net::DEFAULT_PRIORITY, &url_request_delegate_); |
| 143 if (initiator) | 143 if (initiator) |
| 144 request_->set_initiator(url::Origin(GURL(initiator))); | 144 request_->set_initiator(url::Origin(GURL(initiator))); |
| 145 ForeignFetchRequestHandler::InitializeHandler( | 145 ForeignFetchRequestHandler::InitializeHandler( |
| 146 request_.get(), context_wrapper(), &blob_storage_context_, | 146 request_.get(), context_wrapper(), &blob_storage_context_, |
| 147 helper_->mock_render_process_id(), kMockProviderId, | 147 helper_->mock_render_process_id(), kMockProviderId, |
| 148 SkipServiceWorker::NONE, FETCH_REQUEST_MODE_CORS, | 148 ServiceWorkerMode::ALL, FETCH_REQUEST_MODE_CORS, |
| 149 FETCH_CREDENTIALS_MODE_OMIT, FetchRedirectMode::FOLLOW_MODE, | 149 FETCH_CREDENTIALS_MODE_OMIT, FetchRedirectMode::FOLLOW_MODE, |
| 150 resource_type, REQUEST_CONTEXT_TYPE_FETCH, | 150 resource_type, REQUEST_CONTEXT_TYPE_FETCH, |
| 151 REQUEST_CONTEXT_FRAME_TYPE_NONE, nullptr, | 151 REQUEST_CONTEXT_FRAME_TYPE_NONE, nullptr, |
| 152 true /* initiated_in_secure_context */); | 152 true /* initiated_in_secure_context */); |
| 153 | 153 |
| 154 return ForeignFetchRequestHandler::GetHandler(request_.get()); | 154 return ForeignFetchRequestHandler::GetHandler(request_.get()); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void CreateWindowTypeProviderHost() { | 157 void CreateWindowTypeProviderHost() { |
| 158 std::unique_ptr<ServiceWorkerProviderHost> host = | 158 std::unique_ptr<ServiceWorkerProviderHost> host = |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 // Make sure new request only gets remaining timeout. | 380 // Make sure new request only gets remaining timeout. |
| 381 ForeignFetchRequestHandler* handler = | 381 ForeignFetchRequestHandler* handler = |
| 382 InitializeHandler("https://valid.example.com/foo", RESOURCE_TYPE_IMAGE, | 382 InitializeHandler("https://valid.example.com/foo", RESOURCE_TYPE_IMAGE, |
| 383 nullptr /* initiator */); | 383 nullptr /* initiator */); |
| 384 ASSERT_TRUE(handler); | 384 ASSERT_TRUE(handler); |
| 385 ASSERT_TRUE(timeout_for_request(handler).has_value()); | 385 ASSERT_TRUE(timeout_for_request(handler).has_value()); |
| 386 EXPECT_EQ(remaining_time, timeout_for_request(handler).value()); | 386 EXPECT_EQ(remaining_time, timeout_for_request(handler).value()); |
| 387 } | 387 } |
| 388 | 388 |
| 389 } // namespace content | 389 } // namespace content |
| OLD | NEW |