| 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_context_request_handler.
h" | 5 #include "content/browser/service_worker/service_worker_context_request_handler.
h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 void TearDown() override { | 81 void TearDown() override { |
| 82 version_ = nullptr; | 82 version_ = nullptr; |
| 83 registration_ = nullptr; | 83 registration_ = nullptr; |
| 84 helper_.reset(); | 84 helper_.reset(); |
| 85 } | 85 } |
| 86 | 86 |
| 87 ServiceWorkerContextCore* context() const { return helper_->context(); } | 87 ServiceWorkerContextCore* context() const { return helper_->context(); } |
| 88 | 88 |
| 89 void SetUpProvider() { | 89 void SetUpProvider() { |
| 90 std::unique_ptr<ServiceWorkerProviderHost> host( | 90 std::unique_ptr<ServiceWorkerProviderHost> host = |
| 91 new ServiceWorkerProviderHost( | 91 ServiceWorkerProviderHost::CreateForTesting( |
| 92 helper_->mock_render_process_id(), | 92 helper_->mock_render_process_id(), 1 /* provider_id */, |
| 93 MSG_ROUTING_NONE /* render_frame_id */, 1 /* provider_id */, | 93 SERVICE_WORKER_PROVIDER_FOR_CONTROLLER, context()->AsWeakPtr()); |
| 94 SERVICE_WORKER_PROVIDER_FOR_CONTROLLER, | 94 host->set_parent_frame_secure(true); |
| 95 ServiceWorkerProviderHost::FrameSecurityLevel::SECURE, | |
| 96 context()->AsWeakPtr(), nullptr)); | |
| 97 provider_host_ = host->AsWeakPtr(); | 95 provider_host_ = host->AsWeakPtr(); |
| 98 context()->AddProviderHost(std::move(host)); | 96 context()->AddProviderHost(std::move(host)); |
| 99 provider_host_->running_hosted_version_ = version_; | 97 provider_host_->running_hosted_version_ = version_; |
| 100 } | 98 } |
| 101 | 99 |
| 102 std::unique_ptr<net::URLRequest> CreateRequest(const GURL& url) { | 100 std::unique_ptr<net::URLRequest> CreateRequest(const GURL& url) { |
| 103 return url_request_context_.CreateRequest(url, net::DEFAULT_PRIORITY, | 101 return url_request_context_.CreateRequest(url, net::DEFAULT_PRIORITY, |
| 104 &url_request_delegate_); | 102 &url_request_delegate_); |
| 105 } | 103 } |
| 106 | 104 |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 EXPECT_EQ(net::ERR_FAILED, url_request_delegate_.request_status()); | 430 EXPECT_EQ(net::ERR_FAILED, url_request_delegate_.request_status()); |
| 433 histograms.ExpectUniqueSample( | 431 histograms.ExpectUniqueSample( |
| 434 "ServiceWorker.ContextRequestHandlerStatus.NewWorker.MainScript", | 432 "ServiceWorker.ContextRequestHandlerStatus.NewWorker.MainScript", |
| 435 static_cast<int>(ServiceWorkerContextRequestHandler::CreateJobStatus:: | 433 static_cast<int>(ServiceWorkerContextRequestHandler::CreateJobStatus:: |
| 436 ERROR_NO_CONTEXT), | 434 ERROR_NO_CONTEXT), |
| 437 1); | 435 1); |
| 438 } | 436 } |
| 439 } | 437 } |
| 440 | 438 |
| 441 } // namespace content | 439 } // namespace content |
| OLD | NEW |