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

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

Issue 2653493009: Add two interfaces for ServiceWorkerProviderContext/ProviderHost (Closed)
Patch Set: Skip unittest for CrossSiteTransfer when PlzNavigate 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_url_request_job.h" 5 #include "content/browser/service_worker/service_worker_url_request_job.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 http_info.ssl_info.security_bits = 0x100; 189 http_info.ssl_info.security_bits = 0x100;
190 // SSL3 TLS_DHE_RSA_WITH_AES_256_CBC_SHA 190 // SSL3 TLS_DHE_RSA_WITH_AES_256_CBC_SHA
191 http_info.ssl_info.connection_status = 0x300039; 191 http_info.ssl_info.connection_status = 0x300039;
192 http_info.headers = make_scoped_refptr(new net::HttpResponseHeaders("")); 192 http_info.headers = make_scoped_refptr(new net::HttpResponseHeaders(""));
193 version_->SetMainScriptHttpResponseInfo(http_info); 193 version_->SetMainScriptHttpResponseInfo(http_info);
194 } 194 }
195 195
196 std::unique_ptr<ServiceWorkerProviderHost> provider_host = 196 std::unique_ptr<ServiceWorkerProviderHost> provider_host =
197 CreateProviderHostForWindow( 197 CreateProviderHostForWindow(
198 helper_->mock_render_process_id(), kProviderID, 198 helper_->mock_render_process_id(), kProviderID,
199 true /* is_parent_frame_secure */, helper_->context()->AsWeakPtr()); 199 true /* is_parent_frame_secure */, helper_->context()->AsWeakPtr(),
200 &remote_endpoint_);
200 provider_host_ = provider_host->AsWeakPtr(); 201 provider_host_ = provider_host->AsWeakPtr();
201 provider_host->SetDocumentUrl(GURL("https://example.com/")); 202 provider_host->SetDocumentUrl(GURL("https://example.com/"));
202 registration_->SetActiveVersion(version_); 203 registration_->SetActiveVersion(version_);
203 provider_host->AssociateRegistration(registration_.get(), 204 provider_host->AssociateRegistration(registration_.get(),
204 false /* notify_controllerchange */); 205 false /* notify_controllerchange */);
205 206
206 ChromeBlobStorageContext* chrome_blob_storage_context = 207 ChromeBlobStorageContext* chrome_blob_storage_context =
207 ChromeBlobStorageContext::GetFor(browser_context_.get()); 208 ChromeBlobStorageContext::GetFor(browser_context_.get());
208 // Wait for chrome_blob_storage_context to finish initializing. 209 // Wait for chrome_blob_storage_context to finish initializing.
209 base::RunLoop().RunUntilIdle(); 210 base::RunLoop().RunUntilIdle();
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 349
349 std::unique_ptr<net::URLRequestJobFactoryImpl> url_request_job_factory_; 350 std::unique_ptr<net::URLRequestJobFactoryImpl> url_request_job_factory_;
350 net::URLRequestContext url_request_context_; 351 net::URLRequestContext url_request_context_;
351 net::TestDelegate url_request_delegate_; 352 net::TestDelegate url_request_delegate_;
352 std::unique_ptr<net::URLRequest> request_; 353 std::unique_ptr<net::URLRequest> request_;
353 354
354 std::unique_ptr<storage::BlobDataBuilder> blob_data_; 355 std::unique_ptr<storage::BlobDataBuilder> blob_data_;
355 356
356 int times_prepare_to_restart_invoked_ = 0; 357 int times_prepare_to_restart_invoked_ = 0;
357 base::WeakPtr<ServiceWorkerProviderHost> provider_host_; 358 base::WeakPtr<ServiceWorkerProviderHost> provider_host_;
359 ServiceWorkerRemoteProviderEndpoint remote_endpoint_;
360
358 // Not owned. 361 // Not owned.
359 MockHttpProtocolHandler* http_protocol_handler_; 362 MockHttpProtocolHandler* http_protocol_handler_;
360 363
361 private: 364 private:
362 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerURLRequestJobTest); 365 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerURLRequestJobTest);
363 }; 366 };
364 367
365 TEST_F(ServiceWorkerURLRequestJobTest, Simple) { 368 TEST_F(ServiceWorkerURLRequestJobTest, Simple) {
366 version_->SetStatus(ServiceWorkerVersion::ACTIVATED); 369 version_->SetStatus(ServiceWorkerVersion::ACTIVATED);
367 TestRequest(200, "OK", std::string(), true /* expect_valid_ssl */); 370 TestRequest(200, "OK", std::string(), true /* expect_valid_ssl */);
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
1182 base::RunLoop().RunUntilIdle(); 1185 base::RunLoop().RunUntilIdle();
1183 1186
1184 // The fetch event request should no longer be in-flight. 1187 // The fetch event request should no longer be in-flight.
1185 EXPECT_FALSE(version_->HasWork()); 1188 EXPECT_FALSE(version_->HasWork());
1186 } 1189 }
1187 1190
1188 // TODO(kinuko): Add more tests with different response data and also for 1191 // TODO(kinuko): Add more tests with different response data and also for
1189 // FallbackToNetwork case. 1192 // FallbackToNetwork case.
1190 1193
1191 } // namespace content 1194 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698