| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 79 |
| 80 protected: | 80 protected: |
| 81 EmbeddedWorkerTestHelper* helper_; | 81 EmbeddedWorkerTestHelper* helper_; |
| 82 ~TestingServiceWorkerDispatcherHost() override {} | 82 ~TestingServiceWorkerDispatcherHost() override {} |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 class FailToStartWorkerTestHelper : public EmbeddedWorkerTestHelper { | 85 class FailToStartWorkerTestHelper : public EmbeddedWorkerTestHelper { |
| 86 public: | 86 public: |
| 87 FailToStartWorkerTestHelper() : EmbeddedWorkerTestHelper(base::FilePath()) {} | 87 FailToStartWorkerTestHelper() : EmbeddedWorkerTestHelper(base::FilePath()) {} |
| 88 | 88 |
| 89 void OnStartWorker(int embedded_worker_id, | 89 void OnStartWorker( |
| 90 int64_t service_worker_version_id, | 90 int embedded_worker_id, |
| 91 const GURL& scope, | 91 int64_t service_worker_version_id, |
| 92 const GURL& script_url, | 92 const GURL& scope, |
| 93 bool pause_after_download) override { | 93 const GURL& script_url, |
| 94 bool pause_after_download, |
| 95 mojom::ServiceWorkerEventDispatcherRequest request) override { |
| 94 EmbeddedWorkerInstance* worker = registry()->GetWorker(embedded_worker_id); | 96 EmbeddedWorkerInstance* worker = registry()->GetWorker(embedded_worker_id); |
| 95 registry()->OnWorkerStopped(worker->process_id(), embedded_worker_id); | 97 registry()->OnWorkerStopped(worker->process_id(), embedded_worker_id); |
| 96 } | 98 } |
| 97 }; | 99 }; |
| 98 | 100 |
| 99 class ServiceWorkerDispatcherHostTest : public testing::Test { | 101 class ServiceWorkerDispatcherHostTest : public testing::Test { |
| 100 protected: | 102 protected: |
| 101 ServiceWorkerDispatcherHostTest() | 103 ServiceWorkerDispatcherHostTest() |
| 102 : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) {} | 104 : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) {} |
| 103 | 105 |
| (...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 dispatcher_host_->OnMessageReceived(ServiceWorkerHostMsg_FetchEventResponse( | 846 dispatcher_host_->OnMessageReceived(ServiceWorkerHostMsg_FetchEventResponse( |
| 845 version_->embedded_worker()->embedded_worker_id(), kFetchEventId, | 847 version_->embedded_worker()->embedded_worker_id(), kFetchEventId, |
| 846 SERVICE_WORKER_FETCH_EVENT_RESULT_FALLBACK, ServiceWorkerResponse(), | 848 SERVICE_WORKER_FETCH_EVENT_RESULT_FALLBACK, ServiceWorkerResponse(), |
| 847 base::Time::Now())); | 849 base::Time::Now())); |
| 848 | 850 |
| 849 base::RunLoop().RunUntilIdle(); | 851 base::RunLoop().RunUntilIdle(); |
| 850 EXPECT_EQ(0, dispatcher_host_->bad_messages_received_count_); | 852 EXPECT_EQ(0, dispatcher_host_->bad_messages_received_count_); |
| 851 } | 853 } |
| 852 | 854 |
| 853 } // namespace content | 855 } // namespace content |
| OLD | NEW |