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

Side by Side Diff: content/browser/service_worker/service_worker_context_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: refactor errorMessage 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_context_request_handler. h" 5 #include "content/browser/service_worker/service_worker_context_request_handler. h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // A new unstored registration/version. 42 // A new unstored registration/version.
43 scope_ = GURL("http://host/scope/"); 43 scope_ = GURL("http://host/scope/");
44 script_url_ = GURL("http://host/script.js"); 44 script_url_ = GURL("http://host/script.js");
45 registration_ = new ServiceWorkerRegistration( 45 registration_ = new ServiceWorkerRegistration(
46 scope_, 1L, context()->AsWeakPtr()); 46 scope_, 1L, context()->AsWeakPtr());
47 version_ = new ServiceWorkerVersion( 47 version_ = new ServiceWorkerVersion(
48 registration_.get(), script_url_, 1L, context()->AsWeakPtr()); 48 registration_.get(), script_url_, 1L, context()->AsWeakPtr());
49 49
50 // An empty host. 50 // An empty host.
51 std::unique_ptr<ServiceWorkerProviderHost> host( 51 std::unique_ptr<ServiceWorkerProviderHost> host(
52 new ServiceWorkerProviderHost(helper_->mock_render_process_id(), 52 new ServiceWorkerProviderHost(
53 MSG_ROUTING_NONE /* render_frame_id */, 53 helper_->mock_render_process_id(),
54 1 /* provider_id */, 54 MSG_ROUTING_NONE /* render_frame_id */, 1 /* provider_id */,
55 SERVICE_WORKER_PROVIDER_FOR_WINDOW, 55 SERVICE_WORKER_PROVIDER_FOR_WINDOW,
56 context()->AsWeakPtr(), nullptr)); 56 ServiceWorkerProviderHost::FrameSecurityLevel::SECURE,
57 context()->AsWeakPtr(), nullptr));
57 provider_host_ = host->AsWeakPtr(); 58 provider_host_ = host->AsWeakPtr();
58 context()->AddProviderHost(std::move(host)); 59 context()->AddProviderHost(std::move(host));
59 60
60 context()->storage()->LazyInitialize(base::Bind(&EmptyCallback)); 61 context()->storage()->LazyInitialize(base::Bind(&EmptyCallback));
61 base::RunLoop().RunUntilIdle(); 62 base::RunLoop().RunUntilIdle();
62 } 63 }
63 64
64 void TearDown() override { 65 void TearDown() override {
65 version_ = nullptr; 66 version_ = nullptr;
66 registration_ = nullptr; 67 registration_ = nullptr;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 ServiceWorkerWriteToCacheJob* sw_job = 182 ServiceWorkerWriteToCacheJob* sw_job =
182 static_cast<ServiceWorkerWriteToCacheJob*>(job.get()); 183 static_cast<ServiceWorkerWriteToCacheJob*>(job.get());
183 184
184 // Verify that the request is properly annotated as originating from a 185 // Verify that the request is properly annotated as originating from a
185 // Service Worker. 186 // Service Worker.
186 EXPECT_TRUE(ResourceRequestInfo::OriginatedFromServiceWorker( 187 EXPECT_TRUE(ResourceRequestInfo::OriginatedFromServiceWorker(
187 sw_job->net_request_.get())); 188 sw_job->net_request_.get()));
188 } 189 }
189 190
190 } // namespace content 191 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698