Chromium Code Reviews| 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 ff4043d35335807fb33aeca0bb87bb639ae1760c..21c5f36afdc662d04b37c5630c47dda57bdca835 100644 |
| --- a/content/browser/service_worker/service_worker_version_unittest.cc |
| +++ b/content/browser/service_worker/service_worker_version_unittest.cc |
| @@ -119,18 +119,18 @@ class ServiceWorkerVersionTest : public testing::Test { |
| virtual void SetUp() OVERRIDE { |
| helper_.reset(new MessageReceiver()); |
| + scope_ = GURL("http://www.example.com/*"); |
|
dominicc (has gone to gerrit)
2014/08/06 06:48:18
Here too.
xiang
2014/08/11 04:50:55
Done.
|
| registration_ = new ServiceWorkerRegistration( |
| - GURL("http://www.example.com/*"), |
| + scope_, |
| GURL("http://www.example.com/service_worker.js"), |
| 1L, |
| helper_->context()->AsWeakPtr()); |
| version_ = new ServiceWorkerVersion( |
| registration_, 1L, helper_->context()->AsWeakPtr()); |
| - // Simulate adding one process to the worker. |
| - int embedded_worker_id = version_->embedded_worker()->embedded_worker_id(); |
| - helper_->SimulateAddProcessToWorker(embedded_worker_id, kRenderProcessId); |
| - ASSERT_TRUE(version_->HasProcessToRun()); |
| + // Simulate adding one process to the scope. |
| + helper_->SimulateAddProcessToScope(scope_, kRenderProcessId); |
| + ASSERT_TRUE(HasProcessToRun()); |
| } |
| virtual void TearDown() OVERRIDE { |
| @@ -139,10 +139,15 @@ class ServiceWorkerVersionTest : public testing::Test { |
| helper_.reset(); |
| } |
| + bool HasProcessToRun() const { |
| + return helper_->context()->process_manager()->ScopeHasProcessToRun(scope_); |
| + } |
| + |
| TestBrowserThreadBundle thread_bundle_; |
| scoped_ptr<MessageReceiver> helper_; |
| scoped_refptr<ServiceWorkerRegistration> registration_; |
| scoped_refptr<ServiceWorkerVersion> version_; |
| + GURL scope_; |
| private: |
| DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersionTest); |
| @@ -327,9 +332,9 @@ TEST_F(ServiceWorkerVersionTest, RepeatedlyObserveStatusChanges) { |
| TEST_F(ServiceWorkerVersionTest, AddAndRemoveProcesses) { |
| // Preparation (to reset the process count to 0). |
| - ASSERT_TRUE(version_->HasProcessToRun()); |
| + ASSERT_TRUE(HasProcessToRun()); |
| version_->RemoveProcessFromWorker(kRenderProcessId); |
| - ASSERT_FALSE(version_->HasProcessToRun()); |
| + ASSERT_FALSE(HasProcessToRun()); |
| // Add another process to the worker twice, and then remove process once. |
| const int another_process_id = kRenderProcessId + 1; |
| @@ -339,12 +344,12 @@ TEST_F(ServiceWorkerVersionTest, AddAndRemoveProcesses) { |
| // We're ref-counting the process internally, so adding the same process |
| // multiple times should be handled correctly. |
| - ASSERT_TRUE(version_->HasProcessToRun()); |
| + ASSERT_TRUE(HasProcessToRun()); |
| // Removing the process again (so that # of AddProcess == # of RemoveProcess |
| // for the process) should remove all process references. |
| version_->RemoveProcessFromWorker(another_process_id); |
| - ASSERT_FALSE(version_->HasProcessToRun()); |
| + ASSERT_FALSE(HasProcessToRun()); |
| } |
| TEST_F(ServiceWorkerVersionTest, ScheduleStopWorker) { |