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

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

Issue 360123002: ServiceWorker: some more groundwork in support of the update process (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
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/files/scoped_temp_dir.h" 5 #include "base/files/scoped_temp_dir.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "content/browser/browser_thread_impl.h" 8 #include "content/browser/browser_thread_impl.h"
9 #include "content/browser/service_worker/embedded_worker_registry.h" 9 #include "content/browser/service_worker/embedded_worker_registry.h"
10 #include "content/browser/service_worker/embedded_worker_test_helper.h" 10 #include "content/browser/service_worker/embedded_worker_test_helper.h"
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 // Manually create the waiting worker since there is no way to become a 717 // Manually create the waiting worker since there is no way to become a
718 // waiting worker until Update is implemented. 718 // waiting worker until Update is implemented.
719 scoped_refptr<ServiceWorkerVersion> version = new ServiceWorkerVersion( 719 scoped_refptr<ServiceWorkerVersion> version = new ServiceWorkerVersion(
720 registration, 1L, helper_->context()->AsWeakPtr()); 720 registration, 1L, helper_->context()->AsWeakPtr());
721 ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED; 721 ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED;
722 version->StartWorker(CreateReceiverOnCurrentThread(&status)); 722 version->StartWorker(CreateReceiverOnCurrentThread(&status));
723 base::RunLoop().RunUntilIdle(); 723 base::RunLoop().RunUntilIdle();
724 ASSERT_EQ(SERVICE_WORKER_OK, status); 724 ASSERT_EQ(SERVICE_WORKER_OK, status);
725 725
726 version->SetStatus(ServiceWorkerVersion::INSTALLED); 726 version->SetStatus(ServiceWorkerVersion::INSTALLED);
727 registration->set_waiting_version(version); 727 registration->SetWaitingVersion(version);
728 EXPECT_EQ(ServiceWorkerVersion::RUNNING, 728 EXPECT_EQ(ServiceWorkerVersion::RUNNING,
729 version->running_status()); 729 version->running_status());
730 EXPECT_EQ(ServiceWorkerVersion::INSTALLED, version->status()); 730 EXPECT_EQ(ServiceWorkerVersion::INSTALLED, version->status());
731 731
732 called = false; 732 called = false;
733 job_coordinator()->Unregister(GURL("http://www.example.com/*"), 733 job_coordinator()->Unregister(GURL("http://www.example.com/*"),
734 SaveUnregistration(SERVICE_WORKER_OK, &called)); 734 SaveUnregistration(SERVICE_WORKER_OK, &called));
735 base::RunLoop().RunUntilIdle(); 735 base::RunLoop().RunUntilIdle();
736 ASSERT_TRUE(called); 736 ASSERT_TRUE(called);
737 737
738 EXPECT_EQ(ServiceWorkerVersion::RUNNING, 738 EXPECT_EQ(ServiceWorkerVersion::RUNNING,
739 version->running_status()); 739 version->running_status());
740 EXPECT_EQ(ServiceWorkerVersion::REDUNDANT, version->status()); 740 EXPECT_EQ(ServiceWorkerVersion::REDUNDANT, version->status());
741 } 741 }
742 742
743 } // namespace content 743 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/service_worker/service_worker_info.cc ('k') | content/browser/service_worker/service_worker_provider_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698