Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / content / browser / indexed_db / indexed_db_unittest.cc
index d60de84..c12dac1 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "base/file_util.h"
+#include "base/files/file_util.h"
 #include "base/files/scoped_temp_dir.h"
 #include "base/test/test_simple_task_runner.h"
 #include "base/threading/thread.h"
 #include "content/public/common/url_constants.h"
 #include "content/public/test/mock_special_storage_policy.h"
 #include "content/public/test/test_browser_context.h"
+#include "storage/browser/quota/quota_manager.h"
+#include "storage/browser/quota/special_storage_policy.h"
+#include "storage/common/database/database_identifier.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "webkit/browser/quota/quota_manager.h"
-#include "webkit/browser/quota/special_storage_policy.h"
-#include "webkit/common/database/database_identifier.h"
 
 namespace content {
 
@@ -62,13 +62,16 @@ TEST_F(IndexedDBTest, ClearSessionOnlyDatabases) {
   // Create the scope which will ensure we run the destructor of the context
   // which should trigger the clean up.
   {
-    scoped_refptr<IndexedDBContextImpl> idb_context = new IndexedDBContextImpl(
-        temp_dir.path(), special_storage_policy_, NULL, task_runner_);
+    scoped_refptr<IndexedDBContextImpl> idb_context =
+        new IndexedDBContextImpl(temp_dir.path(),
+                                 special_storage_policy_.get(),
+                                 NULL,
+                                 task_runner_.get());
 
     normal_path = idb_context->GetFilePathForTesting(
-        webkit_database::GetIdentifierFromOrigin(kNormalOrigin));
+        storage::GetIdentifierFromOrigin(kNormalOrigin));
     session_only_path = idb_context->GetFilePathForTesting(
-        webkit_database::GetIdentifierFromOrigin(kSessionOnlyOrigin));
+        storage::GetIdentifierFromOrigin(kSessionOnlyOrigin));
     ASSERT_TRUE(base::CreateDirectory(normal_path));
     ASSERT_TRUE(base::CreateDirectory(session_only_path));
     FlushIndexedDBTaskRunner();
@@ -93,16 +96,19 @@ TEST_F(IndexedDBTest, SetForceKeepSessionState) {
   {
     // Create some indexedDB paths.
     // With the levelDB backend, these are directories.
-    scoped_refptr<IndexedDBContextImpl> idb_context = new IndexedDBContextImpl(
-        temp_dir.path(), special_storage_policy_, NULL, task_runner_);
+    scoped_refptr<IndexedDBContextImpl> idb_context =
+        new IndexedDBContextImpl(temp_dir.path(),
+                                 special_storage_policy_.get(),
+                                 NULL,
+                                 task_runner_.get());
 
     // Save session state. This should bypass the destruction-time deletion.
     idb_context->SetForceKeepSessionState();
 
     normal_path = idb_context->GetFilePathForTesting(
-        webkit_database::GetIdentifierFromOrigin(kNormalOrigin));
+        storage::GetIdentifierFromOrigin(kNormalOrigin));
     session_only_path = idb_context->GetFilePathForTesting(
-        webkit_database::GetIdentifierFromOrigin(kSessionOnlyOrigin));
+        storage::GetIdentifierFromOrigin(kSessionOnlyOrigin));
     ASSERT_TRUE(base::CreateDirectory(normal_path));
     ASSERT_TRUE(base::CreateDirectory(session_only_path));
     message_loop_.RunUntilIdle();
@@ -161,8 +167,11 @@ TEST_F(IndexedDBTest, ForceCloseOpenDatabasesOnDelete) {
 
     const GURL kTestOrigin("http://test/");
 
-    scoped_refptr<IndexedDBContextImpl> idb_context = new IndexedDBContextImpl(
-        temp_dir.path(), special_storage_policy_, NULL, task_runner_);
+    scoped_refptr<IndexedDBContextImpl> idb_context =
+        new IndexedDBContextImpl(temp_dir.path(),
+                                 special_storage_policy_.get(),
+                                 NULL,
+                                 task_runner_.get());
 
     scoped_refptr<ForceCloseDBCallbacks> open_callbacks =
         new ForceCloseDBCallbacks(idb_context, kTestOrigin);
@@ -173,7 +182,7 @@ TEST_F(IndexedDBTest, ForceCloseOpenDatabasesOnDelete) {
     IndexedDBFactory* factory = idb_context->GetIDBFactory();
 
     test_path = idb_context->GetFilePathForTesting(
-        webkit_database::GetIdentifierFromOrigin(kTestOrigin));
+        storage::GetIdentifierFromOrigin(kTestOrigin));
 
     IndexedDBPendingConnection open_connection(open_callbacks,
                                                open_db_callbacks,
@@ -220,10 +229,10 @@ TEST_F(IndexedDBTest, DeleteFailsIfDirectoryLocked) {
   const GURL kTestOrigin("http://test/");
 
   scoped_refptr<IndexedDBContextImpl> idb_context = new IndexedDBContextImpl(
-      temp_dir.path(), special_storage_policy_, NULL, task_runner_);
+      temp_dir.path(), special_storage_policy_.get(), NULL, task_runner_.get());
 
   base::FilePath test_path = idb_context->GetFilePathForTesting(
-      webkit_database::GetIdentifierFromOrigin(kTestOrigin));
+      storage::GetIdentifierFromOrigin(kTestOrigin));
   ASSERT_TRUE(base::CreateDirectory(test_path));
 
   scoped_ptr<LevelDBLock> lock =
@@ -246,7 +255,7 @@ TEST_F(IndexedDBTest, ForceCloseOpenDatabasesOnCommitFailure) {
   ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
 
   scoped_refptr<IndexedDBContextImpl> context = new IndexedDBContextImpl(
-      temp_dir.path(), special_storage_policy_, NULL, task_runner_);
+      temp_dir.path(), special_storage_policy_.get(), NULL, task_runner_.get());
 
   scoped_refptr<IndexedDBFactoryImpl> factory =
       static_cast<IndexedDBFactoryImpl*>(context->GetIDBFactory());