Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / content / browser / service_worker / service_worker_dispatcher_host_unittest.cc
index 2adb94b..9c74777 100644 (file)
@@ -29,23 +29,19 @@ class ServiceWorkerDispatcherHostTest : public testing::Test {
       : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) {}
 
   virtual void SetUp() {
-    context_wrapper_ = new ServiceWorkerContextWrapper;
-    context_wrapper_->Init(base::FilePath(), NULL);
-    helper_.reset(new EmbeddedWorkerTestHelper(context(), kRenderProcessId));
+    helper_.reset(new EmbeddedWorkerTestHelper(kRenderProcessId));
   }
 
   virtual void TearDown() {
     helper_.reset();
-    if (context_wrapper_) {
-      context_wrapper_->Shutdown();
-      context_wrapper_ = NULL;
-    }
   }
 
-  ServiceWorkerContextCore* context() { return context_wrapper_->context(); }
+  ServiceWorkerContextCore* context() { return helper_->context(); }
+  ServiceWorkerContextWrapper* context_wrapper() {
+    return helper_->context_wrapper();
+  }
 
   TestBrowserThreadBundle browser_thread_bundle_;
-  scoped_refptr<ServiceWorkerContextWrapper> context_wrapper_;
   scoped_ptr<EmbeddedWorkerTestHelper> helper_;
 };
 
@@ -85,11 +81,11 @@ TEST_F(ServiceWorkerDispatcherHostTest, DisabledCausesError) {
 
   scoped_refptr<TestingServiceWorkerDispatcherHost> dispatcher_host =
       new TestingServiceWorkerDispatcherHost(
-          kRenderProcessId, context_wrapper_.get(), helper_.get());
+          kRenderProcessId, context_wrapper(), helper_.get());
 
   bool handled;
   dispatcher_host->OnMessageReceived(
-      ServiceWorkerHostMsg_RegisterServiceWorker(-1, -1, GURL(), GURL()),
+      ServiceWorkerHostMsg_RegisterServiceWorker(-1, -1, -1, GURL(), GURL()),
       &handled);
   EXPECT_TRUE(handled);
 
@@ -112,11 +108,11 @@ TEST_F(ServiceWorkerDispatcherHostTest, DISABLED_Enabled) {
 
   scoped_refptr<TestingServiceWorkerDispatcherHost> dispatcher_host =
       new TestingServiceWorkerDispatcherHost(
-          kRenderProcessId, context_wrapper_.get(), helper_.get());
+          kRenderProcessId, context_wrapper(), helper_.get());
 
   bool handled;
   dispatcher_host->OnMessageReceived(
-      ServiceWorkerHostMsg_RegisterServiceWorker(-1, -1, GURL(), GURL()),
+      ServiceWorkerHostMsg_RegisterServiceWorker(-1, -1, -1, GURL(), GURL()),
       &handled);
   EXPECT_TRUE(handled);
   base::RunLoop().RunUntilIdle();
@@ -137,14 +133,13 @@ TEST_F(ServiceWorkerDispatcherHostTest, EarlyContextDeletion) {
 
   scoped_refptr<TestingServiceWorkerDispatcherHost> dispatcher_host =
       new TestingServiceWorkerDispatcherHost(
-          kRenderProcessId, context_wrapper_.get(), helper_.get());
+          kRenderProcessId, context_wrapper(), helper_.get());
 
-  context_wrapper_->Shutdown();
-  context_wrapper_ = NULL;
+  helper_->ShutdownContext();
 
   bool handled;
   dispatcher_host->OnMessageReceived(
-      ServiceWorkerHostMsg_RegisterServiceWorker(-1, -1, GURL(), GURL()),
+      ServiceWorkerHostMsg_RegisterServiceWorker(-1, -1, -1, GURL(), GURL()),
       &handled);
   EXPECT_TRUE(handled);
 
@@ -157,7 +152,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, EarlyContextDeletion) {
 TEST_F(ServiceWorkerDispatcherHostTest, ProviderCreatedAndDestroyed) {
   scoped_refptr<TestingServiceWorkerDispatcherHost> dispatcher_host =
       new TestingServiceWorkerDispatcherHost(
-          kRenderProcessId, context_wrapper_.get(), helper_.get());
+          kRenderProcessId, context_wrapper(), helper_.get());
 
   const int kProviderId = 1001;  // Test with a value != kRenderProcessId.