OLD | NEW |
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_provider_host.h" | 5 #include "content/browser/service_worker/service_worker_provider_host.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 void SetUp() override { | 48 void SetUp() override { |
49 old_content_browser_client_ = | 49 old_content_browser_client_ = |
50 SetBrowserClientForTesting(&test_content_browser_client_); | 50 SetBrowserClientForTesting(&test_content_browser_client_); |
51 ResetSchemesAndOriginsWhitelist(); | 51 ResetSchemesAndOriginsWhitelist(); |
52 | 52 |
53 helper_.reset(new EmbeddedWorkerTestHelper(base::FilePath())); | 53 helper_.reset(new EmbeddedWorkerTestHelper(base::FilePath())); |
54 context_ = helper_->context(); | 54 context_ = helper_->context(); |
55 script_url_ = GURL("https://www.example.com/service_worker.js"); | 55 script_url_ = GURL("https://www.example.com/service_worker.js"); |
56 registration1_ = new ServiceWorkerRegistration( | 56 registration1_ = new ServiceWorkerRegistration( |
57 GURL("https://www.example.com/"), 1L, context_->AsWeakPtr()); | 57 GURL("https://www.example.com/"), false /* use_cache */, 1L, |
| 58 context_->AsWeakPtr()); |
58 registration2_ = new ServiceWorkerRegistration( | 59 registration2_ = new ServiceWorkerRegistration( |
59 GURL("https://www.example.com/example"), 2L, context_->AsWeakPtr()); | 60 GURL("https://www.example.com/example"), false /* use_cache */, 2L, |
| 61 context_->AsWeakPtr()); |
60 registration3_ = new ServiceWorkerRegistration( | 62 registration3_ = new ServiceWorkerRegistration( |
61 GURL("https://other.example.com/"), 3L, context_->AsWeakPtr()); | 63 GURL("https://other.example.com/"), false /* use_cache */, 3L, |
| 64 context_->AsWeakPtr()); |
62 } | 65 } |
63 | 66 |
64 void TearDown() override { | 67 void TearDown() override { |
65 registration1_ = 0; | 68 registration1_ = 0; |
66 registration2_ = 0; | 69 registration2_ = 0; |
67 helper_.reset(); | 70 helper_.reset(); |
68 SetBrowserClientForTesting(old_content_browser_client_); | 71 SetBrowserClientForTesting(old_content_browser_client_); |
69 // Reset cached security schemes so we don't affect other tests. | 72 // Reset cached security schemes so we don't affect other tests. |
70 ResetSchemesAndOriginsWhitelist(); | 73 ResetSchemesAndOriginsWhitelist(); |
71 } | 74 } |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 provider_host_secure_parent->SetDocumentUrl(url); | 221 provider_host_secure_parent->SetDocumentUrl(url); |
219 EXPECT_TRUE(provider_host_secure_parent->IsContextSecureForServiceWorker()); | 222 EXPECT_TRUE(provider_host_secure_parent->IsContextSecureForServiceWorker()); |
220 | 223 |
221 // Exceptional service worker scheme with insecure parent frame. | 224 // Exceptional service worker scheme with insecure parent frame. |
222 provider_host_insecure_parent->SetDocumentUrl(url); | 225 provider_host_insecure_parent->SetDocumentUrl(url); |
223 EXPECT_FALSE( | 226 EXPECT_FALSE( |
224 provider_host_insecure_parent->IsContextSecureForServiceWorker()); | 227 provider_host_insecure_parent->IsContextSecureForServiceWorker()); |
225 } | 228 } |
226 | 229 |
227 } // namespace content | 230 } // namespace content |
OLD | NEW |