| 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 17 matching lines...) Expand all Loading... |
| 28 const int kRenderProcessId = 88; // A dummy ID for testing. | 28 const int kRenderProcessId = 88; // A dummy ID for testing. |
| 29 const int kRenderFrameId = 44; // A dummy ID for testing. | 29 const int kRenderFrameId = 44; // A dummy ID for testing. |
| 30 | 30 |
| 31 void VerifyStateChangedMessage(int expected_handle_id, | 31 void VerifyStateChangedMessage(int expected_handle_id, |
| 32 blink::WebServiceWorkerState expected_state, | 32 blink::WebServiceWorkerState expected_state, |
| 33 const IPC::Message* message) { | 33 const IPC::Message* message) { |
| 34 ASSERT_TRUE(message != NULL); | 34 ASSERT_TRUE(message != NULL); |
| 35 ServiceWorkerMsg_ServiceWorkerStateChanged::Param param; | 35 ServiceWorkerMsg_ServiceWorkerStateChanged::Param param; |
| 36 ASSERT_TRUE(ServiceWorkerMsg_ServiceWorkerStateChanged::Read( | 36 ASSERT_TRUE(ServiceWorkerMsg_ServiceWorkerStateChanged::Read( |
| 37 message, ¶m)); | 37 message, ¶m)); |
| 38 EXPECT_EQ(expected_handle_id, get<1>(param)); | 38 EXPECT_EQ(expected_handle_id, base::get<1>(param)); |
| 39 EXPECT_EQ(expected_state, get<2>(param)); | 39 EXPECT_EQ(expected_state, base::get<2>(param)); |
| 40 } | 40 } |
| 41 | 41 |
| 42 } // namespace | 42 } // namespace |
| 43 | 43 |
| 44 class TestingServiceWorkerDispatcherHost : public ServiceWorkerDispatcherHost { | 44 class TestingServiceWorkerDispatcherHost : public ServiceWorkerDispatcherHost { |
| 45 public: | 45 public: |
| 46 TestingServiceWorkerDispatcherHost( | 46 TestingServiceWorkerDispatcherHost( |
| 47 int process_id, | 47 int process_id, |
| 48 ServiceWorkerContextWrapper* context_wrapper, | 48 ServiceWorkerContextWrapper* context_wrapper, |
| 49 ResourceContext* resource_context, | 49 ResourceContext* resource_context, |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 // 3. SendMessageToWorker (to send InstallEvent), and | 168 // 3. SendMessageToWorker (to send InstallEvent), and |
| 169 EXPECT_EQ(EmbeddedWorkerContextMsg_MessageToWorker::ID, | 169 EXPECT_EQ(EmbeddedWorkerContextMsg_MessageToWorker::ID, |
| 170 ipc_sink()->GetMessageAt(2)->type()); | 170 ipc_sink()->GetMessageAt(2)->type()); |
| 171 // 4. StateChanged (state == Installed). | 171 // 4. StateChanged (state == Installed). |
| 172 VerifyStateChangedMessage(handle->handle_id(), | 172 VerifyStateChangedMessage(handle->handle_id(), |
| 173 blink::WebServiceWorkerStateInstalled, | 173 blink::WebServiceWorkerStateInstalled, |
| 174 ipc_sink()->GetMessageAt(3)); | 174 ipc_sink()->GetMessageAt(3)); |
| 175 } | 175 } |
| 176 | 176 |
| 177 } // namespace content | 177 } // namespace content |
| OLD | NEW |