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

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

Issue 2142523004: M52: Merge "Reland: service worker: Don't control a subframe of an insecure context" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: fix compile errors Created 4 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/files/scoped_temp_dir.h" 7 #include "base/files/scoped_temp_dir.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 174
175 EXPECT_FALSE(called); 175 EXPECT_FALSE(called);
176 base::RunLoop().RunUntilIdle(); 176 base::RunLoop().RunUntilIdle();
177 EXPECT_TRUE(called); 177 EXPECT_TRUE(called);
178 return registration; 178 return registration;
179 } 179 }
180 180
181 std::unique_ptr<ServiceWorkerProviderHost> 181 std::unique_ptr<ServiceWorkerProviderHost>
182 ServiceWorkerJobTest::CreateControllee() { 182 ServiceWorkerJobTest::CreateControllee() {
183 return std::unique_ptr<ServiceWorkerProviderHost>( 183 return std::unique_ptr<ServiceWorkerProviderHost>(
184 new ServiceWorkerProviderHost(33 /* dummy render_process id */, 184 new ServiceWorkerProviderHost(
185 MSG_ROUTING_NONE /* render_frame_id */, 185 33 /* dummy render_process id */,
186 1 /* dummy provider_id */, 186 MSG_ROUTING_NONE /* render_frame_id */, 1 /* dummy provider_id */,
187 SERVICE_WORKER_PROVIDER_FOR_WINDOW, 187 SERVICE_WORKER_PROVIDER_FOR_WINDOW,
188 helper_->context()->AsWeakPtr(), NULL)); 188 ServiceWorkerProviderHost::FrameSecurityLevel::SECURE,
189 helper_->context()->AsWeakPtr(), NULL));
189 } 190 }
190 191
191 TEST_F(ServiceWorkerJobTest, SameDocumentSameRegistration) { 192 TEST_F(ServiceWorkerJobTest, SameDocumentSameRegistration) {
192 scoped_refptr<ServiceWorkerRegistration> original_registration = 193 scoped_refptr<ServiceWorkerRegistration> original_registration =
193 RunRegisterJob(GURL("http://www.example.com/"), 194 RunRegisterJob(GURL("http://www.example.com/"),
194 GURL("http://www.example.com/service_worker.js")); 195 GURL("http://www.example.com/service_worker.js"));
195 bool called; 196 bool called;
196 scoped_refptr<ServiceWorkerRegistration> registration1; 197 scoped_refptr<ServiceWorkerRegistration> registration1;
197 storage()->FindRegistrationForDocument( 198 storage()->FindRegistrationForDocument(
198 GURL("http://www.example.com/"), 199 GURL("http://www.example.com/"),
(...skipping 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after
1581 ASSERT_TRUE(start_msg); 1582 ASSERT_TRUE(start_msg);
1582 EmbeddedWorkerMsg_StartWorker::Param param; 1583 EmbeddedWorkerMsg_StartWorker::Param param;
1583 EmbeddedWorkerMsg_StartWorker::Read(start_msg, &param); 1584 EmbeddedWorkerMsg_StartWorker::Read(start_msg, &param);
1584 EmbeddedWorkerMsg_StartWorker_Params start_params = base::get<0>(param); 1585 EmbeddedWorkerMsg_StartWorker_Params start_params = base::get<0>(param);
1585 EXPECT_TRUE(start_params.pause_after_download); 1586 EXPECT_TRUE(start_params.pause_after_download);
1586 sink->ClearMessages(); 1587 sink->ClearMessages();
1587 } 1588 }
1588 } 1589 }
1589 1590
1590 } // namespace content 1591 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698