| 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/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
| 7 #include "content/browser/service_worker/embedded_worker_registry.h" | 7 #include "content/browser/service_worker/embedded_worker_registry.h" |
| 8 #include "content/browser/service_worker/embedded_worker_test_helper.h" | 8 #include "content/browser/service_worker/embedded_worker_test_helper.h" |
| 9 #include "content/browser/service_worker/service_worker_context_core.h" | 9 #include "content/browser/service_worker/service_worker_context_core.h" |
| 10 #include "content/browser/service_worker/service_worker_dispatcher_host.h" | 10 #include "content/browser/service_worker/service_worker_dispatcher_host.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 base::RunLoop().RunUntilIdle(); | 98 base::RunLoop().RunUntilIdle(); |
| 99 ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED; | 99 ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED; |
| 100 helper_->context()->storage()->StoreRegistration( | 100 helper_->context()->storage()->StoreRegistration( |
| 101 registration_.get(), | 101 registration_.get(), |
| 102 version_.get(), | 102 version_.get(), |
| 103 CreateReceiverOnCurrentThread(&status)); | 103 CreateReceiverOnCurrentThread(&status)); |
| 104 base::RunLoop().RunUntilIdle(); | 104 base::RunLoop().RunUntilIdle(); |
| 105 ASSERT_EQ(SERVICE_WORKER_OK, status); | 105 ASSERT_EQ(SERVICE_WORKER_OK, status); |
| 106 | 106 |
| 107 provider_host_.reset(new ServiceWorkerProviderHost( | 107 provider_host_.reset(new ServiceWorkerProviderHost( |
| 108 kRenderProcessId, kRenderFrameId, 1, SERVICE_WORKER_PROVIDER_FOR_WINDOW, | 108 kRenderProcessId, kRenderFrameId, |
| 109 MSG_ROUTING_NONE /* shared_worker_route_id */, 1, |
| 109 helper_->context()->AsWeakPtr(), dispatcher_host_.get())); | 110 helper_->context()->AsWeakPtr(), dispatcher_host_.get())); |
| 110 | 111 |
| 111 helper_->SimulateAddProcessToPattern(pattern, kRenderProcessId); | 112 helper_->SimulateAddProcessToPattern(pattern, kRenderProcessId); |
| 112 } | 113 } |
| 113 | 114 |
| 114 void TearDown() override { | 115 void TearDown() override { |
| 115 dispatcher_host_ = NULL; | 116 dispatcher_host_ = NULL; |
| 116 registration_ = NULL; | 117 registration_ = NULL; |
| 117 version_ = NULL; | 118 version_ = NULL; |
| 118 provider_host_.reset(); | 119 provider_host_.reset(); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 // 3. SendMessageToWorker (to send InstallEvent), and | 169 // 3. SendMessageToWorker (to send InstallEvent), and |
| 169 EXPECT_EQ(EmbeddedWorkerContextMsg_MessageToWorker::ID, | 170 EXPECT_EQ(EmbeddedWorkerContextMsg_MessageToWorker::ID, |
| 170 ipc_sink()->GetMessageAt(2)->type()); | 171 ipc_sink()->GetMessageAt(2)->type()); |
| 171 // 4. StateChanged (state == Installed). | 172 // 4. StateChanged (state == Installed). |
| 172 VerifyStateChangedMessage(handle->handle_id(), | 173 VerifyStateChangedMessage(handle->handle_id(), |
| 173 blink::WebServiceWorkerStateInstalled, | 174 blink::WebServiceWorkerStateInstalled, |
| 174 ipc_sink()->GetMessageAt(3)); | 175 ipc_sink()->GetMessageAt(3)); |
| 175 } | 176 } |
| 176 | 177 |
| 177 } // namespace content | 178 } // namespace content |
| OLD | NEW |