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

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

Issue 966393002: ServiceWorkerVersion: remove unused parameter in DispatchInstallEvent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: build fix Created 5 years, 9 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 // Start the worker, and then... 128 // Start the worker, and then...
129 ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED; 129 ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED;
130 version_->StartWorker(CreateReceiverOnCurrentThread(&status)); 130 version_->StartWorker(CreateReceiverOnCurrentThread(&status));
131 base::RunLoop().RunUntilIdle(); 131 base::RunLoop().RunUntilIdle();
132 EXPECT_EQ(SERVICE_WORKER_OK, status); 132 EXPECT_EQ(SERVICE_WORKER_OK, status);
133 133
134 // ...dispatch install event. 134 // ...dispatch install event.
135 status = SERVICE_WORKER_ERROR_FAILED; 135 status = SERVICE_WORKER_ERROR_FAILED;
136 version_->SetStatus(ServiceWorkerVersion::INSTALLING); 136 version_->SetStatus(ServiceWorkerVersion::INSTALLING);
137 version_->DispatchInstallEvent(-1, CreateReceiverOnCurrentThread(&status)); 137 version_->DispatchInstallEvent(CreateReceiverOnCurrentThread(&status));
138 base::RunLoop().RunUntilIdle(); 138 base::RunLoop().RunUntilIdle();
139 EXPECT_EQ(SERVICE_WORKER_OK, status); 139 EXPECT_EQ(SERVICE_WORKER_OK, status);
140 140
141 version_->SetStatus(ServiceWorkerVersion::INSTALLED); 141 version_->SetStatus(ServiceWorkerVersion::INSTALLED);
142 142
143 ASSERT_EQ(4UL, ipc_sink()->message_count()); 143 ASSERT_EQ(4UL, ipc_sink()->message_count());
144 ASSERT_EQ(0L, dispatcher_host_->bad_message_received_count_); 144 ASSERT_EQ(0L, dispatcher_host_->bad_message_received_count_);
145 145
146 // We should be sending 1. StartWorker, 146 // We should be sending 1. StartWorker,
147 EXPECT_EQ(EmbeddedWorkerMsg_StartWorker::ID, 147 EXPECT_EQ(EmbeddedWorkerMsg_StartWorker::ID,
148 ipc_sink()->GetMessageAt(0)->type()); 148 ipc_sink()->GetMessageAt(0)->type());
149 // 2. StateChanged (state == Installing), 149 // 2. StateChanged (state == Installing),
150 VerifyStateChangedMessage(handle->handle_id(), 150 VerifyStateChangedMessage(handle->handle_id(),
151 blink::WebServiceWorkerStateInstalling, 151 blink::WebServiceWorkerStateInstalling,
152 ipc_sink()->GetMessageAt(1)); 152 ipc_sink()->GetMessageAt(1));
153 // 3. SendMessageToWorker (to send InstallEvent), and 153 // 3. SendMessageToWorker (to send InstallEvent), and
154 EXPECT_EQ(EmbeddedWorkerContextMsg_MessageToWorker::ID, 154 EXPECT_EQ(EmbeddedWorkerContextMsg_MessageToWorker::ID,
155 ipc_sink()->GetMessageAt(2)->type()); 155 ipc_sink()->GetMessageAt(2)->type());
156 // 4. StateChanged (state == Installed). 156 // 4. StateChanged (state == Installed).
157 VerifyStateChangedMessage(handle->handle_id(), 157 VerifyStateChangedMessage(handle->handle_id(),
158 blink::WebServiceWorkerStateInstalled, 158 blink::WebServiceWorkerStateInstalled,
159 ipc_sink()->GetMessageAt(3)); 159 ipc_sink()->GetMessageAt(3));
160 } 160 }
161 161
162 } // namespace content 162 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698