#include "content/public/test/async_file_test_helper.h"
#include "content/public/test/sandbox_file_system_test_helper.h"
#include "content/public/test/test_browser_thread_bundle.h"
+#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/fileapi/file_system_operation_context.h"
+#include "storage/browser/fileapi/isolated_context.h"
+#include "storage/browser/quota/quota_manager.h"
+#include "storage/common/fileapi/file_system_types.h"
+#include "storage/common/quota/quota_types.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_context.h"
-#include "webkit/browser/fileapi/file_system_operation_context.h"
-#include "webkit/browser/fileapi/isolated_context.h"
-#include "webkit/browser/quota/quota_manager.h"
-#include "webkit/common/fileapi/file_system_types.h"
-#include "webkit/common/quota/quota_types.h"
using content::SandboxFileSystemTestHelper;
-using fileapi::FileSystemContext;
-using fileapi::FileSystemOperationContext;
-using fileapi::FileSystemURL;
-using fileapi::FileSystemURLSet;
-using quota::QuotaManager;
-using quota::QuotaStatusCode;
+using storage::FileSystemContext;
+using storage::FileSystemOperationContext;
+using storage::FileSystemURL;
+using storage::FileSystemURLSet;
+using storage::QuotaManager;
+using storage::QuotaStatusCode;
namespace sync_file_system {
const int64 kQuota = 12345 * 1024;
QuotaManager::kSyncableStorageDefaultHostQuota = kQuota;
int64 usage, quota;
- EXPECT_EQ(quota::kQuotaStatusOk,
+ EXPECT_EQ(storage::kQuotaStatusOk,
file_system_.GetUsageAndQuota(&usage, "a));
// Returned quota must be what we overrode. Usage must be greater than 0
file_system_.TruncateFile(URL("dir/foo"), kFileSizeToExtend));
int64 new_usage;
- EXPECT_EQ(quota::kQuotaStatusOk,
+ EXPECT_EQ(storage::kQuotaStatusOk,
file_system_.GetUsageAndQuota(&new_usage, "a));
EXPECT_EQ(kFileSizeToExtend, new_usage - usage);
file_system_.TruncateFile(URL("dir/foo"), kFileSizeToExtend + 1));
usage = new_usage;
- EXPECT_EQ(quota::kQuotaStatusOk,
+ EXPECT_EQ(storage::kQuotaStatusOk,
file_system_.GetUsageAndQuota(&new_usage, "a));
EXPECT_EQ(usage, new_usage);
file_system_.DeleteFileSystem());
// Now the usage must be zero.
- EXPECT_EQ(quota::kQuotaStatusOk,
+ EXPECT_EQ(storage::kQuotaStatusOk,
file_system_.GetUsageAndQuota(&usage, "a));
EXPECT_EQ(0, usage);
sync_file_system::SYNC_FILE_TYPE_FILE));
}
-// Make sure directory operation is disabled (when it's configured so).
-TEST_F(SyncableFileSystemTest, DisableDirectoryOperations) {
- ScopedDisableSyncFSV2 scoped_disable_v2;
-
- EXPECT_EQ(base::File::FILE_OK,
- file_system_.OpenFileSystem());
-
- // Try some directory operations (which should fail).
- EXPECT_EQ(base::File::FILE_ERROR_INVALID_OPERATION,
- file_system_.CreateDirectory(URL("dir")));
-
- // Set up another (non-syncable) local file system.
- SandboxFileSystemTestHelper other_file_system_(
- GURL("http://foo.com/"), fileapi::kFileSystemTypeTemporary);
- other_file_system_.SetUp(file_system_.file_system_context());
-
- // Create directory '/a' and file '/a/b' in the other file system.
- const FileSystemURL kSrcDir = other_file_system_.CreateURLFromUTF8("/a");
- const FileSystemURL kSrcChild = other_file_system_.CreateURLFromUTF8("/a/b");
-
- EXPECT_EQ(base::File::FILE_OK,
- content::AsyncFileTestHelper::CreateDirectory(
- other_file_system_.file_system_context(), kSrcDir));
- EXPECT_EQ(base::File::FILE_OK,
- content::AsyncFileTestHelper::CreateFile(
- other_file_system_.file_system_context(), kSrcChild));
-
- // Now try copying the directory into the syncable file system, which should
- // fail if directory operation is disabled. (http://crbug.com/161442)
- EXPECT_NE(base::File::FILE_OK,
- file_system_.Copy(kSrcDir, URL("dest")));
-
- other_file_system_.TearDown();
-}
-
} // namespace sync_file_system