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 CreateProviderHostForServiceWorkerContext( |
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 true /* is_parent_frame_secure */, context()->AsWeakPtr()); |
94 SERVICE_WORKER_PROVIDER_FOR_CONTROLLER, | |
95 ServiceWorkerProviderHost::FrameSecurityLevel::SECURE, | |
96 context()->AsWeakPtr(), nullptr)); | |
97 provider_host_ = host->AsWeakPtr(); | 94 provider_host_ = host->AsWeakPtr(); |
98 context()->AddProviderHost(std::move(host)); | 95 context()->AddProviderHost(std::move(host)); |
99 provider_host_->running_hosted_version_ = version_; | 96 provider_host_->running_hosted_version_ = version_; |
100 } | 97 } |
101 | 98 |
102 std::unique_ptr<net::URLRequest> CreateRequest(const GURL& url) { | 99 std::unique_ptr<net::URLRequest> CreateRequest(const GURL& url) { |
103 return url_request_context_.CreateRequest(url, net::DEFAULT_PRIORITY, | 100 return url_request_context_.CreateRequest(url, net::DEFAULT_PRIORITY, |
104 &url_request_delegate_); | 101 &url_request_delegate_); |
105 } | 102 } |
106 | 103 |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 EXPECT_EQ(net::ERR_FAILED, url_request_delegate_.request_status()); | 429 EXPECT_EQ(net::ERR_FAILED, url_request_delegate_.request_status()); |
433 histograms.ExpectUniqueSample( | 430 histograms.ExpectUniqueSample( |
434 "ServiceWorker.ContextRequestHandlerStatus.NewWorker.MainScript", | 431 "ServiceWorker.ContextRequestHandlerStatus.NewWorker.MainScript", |
435 static_cast<int>(ServiceWorkerContextRequestHandler::CreateJobStatus:: | 432 static_cast<int>(ServiceWorkerContextRequestHandler::CreateJobStatus:: |
436 ERROR_NO_CONTEXT), | 433 ERROR_NO_CONTEXT), |
437 1); | 434 1); |
438 } | 435 } |
439 } | 436 } |
440 | 437 |
441 } // namespace content | 438 } // namespace content |
OLD | NEW |