Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: content/browser/service_worker/service_worker_context_request_handler_unittest.cc

Issue 2936623002: Implement dumb URLLoader{Factory} for ServiceWorker script loading (for try)
Patch Set: . Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 version_ = nullptr; 83 version_ = nullptr;
84 registration_ = nullptr; 84 registration_ = nullptr;
85 helper_.reset(); 85 helper_.reset();
86 } 86 }
87 87
88 ServiceWorkerContextCore* context() const { return helper_->context(); } 88 ServiceWorkerContextCore* context() const { return helper_->context(); }
89 89
90 void SetUpProvider() { 90 void SetUpProvider() {
91 std::unique_ptr<ServiceWorkerProviderHost> host = 91 std::unique_ptr<ServiceWorkerProviderHost> host =
92 CreateProviderHostForServiceWorkerContext( 92 CreateProviderHostForServiceWorkerContext(
93 helper_->mock_render_process_id(), 1 /* provider_id */, 93 helper_->mock_render_process_id(),
94 true /* is_parent_frame_secure */, context()->AsWeakPtr(), 94 true /* is_parent_frame_secure */, version_.get(),
95 &remote_endpoint_); 95 context()->AsWeakPtr(), &remote_endpoint_);
96 provider_host_ = host->AsWeakPtr(); 96 provider_host_ = host->AsWeakPtr();
97 context()->AddProviderHost(std::move(host)); 97 context()->AddProviderHost(std::move(host));
98 provider_host_->running_hosted_version_ = version_;
99 } 98 }
100 99
101 std::unique_ptr<net::URLRequest> CreateRequest(const GURL& url) { 100 std::unique_ptr<net::URLRequest> CreateRequest(const GURL& url) {
102 return url_request_context_.CreateRequest(url, net::DEFAULT_PRIORITY, 101 return url_request_context_.CreateRequest(url, net::DEFAULT_PRIORITY,
103 &url_request_delegate_, 102 &url_request_delegate_,
104 TRAFFIC_ANNOTATION_FOR_TESTS); 103 TRAFFIC_ANNOTATION_FOR_TESTS);
105 } 104 }
106 105
107 // Creates a ServiceWorkerContextHandler directly. 106 // Creates a ServiceWorkerContextHandler directly.
108 std::unique_ptr<ServiceWorkerContextRequestHandler> CreateHandler( 107 std::unique_ptr<ServiceWorkerContextRequestHandler> CreateHandler(
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 EXPECT_EQ(net::ERR_FAILED, url_request_delegate_.request_status()); 432 EXPECT_EQ(net::ERR_FAILED, url_request_delegate_.request_status());
434 histograms.ExpectUniqueSample( 433 histograms.ExpectUniqueSample(
435 "ServiceWorker.ContextRequestHandlerStatus.NewWorker.MainScript", 434 "ServiceWorker.ContextRequestHandlerStatus.NewWorker.MainScript",
436 static_cast<int>(ServiceWorkerContextRequestHandler::CreateJobStatus:: 435 static_cast<int>(ServiceWorkerContextRequestHandler::CreateJobStatus::
437 ERROR_NO_CONTEXT), 436 ERROR_NO_CONTEXT),
438 1); 437 1);
439 } 438 }
440 } 439 }
441 440
442 } // namespace content 441 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698