Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / content / browser / quota / quota_backend_impl_unittest.cc
index 201fab0..335a066 100644 (file)
@@ -2,23 +2,23 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/browser/fileapi/quota/quota_backend_impl.h"
+#include "storage/browser/fileapi/quota/quota_backend_impl.h"
 
 #include <string>
 
 #include "base/files/scoped_temp_dir.h"
 #include "base/message_loop/message_loop.h"
+#include "storage/browser/fileapi/file_system_usage_cache.h"
+#include "storage/browser/fileapi/obfuscated_file_util.h"
+#include "storage/browser/quota/quota_manager_proxy.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/leveldatabase/src/helpers/memenv/memenv.h"
 #include "third_party/leveldatabase/src/include/leveldb/env.h"
-#include "webkit/browser/fileapi/file_system_usage_cache.h"
-#include "webkit/browser/fileapi/obfuscated_file_util.h"
-#include "webkit/browser/quota/quota_manager_proxy.h"
 
-using fileapi::FileSystemUsageCache;
-using fileapi::ObfuscatedFileUtil;
-using fileapi::QuotaBackendImpl;
-using fileapi::SandboxFileSystemBackendDelegate;
+using storage::FileSystemUsageCache;
+using storage::ObfuscatedFileUtil;
+using storage::QuotaBackendImpl;
+using storage::SandboxFileSystemBackendDelegate;
 
 namespace content {
 
@@ -38,7 +38,7 @@ bool DidReserveQuota(bool accepted,
   return accepted;
 }
 
-class MockQuotaManagerProxy : public quota::QuotaManagerProxy {
+class MockQuotaManagerProxy : public storage::QuotaManagerProxy {
  public:
   MockQuotaManagerProxy()
       : QuotaManagerProxy(NULL, NULL),
@@ -48,16 +48,15 @@ class MockQuotaManagerProxy : public quota::QuotaManagerProxy {
   // We don't mock them.
   virtual void NotifyOriginInUse(const GURL& origin) OVERRIDE {}
   virtual void NotifyOriginNoLongerInUse(const GURL& origin) OVERRIDE {}
-  virtual void SetUsageCacheEnabled(quota::QuotaClient::ID client_id,
+  virtual void SetUsageCacheEnabled(storage::QuotaClient::ID client_id,
                                     const GURL& origin,
-                                    quota::StorageType type,
+                                    storage::StorageType type,
                                     bool enabled) OVERRIDE {}
 
-  virtual void NotifyStorageModified(
-      quota::QuotaClient::ID client_id,
-      const GURL& origin,
-      quota::StorageType type,
-      int64 delta) OVERRIDE {
+  virtual void NotifyStorageModified(storage::QuotaClient::ID client_id,
+                                     const GURL& origin,
+                                     storage::StorageType type,
+                                     int64 delta) OVERRIDE {
     ++storage_modified_count_;
     usage_ += delta;
     ASSERT_LE(usage_, quota_);
@@ -66,9 +65,9 @@ class MockQuotaManagerProxy : public quota::QuotaManagerProxy {
   virtual void GetUsageAndQuota(
       base::SequencedTaskRunner* original_task_runner,
       const GURL& origin,
-      quota::StorageType type,
+      storage::StorageType type,
       const GetUsageAndQuotaCallback& callback) OVERRIDE {
-    callback.Run(quota::kQuotaStatusOk, usage_, quota_);
+    callback.Run(storage::kQuotaStatusOk, usage_, quota_);
   }
 
   int storage_modified_count() { return storage_modified_count_; }
@@ -115,7 +114,7 @@ class QuotaBackendImplTest : public testing::Test {
 
  protected:
   void InitializeForOriginAndType(const GURL& origin,
-                                  fileapi::FileSystemType type) {
+                                  storage::FileSystemType type) {
     ASSERT_TRUE(file_util_->InitOriginDatabase(origin, true /* create */));
     ASSERT_TRUE(file_util_->origin_database_ != NULL);
 
@@ -135,7 +134,7 @@ class QuotaBackendImplTest : public testing::Test {
   }
 
   base::FilePath GetUsageCachePath(const GURL& origin,
-                                   fileapi::FileSystemType type) {
+                                   storage::FileSystemType type) {
     base::FilePath path;
     base::File::Error error =
         backend_->GetUsageCachePath(origin, type, &path);
@@ -157,7 +156,7 @@ class QuotaBackendImplTest : public testing::Test {
 };
 
 TEST_F(QuotaBackendImplTest, ReserveQuota_Basic) {
-  fileapi::FileSystemType type = fileapi::kFileSystemTypeTemporary;
+  storage::FileSystemType type = storage::kFileSystemTypeTemporary;
   InitializeForOriginAndType(GURL(kOrigin), type);
   quota_manager_proxy_->set_quota(10000);
 
@@ -183,7 +182,7 @@ TEST_F(QuotaBackendImplTest, ReserveQuota_Basic) {
 }
 
 TEST_F(QuotaBackendImplTest, ReserveQuota_NoSpace) {
-  fileapi::FileSystemType type = fileapi::kFileSystemTypeTemporary;
+  storage::FileSystemType type = storage::kFileSystemTypeTemporary;
   InitializeForOriginAndType(GURL(kOrigin), type);
   quota_manager_proxy_->set_quota(100);
 
@@ -201,7 +200,7 @@ TEST_F(QuotaBackendImplTest, ReserveQuota_NoSpace) {
 }
 
 TEST_F(QuotaBackendImplTest, ReserveQuota_Revert) {
-  fileapi::FileSystemType type = fileapi::kFileSystemTypeTemporary;
+  storage::FileSystemType type = storage::kFileSystemTypeTemporary;
   InitializeForOriginAndType(GURL(kOrigin), type);
   quota_manager_proxy_->set_quota(10000);
 
@@ -219,7 +218,7 @@ TEST_F(QuotaBackendImplTest, ReserveQuota_Revert) {
 }
 
 TEST_F(QuotaBackendImplTest, ReleaseReservedQuota) {
-  fileapi::FileSystemType type = fileapi::kFileSystemTypeTemporary;
+  storage::FileSystemType type = storage::kFileSystemTypeTemporary;
   InitializeForOriginAndType(GURL(kOrigin), type);
   const int64 kInitialUsage = 2000;
   quota_manager_proxy_->set_usage(kInitialUsage);
@@ -233,7 +232,7 @@ TEST_F(QuotaBackendImplTest, ReleaseReservedQuota) {
 }
 
 TEST_F(QuotaBackendImplTest, CommitQuotaUsage) {
-  fileapi::FileSystemType type = fileapi::kFileSystemTypeTemporary;
+  storage::FileSystemType type = storage::kFileSystemTypeTemporary;
   InitializeForOriginAndType(GURL(kOrigin), type);
   quota_manager_proxy_->set_quota(10000);
   base::FilePath path = GetUsageCachePath(GURL(kOrigin), type);
@@ -256,7 +255,7 @@ TEST_F(QuotaBackendImplTest, CommitQuotaUsage) {
 }
 
 TEST_F(QuotaBackendImplTest, DirtyCount) {
-  fileapi::FileSystemType type = fileapi::kFileSystemTypeTemporary;
+  storage::FileSystemType type = storage::kFileSystemTypeTemporary;
   InitializeForOriginAndType(GURL(kOrigin), type);
   base::FilePath path = GetUsageCachePath(GURL(kOrigin), type);