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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
142 request_ = url_request_context_.CreateRequest( | 142 request_ = url_request_context_.CreateRequest( |
143 GURL(url), net::DEFAULT_PRIORITY, &url_request_delegate_, | 143 GURL(url), net::DEFAULT_PRIORITY, &url_request_delegate_, |
144 TRAFFIC_ANNOTATION_FOR_TESTS); | 144 TRAFFIC_ANNOTATION_FOR_TESTS); |
145 if (initiator) | 145 if (initiator) |
146 request_->set_initiator(url::Origin(GURL(initiator))); | 146 request_->set_initiator(url::Origin(GURL(initiator))); |
147 ForeignFetchRequestHandler::InitializeHandler( | 147 ForeignFetchRequestHandler::InitializeHandler( |
148 request_.get(), context_wrapper(), &blob_storage_context_, | 148 request_.get(), context_wrapper(), &blob_storage_context_, |
149 helper_->mock_render_process_id(), provider_host()->provider_id(), | 149 helper_->mock_render_process_id(), provider_host()->provider_id(), |
150 ServiceWorkerMode::ALL, FETCH_REQUEST_MODE_CORS, | 150 ServiceWorkerMode::ALL, FETCH_REQUEST_MODE_CORS, |
151 FETCH_CREDENTIALS_MODE_OMIT, FetchRedirectMode::FOLLOW_MODE, | 151 FETCH_CREDENTIALS_MODE_OMIT, FetchRedirectMode::FOLLOW_MODE, |
152 resource_type, REQUEST_CONTEXT_TYPE_FETCH, | 152 "" /*integrity*/, resource_type, REQUEST_CONTEXT_TYPE_FETCH, |
falken
2017/07/07 00:56:10
"" => std::string()
/*integrity*/ => /* integrity
xiaofengzhang
2017/07/12 09:13:52
Done.
| |
153 REQUEST_CONTEXT_FRAME_TYPE_NONE, nullptr, | 153 REQUEST_CONTEXT_FRAME_TYPE_NONE, nullptr, |
154 true /* initiated_in_secure_context */); | 154 true /* initiated_in_secure_context */); |
155 | 155 |
156 return ForeignFetchRequestHandler::GetHandler(request_.get()); | 156 return ForeignFetchRequestHandler::GetHandler(request_.get()); |
157 } | 157 } |
158 | 158 |
159 void CreateWindowTypeProviderHost() { | 159 void CreateWindowTypeProviderHost() { |
160 remote_endpoints_.emplace_back(); | 160 remote_endpoints_.emplace_back(); |
161 std::unique_ptr<ServiceWorkerProviderHost> host = | 161 std::unique_ptr<ServiceWorkerProviderHost> host = |
162 CreateProviderHostForWindow( | 162 CreateProviderHostForWindow( |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
384 // Make sure new request only gets remaining timeout. | 384 // Make sure new request only gets remaining timeout. |
385 ForeignFetchRequestHandler* handler = | 385 ForeignFetchRequestHandler* handler = |
386 InitializeHandler("https://valid.example.com/foo", RESOURCE_TYPE_IMAGE, | 386 InitializeHandler("https://valid.example.com/foo", RESOURCE_TYPE_IMAGE, |
387 nullptr /* initiator */); | 387 nullptr /* initiator */); |
388 ASSERT_TRUE(handler); | 388 ASSERT_TRUE(handler); |
389 ASSERT_TRUE(timeout_for_request(handler).has_value()); | 389 ASSERT_TRUE(timeout_for_request(handler).has_value()); |
390 EXPECT_EQ(remaining_time, timeout_for_request(handler).value()); | 390 EXPECT_EQ(remaining_time, timeout_for_request(handler).value()); |
391 } | 391 } |
392 | 392 |
393 } // namespace content | 393 } // namespace content |
OLD | NEW |