Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / content / browser / service_worker / service_worker_version_unittest.cc
index 3622784..3fcc13f 100644 (file)
@@ -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<MessageReceiver> helper_;
   scoped_refptr<ServiceWorkerRegistration> registration_;
   scoped_refptr<ServiceWorkerVersion> 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);