| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_dispatcher_host.h" | 5 #include "content/browser/service_worker/service_worker_dispatcher_host.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "content/browser/browser_thread_impl.h" | 10 #include "content/browser/browser_thread_impl.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 content::MockResourceContext resource_context_; | 141 content::MockResourceContext resource_context_; |
| 142 scoped_ptr<EmbeddedWorkerTestHelper> helper_; | 142 scoped_ptr<EmbeddedWorkerTestHelper> helper_; |
| 143 scoped_refptr<TestingServiceWorkerDispatcherHost> dispatcher_host_; | 143 scoped_refptr<TestingServiceWorkerDispatcherHost> dispatcher_host_; |
| 144 }; | 144 }; |
| 145 | 145 |
| 146 class ServiceWorkerTestContentBrowserClient : public TestContentBrowserClient { | 146 class ServiceWorkerTestContentBrowserClient : public TestContentBrowserClient { |
| 147 public: | 147 public: |
| 148 ServiceWorkerTestContentBrowserClient() {} | 148 ServiceWorkerTestContentBrowserClient() {} |
| 149 bool AllowServiceWorker(const GURL& scope, | 149 bool AllowServiceWorker(const GURL& scope, |
| 150 const GURL& first_party, | 150 const GURL& first_party, |
| 151 content::ResourceContext* context) override { | 151 content::ResourceContext* context, |
| 152 int render_process_id, |
| 153 int render_frame_id) override { |
| 152 return false; | 154 return false; |
| 153 } | 155 } |
| 154 }; | 156 }; |
| 155 | 157 |
| 156 TEST_F(ServiceWorkerDispatcherHostTest, | 158 TEST_F(ServiceWorkerDispatcherHostTest, |
| 157 Register_ContentSettingsDisallowsServiceWorker) { | 159 Register_ContentSettingsDisallowsServiceWorker) { |
| 158 ServiceWorkerTestContentBrowserClient test_browser_client; | 160 ServiceWorkerTestContentBrowserClient test_browser_client; |
| 159 ContentBrowserClient* old_browser_client = | 161 ContentBrowserClient* old_browser_client = |
| 160 SetBrowserClientForTesting(&test_browser_client); | 162 SetBrowserClientForTesting(&test_browser_client); |
| 161 | 163 |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 | 555 |
| 554 // To show the new dispatcher can operate, simulate provider creation. Since | 556 // To show the new dispatcher can operate, simulate provider creation. Since |
| 555 // the old dispatcher cleaned up the old provider host, the new one won't | 557 // the old dispatcher cleaned up the old provider host, the new one won't |
| 556 // complain. | 558 // complain. |
| 557 new_dispatcher_host->OnMessageReceived(ServiceWorkerHostMsg_ProviderCreated( | 559 new_dispatcher_host->OnMessageReceived(ServiceWorkerHostMsg_ProviderCreated( |
| 558 kProviderId, MSG_ROUTING_NONE, SERVICE_WORKER_PROVIDER_FOR_WINDOW)); | 560 kProviderId, MSG_ROUTING_NONE, SERVICE_WORKER_PROVIDER_FOR_WINDOW)); |
| 559 EXPECT_EQ(0, new_dispatcher_host->bad_messages_received_count_); | 561 EXPECT_EQ(0, new_dispatcher_host->bad_messages_received_count_); |
| 560 } | 562 } |
| 561 | 563 |
| 562 } // namespace content | 564 } // namespace content |
| OLD | NEW |