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

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

Issue 2009453002: service worker: Don't control a subframe of an insecure context (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: selfreview 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 "content/browser/service_worker/service_worker_controllee_request_handl er.h" 5 #include "content/browser/service_worker/service_worker_controllee_request_handl er.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 version_ = new ServiceWorkerVersion( 112 version_ = new ServiceWorkerVersion(
113 registration_.get(), script_url_, 1L, context()->AsWeakPtr()); 113 registration_.get(), script_url_, 1L, context()->AsWeakPtr());
114 114
115 std::vector<ServiceWorkerDatabase::ResourceRecord> records; 115 std::vector<ServiceWorkerDatabase::ResourceRecord> records;
116 records.push_back( 116 records.push_back(
117 ServiceWorkerDatabase::ResourceRecord(10, version_->script_url(), 100)); 117 ServiceWorkerDatabase::ResourceRecord(10, version_->script_url(), 100));
118 version_->script_cache_map()->SetResources(records); 118 version_->script_cache_map()->SetResources(records);
119 119
120 // An empty host. 120 // An empty host.
121 std::unique_ptr<ServiceWorkerProviderHost> host( 121 std::unique_ptr<ServiceWorkerProviderHost> host(
122 new ServiceWorkerProviderHost(helper_->mock_render_process_id(), 122 new ServiceWorkerProviderHost(
123 MSG_ROUTING_NONE, kMockProviderId, 123 helper_->mock_render_process_id(), MSG_ROUTING_NONE,
124 SERVICE_WORKER_PROVIDER_FOR_WINDOW, 124 kMockProviderId, SERVICE_WORKER_PROVIDER_FOR_WINDOW,
125 context()->AsWeakPtr(), NULL)); 125 true /* is_parent_frame_secure */, context()->AsWeakPtr(), NULL));
126 provider_host_ = host->AsWeakPtr(); 126 provider_host_ = host->AsWeakPtr();
127 context()->AddProviderHost(std::move(host)); 127 context()->AddProviderHost(std::move(host));
128 128
129 context()->storage()->LazyInitialize(base::Bind(&base::DoNothing)); 129 context()->storage()->LazyInitialize(base::Bind(&base::DoNothing));
130 base::RunLoop().RunUntilIdle(); 130 base::RunLoop().RunUntilIdle();
131 } 131 }
132 132
133 void TearDown() override { 133 void TearDown() override {
134 version_ = NULL; 134 version_ = NULL;
135 registration_ = NULL; 135 registration_ = NULL;
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 ServiceWorkerRequestTestResources sub_test_resources( 314 ServiceWorkerRequestTestResources sub_test_resources(
315 this, GURL("http://host/scope/doc/subresource"), RESOURCE_TYPE_IMAGE); 315 this, GURL("http://host/scope/doc/subresource"), RESOURCE_TYPE_IMAGE);
316 ServiceWorkerURLRequestJob* sub_job = sub_test_resources.MaybeCreateJob(); 316 ServiceWorkerURLRequestJob* sub_job = sub_test_resources.MaybeCreateJob();
317 317
318 // This job shouldn't be created because this worker doesn't have fetch 318 // This job shouldn't be created because this worker doesn't have fetch
319 // handler. 319 // handler.
320 EXPECT_EQ(nullptr, sub_job); 320 EXPECT_EQ(nullptr, sub_job);
321 } 321 }
322 322
323 } // namespace content 323 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698