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 <tuple> |
5 #include <vector> | 6 #include <vector> |
6 | 7 |
7 #include "base/macros.h" | 8 #include "base/macros.h" |
8 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
9 #include "content/browser/service_worker/embedded_worker_registry.h" | 10 #include "content/browser/service_worker/embedded_worker_registry.h" |
10 #include "content/browser/service_worker/embedded_worker_test_helper.h" | 11 #include "content/browser/service_worker/embedded_worker_test_helper.h" |
11 #include "content/browser/service_worker/service_worker_context_core.h" | 12 #include "content/browser/service_worker/service_worker_context_core.h" |
12 #include "content/browser/service_worker/service_worker_dispatcher_host.h" | 13 #include "content/browser/service_worker/service_worker_dispatcher_host.h" |
13 #include "content/browser/service_worker/service_worker_handle.h" | 14 #include "content/browser/service_worker/service_worker_handle.h" |
14 #include "content/browser/service_worker/service_worker_registration.h" | 15 #include "content/browser/service_worker/service_worker_registration.h" |
(...skipping 14 matching lines...) Expand all Loading... |
29 | 30 |
30 const int kRenderFrameId = 44; // A dummy ID for testing. | 31 const int kRenderFrameId = 44; // A dummy ID for testing. |
31 | 32 |
32 void VerifyStateChangedMessage(int expected_handle_id, | 33 void VerifyStateChangedMessage(int expected_handle_id, |
33 blink::WebServiceWorkerState expected_state, | 34 blink::WebServiceWorkerState expected_state, |
34 const IPC::Message* message) { | 35 const IPC::Message* message) { |
35 ASSERT_TRUE(message != NULL); | 36 ASSERT_TRUE(message != NULL); |
36 ServiceWorkerMsg_ServiceWorkerStateChanged::Param param; | 37 ServiceWorkerMsg_ServiceWorkerStateChanged::Param param; |
37 ASSERT_TRUE(ServiceWorkerMsg_ServiceWorkerStateChanged::Read( | 38 ASSERT_TRUE(ServiceWorkerMsg_ServiceWorkerStateChanged::Read( |
38 message, ¶m)); | 39 message, ¶m)); |
39 EXPECT_EQ(expected_handle_id, base::get<1>(param)); | 40 EXPECT_EQ(expected_handle_id, std::get<1>(param)); |
40 EXPECT_EQ(expected_state, base::get<2>(param)); | 41 EXPECT_EQ(expected_state, std::get<2>(param)); |
41 } | 42 } |
42 | 43 |
43 } // namespace | 44 } // namespace |
44 | 45 |
45 class TestingServiceWorkerDispatcherHost : public ServiceWorkerDispatcherHost { | 46 class TestingServiceWorkerDispatcherHost : public ServiceWorkerDispatcherHost { |
46 public: | 47 public: |
47 TestingServiceWorkerDispatcherHost( | 48 TestingServiceWorkerDispatcherHost( |
48 int process_id, | 49 int process_id, |
49 ServiceWorkerContextWrapper* context_wrapper, | 50 ServiceWorkerContextWrapper* context_wrapper, |
50 ResourceContext* resource_context, | 51 ResourceContext* resource_context, |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 VerifyStateChangedMessage(handle->handle_id(), | 165 VerifyStateChangedMessage(handle->handle_id(), |
165 blink::WebServiceWorkerStateInstalling, | 166 blink::WebServiceWorkerStateInstalling, |
166 ipc_sink()->GetMessageAt(1)); | 167 ipc_sink()->GetMessageAt(1)); |
167 // 3. StateChanged (state == Installed). | 168 // 3. StateChanged (state == Installed). |
168 VerifyStateChangedMessage(handle->handle_id(), | 169 VerifyStateChangedMessage(handle->handle_id(), |
169 blink::WebServiceWorkerStateInstalled, | 170 blink::WebServiceWorkerStateInstalled, |
170 ipc_sink()->GetMessageAt(2)); | 171 ipc_sink()->GetMessageAt(2)); |
171 } | 172 } |
172 | 173 |
173 } // namespace content | 174 } // namespace content |
OLD | NEW |