Index: webkit/browser/fileapi/sandbox_file_system_backend_unittest.cc |
diff --git a/webkit/browser/fileapi/sandbox_file_system_backend_unittest.cc b/webkit/browser/fileapi/sandbox_file_system_backend_unittest.cc |
index 5b0f8bc9a816fbdead6918904b8d01ea864cdb1b..ac56dfb644768d13c7178cc2c2dee1176989d27d 100644 |
--- a/webkit/browser/fileapi/sandbox_file_system_backend_unittest.cc |
+++ b/webkit/browser/fileapi/sandbox_file_system_backend_unittest.cc |
@@ -89,20 +89,22 @@ class SandboxFileSystemBackendTest : public testing::Test { |
NULL /* quota_manager_proxy */, |
base::MessageLoopProxy::current().get(), |
data_dir_.path(), |
- NULL /* special_storage_policy */)); |
+ NULL /* special_storage_policy */, |
+ CreateAllowFileAccessOptions())); |
} |
void SetUpNewBackend(const FileSystemOptions& options) { |
- backend_.reset(new SandboxFileSystemBackend(context_.get(), options)); |
+ context_->set_file_system_options(options); |
+ backend_.reset(new SandboxFileSystemBackend(context_.get())); |
} |
- SandboxFileSystemBackend::OriginEnumerator* CreateOriginEnumerator() const { |
+ SandboxContext::OriginEnumerator* CreateOriginEnumerator() const { |
return backend_->CreateOriginEnumerator(); |
} |
void CreateOriginTypeDirectory(const GURL& origin, |
fileapi::FileSystemType type) { |
- base::FilePath target = backend_-> |
+ base::FilePath target = context_-> |
GetBaseDirectoryForOriginAndType(origin, type, true); |
ASSERT_TRUE(!target.empty()); |
ASSERT_TRUE(base::DirectoryExists(target)); |
@@ -120,7 +122,7 @@ class SandboxFileSystemBackendTest : public testing::Test { |
if (error != base::PLATFORM_FILE_OK) |
return false; |
base::FilePath returned_root_path = |
- backend_->GetBaseDirectoryForOriginAndType( |
+ context_->GetBaseDirectoryForOriginAndType( |
origin_url, type, false /* create */); |
if (root_path) |
*root_path = returned_root_path; |
@@ -139,7 +141,7 @@ class SandboxFileSystemBackendTest : public testing::Test { |
TEST_F(SandboxFileSystemBackendTest, Empty) { |
SetUpNewBackend(CreateAllowFileAccessOptions()); |
- scoped_ptr<SandboxFileSystemBackend::OriginEnumerator> enumerator( |
+ scoped_ptr<SandboxContext::OriginEnumerator> enumerator( |
CreateOriginEnumerator()); |
ASSERT_TRUE(enumerator->Next().is_empty()); |
} |
@@ -172,7 +174,7 @@ TEST_F(SandboxFileSystemBackendTest, EnumerateOrigins) { |
persistent_set.insert(GURL(persistent_origins[i])); |
} |
- scoped_ptr<SandboxFileSystemBackend::OriginEnumerator> enumerator( |
+ scoped_ptr<SandboxContext::OriginEnumerator> enumerator( |
CreateOriginEnumerator()); |
size_t temporary_actual_size = 0; |
size_t persistent_actual_size = 0; |
@@ -193,49 +195,6 @@ TEST_F(SandboxFileSystemBackendTest, EnumerateOrigins) { |
EXPECT_EQ(persistent_size, persistent_actual_size); |
} |
-TEST_F(SandboxFileSystemBackendTest, IsAccessValid) { |
- SetUpNewBackend(CreateAllowFileAccessOptions()); |
- |
- // Normal case. |
- EXPECT_TRUE(backend_->IsAccessValid(CreateFileSystemURL("a"))); |
- |
- // Access to a path with parent references ('..') should be disallowed. |
- EXPECT_FALSE(backend_->IsAccessValid(CreateFileSystemURL("a/../b"))); |
- |
- // Access from non-allowed scheme should be disallowed. |
- EXPECT_FALSE(backend_->IsAccessValid( |
- FileSystemURL::CreateForTest( |
- GURL("unknown://bar"), kFileSystemTypeTemporary, |
- base::FilePath::FromUTF8Unsafe("foo")))); |
- |
- // Access for non-sandbox type should be disallowed. |
- EXPECT_FALSE(backend_->IsAccessValid( |
- FileSystemURL::CreateForTest( |
- GURL("http://foo/"), kFileSystemTypeTest, |
- base::FilePath::FromUTF8Unsafe("foo")))); |
- |
- // Access with restricted name should be disallowed. |
- EXPECT_FALSE(backend_->IsAccessValid(CreateFileSystemURL("."))); |
- EXPECT_FALSE(backend_->IsAccessValid(CreateFileSystemURL(".."))); |
- |
- // This is also diallowed due to Windows XP parent path handling. |
- EXPECT_FALSE(backend_->IsAccessValid(CreateFileSystemURL("..."))); |
- |
- // These are identified as unsafe cases due to weird path handling |
- // on Windows. |
- EXPECT_FALSE(backend_->IsAccessValid(CreateFileSystemURL(" .."))); |
- EXPECT_FALSE(backend_->IsAccessValid(CreateFileSystemURL(".. "))); |
- |
- // Similar but safe cases. |
- EXPECT_TRUE(backend_->IsAccessValid(CreateFileSystemURL(" ."))); |
- EXPECT_TRUE(backend_->IsAccessValid(CreateFileSystemURL(". "))); |
- EXPECT_TRUE(backend_->IsAccessValid(CreateFileSystemURL("b."))); |
- EXPECT_TRUE(backend_->IsAccessValid(CreateFileSystemURL(".b"))); |
- |
- // A path that looks like a drive letter. |
- EXPECT_TRUE(backend_->IsAccessValid(CreateFileSystemURL("c:"))); |
-} |
- |
TEST_F(SandboxFileSystemBackendTest, GetRootPathCreateAndExamine) { |
std::vector<base::FilePath> returned_root_path( |
ARRAYSIZE_UNSAFE(kRootPathTestCases)); |