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

Side by Side Diff: content/browser/service_worker/service_worker_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 <stdint.h> 5 #include <stdint.h>
6 #include <tuple> 6 #include <tuple>
7 7
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 179
180 EXPECT_FALSE(called); 180 EXPECT_FALSE(called);
181 base::RunLoop().RunUntilIdle(); 181 base::RunLoop().RunUntilIdle();
182 EXPECT_TRUE(called); 182 EXPECT_TRUE(called);
183 return registration; 183 return registration;
184 } 184 }
185 185
186 std::unique_ptr<ServiceWorkerProviderHost> 186 std::unique_ptr<ServiceWorkerProviderHost>
187 ServiceWorkerJobTest::CreateControllee() { 187 ServiceWorkerJobTest::CreateControllee() {
188 return std::unique_ptr<ServiceWorkerProviderHost>( 188 return std::unique_ptr<ServiceWorkerProviderHost>(
189 new ServiceWorkerProviderHost(33 /* dummy render_process id */, 189 new ServiceWorkerProviderHost(
190 MSG_ROUTING_NONE /* render_frame_id */, 190 33 /* dummy render_process id */,
191 1 /* dummy provider_id */, 191 MSG_ROUTING_NONE /* render_frame_id */, 1 /* dummy provider_id */,
192 SERVICE_WORKER_PROVIDER_FOR_WINDOW, 192 SERVICE_WORKER_PROVIDER_FOR_WINDOW,
193 helper_->context()->AsWeakPtr(), NULL)); 193 ServiceWorkerProviderHost::FrameSecurityLevel::SECURE,
194 helper_->context()->AsWeakPtr(), NULL));
194 } 195 }
195 196
196 TEST_F(ServiceWorkerJobTest, SameDocumentSameRegistration) { 197 TEST_F(ServiceWorkerJobTest, SameDocumentSameRegistration) {
197 scoped_refptr<ServiceWorkerRegistration> original_registration = 198 scoped_refptr<ServiceWorkerRegistration> original_registration =
198 RunRegisterJob(GURL("http://www.example.com/"), 199 RunRegisterJob(GURL("http://www.example.com/"),
199 GURL("http://www.example.com/service_worker.js")); 200 GURL("http://www.example.com/service_worker.js"));
200 bool called; 201 bool called;
201 scoped_refptr<ServiceWorkerRegistration> registration1; 202 scoped_refptr<ServiceWorkerRegistration> registration1;
202 storage()->FindRegistrationForDocument( 203 storage()->FindRegistrationForDocument(
203 GURL("http://www.example.com/"), 204 GURL("http://www.example.com/"),
(...skipping 1484 matching lines...) Expand 10 before | Expand all | Expand 10 after
1688 // should not be promoted to ACTIVATED because failure occur 1689 // should not be promoted to ACTIVATED because failure occur
1689 // during shutdown. 1690 // during shutdown.
1690 runner->RunUntilIdle(); 1691 runner->RunUntilIdle();
1691 base::RunLoop().RunUntilIdle(); 1692 base::RunLoop().RunUntilIdle();
1692 EXPECT_EQ(new_version.get(), registration->active_version()); 1693 EXPECT_EQ(new_version.get(), registration->active_version());
1693 EXPECT_EQ(ServiceWorkerVersion::ACTIVATING, new_version->status()); 1694 EXPECT_EQ(ServiceWorkerVersion::ACTIVATING, new_version->status());
1694 registration->RemoveListener(update_helper); 1695 registration->RemoveListener(update_helper);
1695 } 1696 }
1696 1697
1697 } // namespace content 1698 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698