Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: content/browser/service_worker/service_worker_handle_unittest.cc

Issue 1223193009: WIP attempt to replace StartWorker/StopWorker IPCs with a new mojo EmbeddedWorker service. Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-event-dispatching-option2
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 version_->DispatchInstallEvent(CreateReceiverOnCurrentThread(&status)); 152 version_->DispatchInstallEvent(CreateReceiverOnCurrentThread(&status));
153 base::RunLoop().RunUntilIdle(); 153 base::RunLoop().RunUntilIdle();
154 EXPECT_EQ(SERVICE_WORKER_OK, status); 154 EXPECT_EQ(SERVICE_WORKER_OK, status);
155 155
156 version_->SetStatus(ServiceWorkerVersion::INSTALLED); 156 version_->SetStatus(ServiceWorkerVersion::INSTALLED);
157 157
158 ASSERT_EQ(4UL, ipc_sink()->message_count()); 158 ASSERT_EQ(4UL, ipc_sink()->message_count());
159 ASSERT_EQ(0L, dispatcher_host_->bad_message_received_count_); 159 ASSERT_EQ(0L, dispatcher_host_->bad_message_received_count_);
160 160
161 // We should be sending 1. StartWorker, 161 // We should be sending 1. StartWorker,
162 EXPECT_EQ(EmbeddedWorkerMsg_StartWorker::ID, 162 // EXPECT_EQ(EmbeddedWorkerMsg_StartWorker::ID,
163 ipc_sink()->GetMessageAt(0)->type()); 163 // ipc_sink()->GetMessageAt(0)->type());
164 // 2. StateChanged (state == Installing), 164 // 2. StateChanged (state == Installing),
165 VerifyStateChangedMessage(handle->handle_id(), 165 VerifyStateChangedMessage(handle->handle_id(),
166 blink::WebServiceWorkerStateInstalling, 166 blink::WebServiceWorkerStateInstalling,
167 ipc_sink()->GetMessageAt(1)); 167 ipc_sink()->GetMessageAt(1));
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698