| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/child/service_worker/service_worker_dispatcher.h" | 5 #include "content/child/service_worker/service_worker_dispatcher.h" |
| 6 #include "content/child/service_worker/web_service_worker_impl.h" | 6 #include "content/child/service_worker/web_service_worker_impl.h" |
| 7 #include "content/child/service_worker/web_service_worker_registration_impl.h" | 7 #include "content/child/service_worker/web_service_worker_registration_impl.h" |
| 8 #include "content/child/thread_safe_sender.h" | 8 #include "content/child/thread_safe_sender.h" |
| 9 #include "content/common/service_worker/service_worker_messages.h" | 9 #include "content/common/service_worker/service_worker_messages.h" |
| 10 #include "content/common/service_worker/service_worker_types.h" | 10 #include "content/common/service_worker/service_worker_types.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 dispatcher_.reset(new ServiceWorkerDispatcher(sender_.get())); | 41 dispatcher_.reset(new ServiceWorkerDispatcher(sender_.get())); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void CreateObjectInfoAndVersionAttributes( | 44 void CreateObjectInfoAndVersionAttributes( |
| 45 ServiceWorkerRegistrationObjectInfo* info, | 45 ServiceWorkerRegistrationObjectInfo* info, |
| 46 ServiceWorkerVersionAttributes* attrs) { | 46 ServiceWorkerVersionAttributes* attrs) { |
| 47 info->handle_id = 10; | 47 info->handle_id = 10; |
| 48 info->registration_id = 20; | 48 info->registration_id = 20; |
| 49 | 49 |
| 50 attrs->active.handle_id = 100; | 50 attrs->active.handle_id = 100; |
| 51 attrs->active.version_id = 200; | 51 attrs->active.version_uuid = "94940585-0207-4d8b-bbf2-b0e811b9e5c1"; |
| 52 attrs->waiting.handle_id = 101; | 52 attrs->waiting.handle_id = 101; |
| 53 attrs->waiting.version_id = 201; | 53 attrs->waiting.version_uuid = "f955c2a7-73ac-446d-a4cb-3341a1bb6719"; |
| 54 attrs->installing.handle_id = 102; | 54 attrs->installing.handle_id = 102; |
| 55 attrs->installing.version_id = 202; | 55 attrs->installing.version_uuid = "251c5cce-f67e-494f-8701-069aabd16402"; |
| 56 } | 56 } |
| 57 | 57 |
| 58 WebServiceWorkerRegistrationImpl* FindOrCreateRegistration( | 58 WebServiceWorkerRegistrationImpl* FindOrCreateRegistration( |
| 59 const ServiceWorkerRegistrationObjectInfo& info, | 59 const ServiceWorkerRegistrationObjectInfo& info, |
| 60 const ServiceWorkerVersionAttributes& attrs) { | 60 const ServiceWorkerVersionAttributes& attrs) { |
| 61 return dispatcher_->FindOrCreateRegistration(info, attrs); | 61 return dispatcher_->FindOrCreateRegistration(info, attrs); |
| 62 } | 62 } |
| 63 | 63 |
| 64 bool ContainsServiceWorker(int handle_id) { | 64 bool ContainsServiceWorker(int handle_id) { |
| 65 return ContainsKey(dispatcher_->service_workers_, handle_id); | 65 return ContainsKey(dispatcher_->service_workers_, handle_id); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 ipc_sink()->GetMessageAt(0)->type()); | 209 ipc_sink()->GetMessageAt(0)->type()); |
| 210 EXPECT_EQ(ServiceWorkerHostMsg_DecrementServiceWorkerRefCount::ID, | 210 EXPECT_EQ(ServiceWorkerHostMsg_DecrementServiceWorkerRefCount::ID, |
| 211 ipc_sink()->GetMessageAt(1)->type()); | 211 ipc_sink()->GetMessageAt(1)->type()); |
| 212 EXPECT_EQ(ServiceWorkerHostMsg_DecrementServiceWorkerRefCount::ID, | 212 EXPECT_EQ(ServiceWorkerHostMsg_DecrementServiceWorkerRefCount::ID, |
| 213 ipc_sink()->GetMessageAt(2)->type()); | 213 ipc_sink()->GetMessageAt(2)->type()); |
| 214 EXPECT_EQ(ServiceWorkerHostMsg_DecrementServiceWorkerRefCount::ID, | 214 EXPECT_EQ(ServiceWorkerHostMsg_DecrementServiceWorkerRefCount::ID, |
| 215 ipc_sink()->GetMessageAt(3)->type()); | 215 ipc_sink()->GetMessageAt(3)->type()); |
| 216 } | 216 } |
| 217 | 217 |
| 218 } // namespace content | 218 } // namespace content |
| OLD | NEW |