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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 ServiceWorkerWriteToCacheJobTest() | 273 ServiceWorkerWriteToCacheJobTest() |
274 : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP), | 274 : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP), |
275 mock_protocol_handler_(nullptr) {} | 275 mock_protocol_handler_(nullptr) {} |
276 ~ServiceWorkerWriteToCacheJobTest() override {} | 276 ~ServiceWorkerWriteToCacheJobTest() override {} |
277 | 277 |
278 void CreateHostForVersion( | 278 void CreateHostForVersion( |
279 int process_id, | 279 int process_id, |
280 int provider_id, | 280 int provider_id, |
281 const scoped_refptr<ServiceWorkerVersion>& version) { | 281 const scoped_refptr<ServiceWorkerVersion>& version) { |
282 std::unique_ptr<ServiceWorkerProviderHost> host( | 282 std::unique_ptr<ServiceWorkerProviderHost> host( |
283 new ServiceWorkerProviderHost( | 283 new ServiceWorkerProviderHost(process_id, MSG_ROUTING_NONE, provider_id, |
284 process_id, MSG_ROUTING_NONE, provider_id, | 284 SERVICE_WORKER_PROVIDER_FOR_WORKER, |
285 SERVICE_WORKER_PROVIDER_FOR_WORKER, | 285 context()->AsWeakPtr(), nullptr)); |
286 ServiceWorkerProviderHost::FrameSecurityLevel::SECURE, | |
287 context()->AsWeakPtr(), nullptr)); | |
288 base::WeakPtr<ServiceWorkerProviderHost> provider_host = host->AsWeakPtr(); | 286 base::WeakPtr<ServiceWorkerProviderHost> provider_host = host->AsWeakPtr(); |
289 context()->AddProviderHost(std::move(host)); | 287 context()->AddProviderHost(std::move(host)); |
290 provider_host->running_hosted_version_ = version; | 288 provider_host->running_hosted_version_ = version; |
291 } | 289 } |
292 | 290 |
293 void SetUpScriptRequest(int process_id, int provider_id) { | 291 void SetUpScriptRequest(int process_id, int provider_id) { |
294 request_.reset(); | 292 request_.reset(); |
295 url_request_context_.reset(); | 293 url_request_context_.reset(); |
296 url_request_job_factory_.reset(); | 294 url_request_job_factory_.reset(); |
297 mock_protocol_handler_ = nullptr; | 295 mock_protocol_handler_ = nullptr; |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 mock_protocol_handler_->SetCreateJobCallback( | 608 mock_protocol_handler_->SetCreateJobCallback( |
611 base::Bind(&CreateNormalURLRequestJob)); | 609 base::Bind(&CreateNormalURLRequestJob)); |
612 DisableCache(); | 610 DisableCache(); |
613 request_->Start(); | 611 request_->Start(); |
614 base::RunLoop().RunUntilIdle(); | 612 base::RunLoop().RunUntilIdle(); |
615 EXPECT_EQ(net::URLRequestStatus::FAILED, request_->status().status()); | 613 EXPECT_EQ(net::URLRequestStatus::FAILED, request_->status().status()); |
616 EXPECT_EQ(net::ERR_FAILED, request_->status().error()); | 614 EXPECT_EQ(net::ERR_FAILED, request_->status().error()); |
617 } | 615 } |
618 | 616 |
619 } // namespace content | 617 } // namespace content |
OLD | NEW |