| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 base::RunLoop().RunUntilIdle(); | 94 base::RunLoop().RunUntilIdle(); |
| 95 ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED; | 95 ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED; |
| 96 helper_->context()->storage()->StoreRegistration( | 96 helper_->context()->storage()->StoreRegistration( |
| 97 registration_.get(), | 97 registration_.get(), |
| 98 version_.get(), | 98 version_.get(), |
| 99 CreateReceiverOnCurrentThread(&status)); | 99 CreateReceiverOnCurrentThread(&status)); |
| 100 base::RunLoop().RunUntilIdle(); | 100 base::RunLoop().RunUntilIdle(); |
| 101 ASSERT_EQ(SERVICE_WORKER_OK, status); | 101 ASSERT_EQ(SERVICE_WORKER_OK, status); |
| 102 | 102 |
| 103 provider_host_.reset(new ServiceWorkerProviderHost( | 103 provider_host_.reset(new ServiceWorkerProviderHost( |
| 104 kRenderProcessId, kRenderFrameId, 1, | 104 kRenderProcessId, kRenderFrameId, 1, SERVICE_WORKER_PROVIDER_FOR_WINDOW, |
| 105 SERVICE_WORKER_PROVIDER_FOR_CONTROLLEE, | |
| 106 helper_->context()->AsWeakPtr(), dispatcher_host_.get())); | 105 helper_->context()->AsWeakPtr(), dispatcher_host_.get())); |
| 107 | 106 |
| 108 helper_->SimulateAddProcessToPattern(pattern, kRenderProcessId); | 107 helper_->SimulateAddProcessToPattern(pattern, kRenderProcessId); |
| 109 } | 108 } |
| 110 | 109 |
| 111 void TearDown() override { | 110 void TearDown() override { |
| 112 dispatcher_host_ = NULL; | 111 dispatcher_host_ = NULL; |
| 113 registration_ = NULL; | 112 registration_ = NULL; |
| 114 version_ = NULL; | 113 version_ = NULL; |
| 115 provider_host_.reset(); | 114 provider_host_.reset(); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 // 3. SendMessageToWorker (to send InstallEvent), and | 164 // 3. SendMessageToWorker (to send InstallEvent), and |
| 166 EXPECT_EQ(EmbeddedWorkerContextMsg_MessageToWorker::ID, | 165 EXPECT_EQ(EmbeddedWorkerContextMsg_MessageToWorker::ID, |
| 167 ipc_sink()->GetMessageAt(2)->type()); | 166 ipc_sink()->GetMessageAt(2)->type()); |
| 168 // 4. StateChanged (state == Installed). | 167 // 4. StateChanged (state == Installed). |
| 169 VerifyStateChangedMessage(handle->handle_id(), | 168 VerifyStateChangedMessage(handle->handle_id(), |
| 170 blink::WebServiceWorkerStateInstalled, | 169 blink::WebServiceWorkerStateInstalled, |
| 171 ipc_sink()->GetMessageAt(3)); | 170 ipc_sink()->GetMessageAt(3)); |
| 172 } | 171 } |
| 173 | 172 |
| 174 } // namespace content | 173 } // namespace content |
| OLD | NEW |