| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 MockResourceContext mock_resource_context_; | 83 MockResourceContext mock_resource_context_; |
| 84 GURL scope_; | 84 GURL scope_; |
| 85 GURL script_url_; | 85 GURL script_url_; |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 class ServiceWorkerTestContentBrowserClient : public TestContentBrowserClient { | 88 class ServiceWorkerTestContentBrowserClient : public TestContentBrowserClient { |
| 89 public: | 89 public: |
| 90 ServiceWorkerTestContentBrowserClient() {} | 90 ServiceWorkerTestContentBrowserClient() {} |
| 91 virtual bool AllowServiceWorker(const GURL& scope, | 91 virtual bool AllowServiceWorker(const GURL& scope, |
| 92 const GURL& first_party, | 92 const GURL& first_party, |
| 93 content::ResourceContext* context) OVERRIDE { | 93 content::ResourceContext* context) override { |
| 94 return false; | 94 return false; |
| 95 } | 95 } |
| 96 }; | 96 }; |
| 97 | 97 |
| 98 TEST_F(ServiceWorkerControlleeRequestHandlerTest, DisallowServiceWorker) { | 98 TEST_F(ServiceWorkerControlleeRequestHandlerTest, DisallowServiceWorker) { |
| 99 ServiceWorkerTestContentBrowserClient test_browser_client; | 99 ServiceWorkerTestContentBrowserClient test_browser_client; |
| 100 ContentBrowserClient* old_browser_client = | 100 ContentBrowserClient* old_browser_client = |
| 101 SetBrowserClientForTesting(&test_browser_client); | 101 SetBrowserClientForTesting(&test_browser_client); |
| 102 | 102 |
| 103 // Store an activated worker. | 103 // Store an activated worker. |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 // Shouldn't crash if the ProviderHost is deleted prior to completion of | 235 // Shouldn't crash if the ProviderHost is deleted prior to completion of |
| 236 // the database lookup. | 236 // the database lookup. |
| 237 context()->RemoveProviderHost(kMockRenderProcessId, kMockProviderId); | 237 context()->RemoveProviderHost(kMockRenderProcessId, kMockProviderId); |
| 238 EXPECT_FALSE(provider_host_.get()); | 238 EXPECT_FALSE(provider_host_.get()); |
| 239 base::RunLoop().RunUntilIdle(); | 239 base::RunLoop().RunUntilIdle(); |
| 240 EXPECT_TRUE(sw_job->ShouldFallbackToNetwork()); | 240 EXPECT_TRUE(sw_job->ShouldFallbackToNetwork()); |
| 241 EXPECT_FALSE(sw_job->ShouldForwardToServiceWorker()); | 241 EXPECT_FALSE(sw_job->ShouldForwardToServiceWorker()); |
| 242 } | 242 } |
| 243 | 243 |
| 244 } // namespace content | 244 } // namespace content |
| OLD | NEW |