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

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

Issue 931173002: Implement EmbeddedWorkerContextClient.setCachedMetadata/clearCachedMetadata (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix clang failure 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 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_registration.h" 10 #include "content/browser/service_worker/service_worker_registration.h"
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 274
275 // SendMessage should return SERVICE_WORKER_OK since the worker should have 275 // SendMessage should return SERVICE_WORKER_OK since the worker should have
276 // been restarted to deliver the message. 276 // been restarted to deliver the message.
277 EXPECT_EQ(SERVICE_WORKER_OK, msg_status); 277 EXPECT_EQ(SERVICE_WORKER_OK, msg_status);
278 278
279 // The worker should be now started again. 279 // The worker should be now started again.
280 EXPECT_EQ(ServiceWorkerVersion::RUNNING, version_->running_status()); 280 EXPECT_EQ(ServiceWorkerVersion::RUNNING, version_->running_status());
281 } 281 }
282 282
283 TEST_F(ServiceWorkerVersionTest, ReceiveMessageFromWorker) { 283 TEST_F(ServiceWorkerVersionTest, ReceiveMessageFromWorker) {
284 // Start worker.
285 ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED;
286 version_->StartWorker(CreateReceiverOnCurrentThread(&status));
287 EXPECT_EQ(ServiceWorkerVersion::STARTING, version_->running_status());
288 base::RunLoop().RunUntilIdle();
289 EXPECT_EQ(SERVICE_WORKER_OK, status);
290 EXPECT_EQ(ServiceWorkerVersion::RUNNING, version_->running_status());
291
284 MessageReceiverFromWorker receiver(version_->embedded_worker()); 292 MessageReceiverFromWorker receiver(version_->embedded_worker());
285 293
286 // Simulate sending some dummy values from the worker. 294 // Simulate sending some dummy values from the worker.
287 helper_->SimulateSendValueToBrowser( 295 helper_->SimulateSendValueToBrowser(
288 version_->embedded_worker()->embedded_worker_id(), 555); 296 version_->embedded_worker()->embedded_worker_id(), 555);
289 helper_->SimulateSendValueToBrowser( 297 helper_->SimulateSendValueToBrowser(
290 version_->embedded_worker()->embedded_worker_id(), 777); 298 version_->embedded_worker()->embedded_worker_id(), 777);
291 299
292 // Verify the receiver received the values. 300 // Verify the receiver received the values.
293 ASSERT_EQ(2U, receiver.received_values().size()); 301 ASSERT_EQ(2U, receiver.received_values().size());
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 helper_->context()->embedded_worker_registry()->RemoveChildProcessSender( 445 helper_->context()->embedded_worker_registry()->RemoveChildProcessSender(
438 process_id); 446 process_id);
439 base::RunLoop().RunUntilIdle(); 447 base::RunLoop().RunUntilIdle();
440 448
441 // Callback completed. 449 // Callback completed.
442 EXPECT_EQ(SERVICE_WORKER_ERROR_START_WORKER_FAILED, status); 450 EXPECT_EQ(SERVICE_WORKER_ERROR_START_WORKER_FAILED, status);
443 EXPECT_EQ(ServiceWorkerVersion::STOPPED, version_->running_status()); 451 EXPECT_EQ(ServiceWorkerVersion::STOPPED, version_->running_status());
444 } 452 }
445 453
446 } // namespace content 454 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/service_worker/service_worker_version.cc ('k') | content/common/service_worker/service_worker_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698