| 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/service_worker_handle_reference.h" | 6 #include "content/child/service_worker/service_worker_handle_reference.h" |
| 7 #include "content/child/service_worker/service_worker_provider_context.h" | 7 #include "content/child/service_worker/service_worker_provider_context.h" |
| 8 #include "content/child/service_worker/web_service_worker_impl.h" | 8 #include "content/child/service_worker/web_service_worker_impl.h" |
| 9 #include "content/child/service_worker/web_service_worker_registration_impl.h" | 9 #include "content/child/service_worker/web_service_worker_registration_impl.h" |
| 10 #include "content/child/thread_safe_sender.h" | 10 #include "content/child/thread_safe_sender.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 109 |
| 110 class MockWebServiceWorkerProviderClientImpl | 110 class MockWebServiceWorkerProviderClientImpl |
| 111 : public blink::WebServiceWorkerProviderClient { | 111 : public blink::WebServiceWorkerProviderClient { |
| 112 public: | 112 public: |
| 113 MockWebServiceWorkerProviderClientImpl(int provider_id, | 113 MockWebServiceWorkerProviderClientImpl(int provider_id, |
| 114 ServiceWorkerDispatcher* dispatcher) | 114 ServiceWorkerDispatcher* dispatcher) |
| 115 : provider_id_(provider_id), dispatcher_(dispatcher) { | 115 : provider_id_(provider_id), dispatcher_(dispatcher) { |
| 116 dispatcher_->AddProviderClient(provider_id, this); | 116 dispatcher_->AddProviderClient(provider_id, this); |
| 117 } | 117 } |
| 118 | 118 |
| 119 ~MockWebServiceWorkerProviderClientImpl() override { | 119 ~MockWebServiceWorkerProviderClientImpl() { |
| 120 dispatcher_->RemoveProviderClient(provider_id_); | 120 dispatcher_->RemoveProviderClient(provider_id_); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void setController( | 123 void setController( |
| 124 blink::WebPassOwnPtr<blink::WebServiceWorker::Handle> handle, | 124 blink::WebPassOwnPtr<blink::WebServiceWorker::Handle> handle, |
| 125 bool shouldNotifyControllerChange) override { | 125 bool shouldNotifyControllerChange) { |
| 126 // WebPassOwnPtr cannot be owned in Chromium, so drop the handle here. | 126 // WebPassOwnPtr cannot be owned in Chromium, so drop the handle here. |
| 127 // The destruction releases ServiceWorkerHandleReference. | 127 // The destruction releases ServiceWorkerHandleReference. |
| 128 is_set_controlled_called_ = true; | 128 is_set_controlled_called_ = true; |
| 129 } | 129 } |
| 130 | 130 |
| 131 void dispatchMessageEvent( | 131 void dispatchMessageEvent( |
| 132 blink::WebPassOwnPtr<blink::WebServiceWorker::Handle> handle, | 132 blink::WebPassOwnPtr<blink::WebServiceWorker::Handle> handle, |
| 133 const blink::WebString& message, | 133 const blink::WebString& message, |
| 134 const blink::WebMessagePortChannelArray& channels) override { | 134 const blink::WebMessagePortChannelArray& channels) override { |
| 135 // WebPassOwnPtr cannot be owned in Chromium, so drop the handle here. | 135 // WebPassOwnPtr cannot be owned in Chromium, so drop the handle here. |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 ipc_sink()->GetMessageAt(0)->type()); | 513 ipc_sink()->GetMessageAt(0)->type()); |
| 514 EXPECT_EQ(ServiceWorkerHostMsg_DecrementServiceWorkerRefCount::ID, | 514 EXPECT_EQ(ServiceWorkerHostMsg_DecrementServiceWorkerRefCount::ID, |
| 515 ipc_sink()->GetMessageAt(1)->type()); | 515 ipc_sink()->GetMessageAt(1)->type()); |
| 516 EXPECT_EQ(ServiceWorkerHostMsg_DecrementServiceWorkerRefCount::ID, | 516 EXPECT_EQ(ServiceWorkerHostMsg_DecrementServiceWorkerRefCount::ID, |
| 517 ipc_sink()->GetMessageAt(2)->type()); | 517 ipc_sink()->GetMessageAt(2)->type()); |
| 518 EXPECT_EQ(ServiceWorkerHostMsg_DecrementRegistrationRefCount::ID, | 518 EXPECT_EQ(ServiceWorkerHostMsg_DecrementRegistrationRefCount::ID, |
| 519 ipc_sink()->GetMessageAt(3)->type()); | 519 ipc_sink()->GetMessageAt(3)->type()); |
| 520 } | 520 } |
| 521 | 521 |
| 522 } // namespace content | 522 } // namespace content |
| OLD | NEW |