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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
283 : scope_(scope), | 283 : scope_(scope), |
284 script_url_(script_url), | 284 script_url_(script_url), |
285 browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP), | 285 browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP), |
286 mock_protocol_handler_(nullptr) {} | 286 mock_protocol_handler_(nullptr) {} |
287 ~ServiceWorkerWriteToCacheJobTest() override {} | 287 ~ServiceWorkerWriteToCacheJobTest() override {} |
288 | 288 |
289 void CreateHostForVersion( | 289 void CreateHostForVersion( |
290 int process_id, | 290 int process_id, |
291 int provider_id, | 291 int provider_id, |
292 const scoped_refptr<ServiceWorkerVersion>& version) { | 292 const scoped_refptr<ServiceWorkerVersion>& version) { |
293 std::unique_ptr<ServiceWorkerProviderHost> host( | 293 std::unique_ptr<ServiceWorkerProviderHost> host = |
294 new ServiceWorkerProviderHost( | 294 CreateProviderHostForServiceWorkerContext( |
295 process_id, MSG_ROUTING_NONE, provider_id, | 295 process_id, provider_id, true /* is_parent_frame_secure */, |
296 SERVICE_WORKER_PROVIDER_FOR_CONTROLLER, | 296 context()->AsWeakPtr()); |
297 ServiceWorkerProviderHost::FrameSecurityLevel::SECURE, | |
dcheng
2017/02/14 08:47:46
To be honest, I preferred the enum over the bool h
shimazu
2017/02/15 02:24:19
I also feel so to tell the truth.
Is it okay to se
dcheng
2017/02/15 04:29:35
Sounds good to me.
| |
298 context()->AsWeakPtr(), nullptr)); | |
299 base::WeakPtr<ServiceWorkerProviderHost> provider_host = host->AsWeakPtr(); | 297 base::WeakPtr<ServiceWorkerProviderHost> provider_host = host->AsWeakPtr(); |
300 context()->AddProviderHost(std::move(host)); | 298 context()->AddProviderHost(std::move(host)); |
301 provider_host->running_hosted_version_ = version; | 299 provider_host->running_hosted_version_ = version; |
302 } | 300 } |
303 | 301 |
304 void SetUpScriptRequest(int process_id, int provider_id) { | 302 void SetUpScriptRequest(int process_id, int provider_id) { |
305 request_.reset(); | 303 request_.reset(); |
306 url_request_context_.reset(); | 304 url_request_context_.reset(); |
307 url_request_job_factory_.reset(); | 305 url_request_job_factory_.reset(); |
308 mock_protocol_handler_ = nullptr; | 306 mock_protocol_handler_ = nullptr; |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
681 mock_protocol_handler_->SetCreateJobCallback( | 679 mock_protocol_handler_->SetCreateJobCallback( |
682 base::Bind(&CreateNormalURLRequestJob)); | 680 base::Bind(&CreateNormalURLRequestJob)); |
683 DisableCache(); | 681 DisableCache(); |
684 request_->Start(); | 682 request_->Start(); |
685 base::RunLoop().RunUntilIdle(); | 683 base::RunLoop().RunUntilIdle(); |
686 EXPECT_EQ(net::URLRequestStatus::FAILED, request_->status().status()); | 684 EXPECT_EQ(net::URLRequestStatus::FAILED, request_->status().status()); |
687 EXPECT_EQ(net::ERR_FAILED, request_->status().error()); | 685 EXPECT_EQ(net::ERR_FAILED, request_->status().error()); |
688 } | 686 } |
689 | 687 |
690 } // namespace content | 688 } // namespace content |
OLD | NEW |