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

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

Issue 2941883003: [ServiceWorker] Fetch event should return integrity value (Closed)
Patch Set: Address yhirano's comment #78 Created 3 years, 5 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_request_handler.h" 5 #include "content/browser/service_worker/service_worker_request_handler.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "content/browser/service_worker/embedded_worker_test_helper.h" 10 #include "content/browser/service_worker/embedded_worker_test_helper.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 return request; 70 return request;
71 } 71 }
72 72
73 void InitializeHandler(net::URLRequest* request, 73 void InitializeHandler(net::URLRequest* request,
74 bool skip_service_worker, 74 bool skip_service_worker,
75 ResourceType resource_type) { 75 ResourceType resource_type) {
76 ServiceWorkerRequestHandler::InitializeHandler( 76 ServiceWorkerRequestHandler::InitializeHandler(
77 request, context_wrapper(), &blob_storage_context_, 77 request, context_wrapper(), &blob_storage_context_,
78 helper_->mock_render_process_id(), kMockProviderId, skip_service_worker, 78 helper_->mock_render_process_id(), kMockProviderId, skip_service_worker,
79 FETCH_REQUEST_MODE_NO_CORS, FETCH_CREDENTIALS_MODE_OMIT, 79 FETCH_REQUEST_MODE_NO_CORS, FETCH_CREDENTIALS_MODE_OMIT,
80 FetchRedirectMode::FOLLOW_MODE, resource_type, 80 FetchRedirectMode::FOLLOW_MODE, std::string() /* integrity */,
81 REQUEST_CONTEXT_TYPE_HYPERLINK, REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL, 81 resource_type, REQUEST_CONTEXT_TYPE_HYPERLINK,
82 nullptr); 82 REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL, nullptr);
83 } 83 }
84 84
85 static ServiceWorkerRequestHandler* GetHandler(net::URLRequest* request) { 85 static ServiceWorkerRequestHandler* GetHandler(net::URLRequest* request) {
86 return ServiceWorkerRequestHandler::GetHandler(request); 86 return ServiceWorkerRequestHandler::GetHandler(request);
87 } 87 }
88 88
89 std::unique_ptr<net::URLRequestJob> MaybeCreateJob(net::URLRequest* request) { 89 std::unique_ptr<net::URLRequestJob> MaybeCreateJob(net::URLRequest* request) {
90 return std::unique_ptr<net::URLRequestJob>( 90 return std::unique_ptr<net::URLRequestJob>(
91 GetHandler(request)->MaybeCreateJob( 91 GetHandler(request)->MaybeCreateJob(
92 request, url_request_context_.network_delegate(), 92 request, url_request_context_.network_delegate(),
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // Check provider host's URL after initializing a handler for an image. 161 // Check provider host's URL after initializing a handler for an image.
162 provider_host_->SetDocumentUrl(GURL("https://host/scope/doc")); 162 provider_host_->SetDocumentUrl(GURL("https://host/scope/doc"));
163 std::unique_ptr<net::URLRequest> request = 163 std::unique_ptr<net::URLRequest> request =
164 CreateRequest("https://host/scope/image", "GET"); 164 CreateRequest("https://host/scope/image", "GET");
165 InitializeHandler(request.get(), true, RESOURCE_TYPE_IMAGE); 165 InitializeHandler(request.get(), true, RESOURCE_TYPE_IMAGE);
166 ASSERT_FALSE(GetHandler(request.get())); 166 ASSERT_FALSE(GetHandler(request.get()));
167 EXPECT_EQ(GURL("https://host/scope/doc"), provider_host_->document_url()); 167 EXPECT_EQ(GURL("https://host/scope/doc"), provider_host_->document_url());
168 } 168 }
169 169
170 } // namespace content 170 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698