X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fcontent%2Fbrowser%2Fservice_worker%2Fservice_worker_version_unittest.cc;h=3fcc13f614763c5d9a90ec09bb25911715712723;hb=3545e9f2671f595d2a2f3ee75ca0393b01e35ef6;hp=3622784baa3fefd35675842bc1e4f54feadf6e51;hpb=7d210d4c7e9ba36e635eabc5b5780495f8a63292;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/content/browser/service_worker/service_worker_version_unittest.cc b/src/content/browser/service_worker/service_worker_version_unittest.cc index 3622784..3fcc13f 100644 --- a/src/content/browser/service_worker/service_worker_version_unittest.cc +++ b/src/content/browser/service_worker/service_worker_version_unittest.cc @@ -119,18 +119,21 @@ class ServiceWorkerVersionTest : public testing::Test { virtual void SetUp() OVERRIDE { helper_.reset(new MessageReceiver()); + pattern_ = GURL("http://www.example.com/"); registration_ = new ServiceWorkerRegistration( - GURL("http://www.example.com/"), - GURL("http://www.example.com/service_worker.js"), + pattern_, 1L, helper_->context()->AsWeakPtr()); version_ = new ServiceWorkerVersion( - registration_, 1L, helper_->context()->AsWeakPtr()); + registration_.get(), + GURL("http://www.example.com/service_worker.js"), + 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 pattern. + helper_->SimulateAddProcessToPattern(pattern_, kRenderProcessId); + ASSERT_TRUE(helper_->context()->process_manager() + ->PatternHasProcessToRun(pattern_)); } virtual void TearDown() OVERRIDE { @@ -143,6 +146,7 @@ class ServiceWorkerVersionTest : public testing::Test { scoped_ptr helper_; scoped_refptr registration_; scoped_refptr version_; + GURL pattern_; private: DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersionTest); @@ -325,28 +329,6 @@ TEST_F(ServiceWorkerVersionTest, RepeatedlyObserveStatusChanges) { ASSERT_EQ(ServiceWorkerVersion::REDUNDANT, statuses[4]); } -TEST_F(ServiceWorkerVersionTest, AddAndRemoveProcesses) { - // Preparation (to reset the process count to 0). - ASSERT_TRUE(version_->HasProcessToRun()); - version_->RemoveProcessFromWorker(kRenderProcessId); - ASSERT_FALSE(version_->HasProcessToRun()); - - // Add another process to the worker twice, and then remove process once. - const int another_process_id = kRenderProcessId + 1; - version_->AddProcessToWorker(another_process_id); - version_->AddProcessToWorker(another_process_id); - version_->RemoveProcessFromWorker(another_process_id); - - // We're ref-counting the process internally, so adding the same process - // multiple times should be handled correctly. - ASSERT_TRUE(version_->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()); -} - TEST_F(ServiceWorkerVersionTest, ScheduleStopWorker) { // Verify the timer is not running when version initializes its status. version_->SetStatus(ServiceWorkerVersion::ACTIVATED);