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 "base/files/scoped_temp_dir.h" | 5 #include "base/files/scoped_temp_dir.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "content/browser/browser_thread_impl.h" | 8 #include "content/browser/browser_thread_impl.h" |
9 #include "content/browser/fileapi/mock_url_request_delegate.h" | 9 #include "content/browser/fileapi/mock_url_request_delegate.h" |
10 #include "content/browser/service_worker/embedded_worker_test_helper.h" | 10 #include "content/browser/service_worker/embedded_worker_test_helper.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 MockResourceContext mock_resource_context_; | 84 MockResourceContext mock_resource_context_; |
85 GURL scope_; | 85 GURL scope_; |
86 GURL script_url_; | 86 GURL script_url_; |
87 }; | 87 }; |
88 | 88 |
89 class ServiceWorkerTestContentBrowserClient : public TestContentBrowserClient { | 89 class ServiceWorkerTestContentBrowserClient : public TestContentBrowserClient { |
90 public: | 90 public: |
91 ServiceWorkerTestContentBrowserClient() {} | 91 ServiceWorkerTestContentBrowserClient() {} |
92 bool AllowServiceWorker(const GURL& scope, | 92 bool AllowServiceWorker(const GURL& scope, |
93 const GURL& first_party, | 93 const GURL& first_party, |
94 content::ResourceContext* context) override { | 94 content::ResourceContext* context, |
| 95 int render_process_id, |
| 96 int render_frame_id) override { |
95 return false; | 97 return false; |
96 } | 98 } |
97 }; | 99 }; |
98 | 100 |
99 TEST_F(ServiceWorkerControlleeRequestHandlerTest, DisallowServiceWorker) { | 101 TEST_F(ServiceWorkerControlleeRequestHandlerTest, DisallowServiceWorker) { |
100 ServiceWorkerTestContentBrowserClient test_browser_client; | 102 ServiceWorkerTestContentBrowserClient test_browser_client; |
101 ContentBrowserClient* old_browser_client = | 103 ContentBrowserClient* old_browser_client = |
102 SetBrowserClientForTesting(&test_browser_client); | 104 SetBrowserClientForTesting(&test_browser_client); |
103 | 105 |
104 // Store an activated worker. | 106 // Store an activated worker. |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 // Shouldn't crash if the ProviderHost is deleted prior to completion of | 232 // Shouldn't crash if the ProviderHost is deleted prior to completion of |
231 // the database lookup. | 233 // the database lookup. |
232 context()->RemoveProviderHost(kMockRenderProcessId, kMockProviderId); | 234 context()->RemoveProviderHost(kMockRenderProcessId, kMockProviderId); |
233 EXPECT_FALSE(provider_host_.get()); | 235 EXPECT_FALSE(provider_host_.get()); |
234 base::RunLoop().RunUntilIdle(); | 236 base::RunLoop().RunUntilIdle(); |
235 EXPECT_TRUE(sw_job->ShouldFallbackToNetwork()); | 237 EXPECT_TRUE(sw_job->ShouldFallbackToNetwork()); |
236 EXPECT_FALSE(sw_job->ShouldForwardToServiceWorker()); | 238 EXPECT_FALSE(sw_job->ShouldForwardToServiceWorker()); |
237 } | 239 } |
238 | 240 |
239 } // namespace content | 241 } // namespace content |
OLD | NEW |