Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / content / browser / service_worker / service_worker_url_request_job_unittest.cc
index 3829860..931cace 100644 (file)
@@ -89,36 +89,32 @@ class ServiceWorkerURLRequestJobTest : public testing::Test {
   virtual ~ServiceWorkerURLRequestJobTest() {}
 
   virtual void SetUp() OVERRIDE {
-    context_.reset(new ServiceWorkerContextCore(base::FilePath(), NULL));
-    helper_.reset(new EmbeddedWorkerTestHelper(context_.get(), kProcessID));
+    helper_.reset(new EmbeddedWorkerTestHelper(kProcessID));
 
     registration_ = new ServiceWorkerRegistration(
         GURL("http://example.com/*"),
         GURL("http://example.com/service_worker.js"),
-        1L);
+        1L,
+        helper_->context()->AsWeakPtr());
     version_ = new ServiceWorkerVersion(
-        registration_,
-        embedded_worker_registry(),
-        1L);
+        registration_, 1L, helper_->context()->AsWeakPtr());
 
     scoped_ptr<ServiceWorkerProviderHost> provider_host(
-        new ServiceWorkerProviderHost(kProcessID, kProviderID));
-    provider_host->AssociateVersion(version_.get());
+        new ServiceWorkerProviderHost(
+            kProcessID, kProviderID, helper_->context()->AsWeakPtr(), NULL));
+    provider_host->SetActiveVersion(version_.get());
 
     url_request_job_factory_.SetProtocolHandler(
         "http", new MockProtocolHandler(provider_host->AsWeakPtr()));
     url_request_context_.set_job_factory(&url_request_job_factory_);
 
-    context_->AddProviderHost(provider_host.Pass());
+    helper_->context()->AddProviderHost(provider_host.Pass());
   }
 
   virtual void TearDown() OVERRIDE {
-    version_->Shutdown();
-    version_ = 0;
-    registration_->Shutdown();
-    registration_ = 0;
+    version_ = NULL;
+    registration_ = NULL;
     helper_.reset();
-    context_.reset();
   }
 
   void TestRequest() {
@@ -137,13 +133,8 @@ class ServiceWorkerURLRequestJobTest : public testing::Test {
     EXPECT_EQ(200, request_->response_headers()->response_code());
   }
 
-  EmbeddedWorkerRegistry* embedded_worker_registry() {
-    return context_->embedded_worker_registry();
-  }
-
   TestBrowserThreadBundle thread_bundle_;
 
-  scoped_ptr<ServiceWorkerContextCore> context_;
   scoped_ptr<EmbeddedWorkerTestHelper> helper_;
   scoped_refptr<ServiceWorkerRegistration> registration_;
   scoped_refptr<ServiceWorkerVersion> version_;
@@ -165,7 +156,6 @@ TEST_F(ServiceWorkerURLRequestJobTest, WaitForActivation) {
   ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED;
   version_->SetStatus(ServiceWorkerVersion::INSTALLED);
   version_->DispatchActivateEvent(CreateReceiverOnCurrentThread(&status));
-  EXPECT_EQ(ServiceWorkerVersion::ACTIVATING, version_->status());
 
   TestRequest();