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

Unified Diff: content/browser/service_worker/service_worker_version_unittest.cc

Issue 964353002: ServiceWorkerVersion: remove unused SendMessage method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/service_worker/service_worker_version.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/service_worker/service_worker_version_unittest.cc
diff --git a/content/browser/service_worker/service_worker_version_unittest.cc b/content/browser/service_worker/service_worker_version_unittest.cc
index 7cf16e2db771d19f60994c7f5e240c72cbe9869d..bdcea4770096a151e305075a8378e9e3eb04d0dd 100644
--- a/content/browser/service_worker/service_worker_version_unittest.cc
+++ b/content/browser/service_worker/service_worker_version_unittest.cc
@@ -250,31 +250,31 @@ TEST_F(ServiceWorkerVersionTest, ConcurrentStartAndStop) {
EXPECT_EQ(SERVICE_WORKER_OK, status3);
}
-TEST_F(ServiceWorkerVersionTest, SendMessage) {
+TEST_F(ServiceWorkerVersionTest, DispatchEventToStoppedWorker) {
EXPECT_EQ(ServiceWorkerVersion::STOPPED, version_->running_status());
- // Send a message without starting the worker.
+ // Dispatch an event without starting the worker.
ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED;
- version_->SendMessage(TestMsg_Message(),
- CreateReceiverOnCurrentThread(&status));
+ version_->SetStatus(ServiceWorkerVersion::INSTALLING);
+ version_->DispatchInstallEvent(-1, CreateReceiverOnCurrentThread(&status));
base::RunLoop().RunUntilIdle();
EXPECT_EQ(SERVICE_WORKER_OK, status);
// The worker should be now started.
EXPECT_EQ(ServiceWorkerVersion::RUNNING, version_->running_status());
- // Stop the worker, and then send the message immediately.
- ServiceWorkerStatusCode msg_status = SERVICE_WORKER_ERROR_FAILED;
+ // Stop the worker, and then dispatch an event immediately after that.
+ status = SERVICE_WORKER_ERROR_FAILED;
ServiceWorkerStatusCode stop_status = SERVICE_WORKER_ERROR_FAILED;
version_->StopWorker(CreateReceiverOnCurrentThread(&stop_status));
- version_->SendMessage(TestMsg_Message(),
- CreateReceiverOnCurrentThread(&msg_status));
+ version_->DispatchInstallEvent(
+ -1, CreateReceiverOnCurrentThread(&status));
base::RunLoop().RunUntilIdle();
EXPECT_EQ(SERVICE_WORKER_OK, stop_status);
- // SendMessage should return SERVICE_WORKER_OK since the worker should have
- // been restarted to deliver the message.
- EXPECT_EQ(SERVICE_WORKER_OK, msg_status);
+ // Dispatch an event should return SERVICE_WORKER_OK since the worker
+ // should have been restarted to dispatch the event.
+ EXPECT_EQ(SERVICE_WORKER_OK, status);
// The worker should be now started again.
EXPECT_EQ(ServiceWorkerVersion::RUNNING, version_->running_status());
« no previous file with comments | « content/browser/service_worker/service_worker_version.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698