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

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

Issue 2071433003: Reland: service worker: Don't control a subframe of an insecure context (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revised Created 4 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 ServiceWorkerWriteToCacheJobTest() 273 ServiceWorkerWriteToCacheJobTest()
274 : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP), 274 : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP),
275 mock_protocol_handler_(nullptr) {} 275 mock_protocol_handler_(nullptr) {}
276 ~ServiceWorkerWriteToCacheJobTest() override {} 276 ~ServiceWorkerWriteToCacheJobTest() override {}
277 277
278 void CreateHostForVersion( 278 void CreateHostForVersion(
279 int process_id, 279 int process_id,
280 int provider_id, 280 int provider_id,
281 const scoped_refptr<ServiceWorkerVersion>& version) { 281 const scoped_refptr<ServiceWorkerVersion>& version) {
282 std::unique_ptr<ServiceWorkerProviderHost> host( 282 std::unique_ptr<ServiceWorkerProviderHost> host(
283 new ServiceWorkerProviderHost(process_id, MSG_ROUTING_NONE, provider_id, 283 new ServiceWorkerProviderHost(
284 SERVICE_WORKER_PROVIDER_FOR_WORKER, 284 process_id, MSG_ROUTING_NONE, provider_id,
285 context()->AsWeakPtr(), nullptr)); 285 SERVICE_WORKER_PROVIDER_FOR_WORKER,
286 ServiceWorkerProviderHost::FrameSecurityLevel::SECURE,
287 context()->AsWeakPtr(), nullptr));
286 base::WeakPtr<ServiceWorkerProviderHost> provider_host = host->AsWeakPtr(); 288 base::WeakPtr<ServiceWorkerProviderHost> provider_host = host->AsWeakPtr();
287 context()->AddProviderHost(std::move(host)); 289 context()->AddProviderHost(std::move(host));
288 provider_host->running_hosted_version_ = version; 290 provider_host->running_hosted_version_ = version;
289 } 291 }
290 292
291 void SetUpScriptRequest(int process_id, int provider_id) { 293 void SetUpScriptRequest(int process_id, int provider_id) {
292 request_.reset(); 294 request_.reset();
293 url_request_context_.reset(); 295 url_request_context_.reset();
294 url_request_job_factory_.reset(); 296 url_request_job_factory_.reset();
295 mock_protocol_handler_ = nullptr; 297 mock_protocol_handler_ = nullptr;
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 mock_protocol_handler_->SetCreateJobCallback( 610 mock_protocol_handler_->SetCreateJobCallback(
609 base::Bind(&CreateNormalURLRequestJob)); 611 base::Bind(&CreateNormalURLRequestJob));
610 DisableCache(); 612 DisableCache();
611 request_->Start(); 613 request_->Start();
612 base::RunLoop().RunUntilIdle(); 614 base::RunLoop().RunUntilIdle();
613 EXPECT_EQ(net::URLRequestStatus::FAILED, request_->status().status()); 615 EXPECT_EQ(net::URLRequestStatus::FAILED, request_->status().status());
614 EXPECT_EQ(net::ERR_FAILED, request_->status().error()); 616 EXPECT_EQ(net::ERR_FAILED, request_->status().error());
615 } 617 }
616 618
617 } // namespace content 619 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698