Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(974)

Unified Diff: content/browser/fileapi/sandbox_file_system_backend_delegate_unittest.cc

Issue 137923003: Change fileapi namespace to content for files that are moved under content/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: build fix Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/fileapi/sandbox_file_system_backend_delegate_unittest.cc
diff --git a/content/browser/fileapi/sandbox_file_system_backend_delegate_unittest.cc b/content/browser/fileapi/sandbox_file_system_backend_delegate_unittest.cc
index c87043b74cae54be03056008c31ec63413edc246..935f6ce2fe4ee4735ee54702429f926e524bdbdf 100644
--- a/content/browser/fileapi/sandbox_file_system_backend_delegate_unittest.cc
+++ b/content/browser/fileapi/sandbox_file_system_backend_delegate_unittest.cc
@@ -15,14 +15,17 @@
#include "url/gurl.h"
#include "webkit/browser/fileapi/file_system_url.h"
-namespace fileapi {
+using fileapi::FileSystemURL;
+
+namespace content {
namespace {
FileSystemURL CreateFileSystemURL(const char* path) {
const GURL kOrigin("http://foo/");
- return FileSystemURL::CreateForTest(
- kOrigin, kFileSystemTypeTemporary, base::FilePath::FromUTF8Unsafe(path));
+ return fileapi::FileSystemURL::CreateForTest(
+ kOrigin, fileapi::kFileSystemTypeTemporary,
+ base::FilePath::FromUTF8Unsafe(path));
}
} // namespace
@@ -31,7 +34,7 @@ class SandboxFileSystemBackendDelegateTest : public testing::Test {
protected:
virtual void SetUp() {
ASSERT_TRUE(data_dir_.CreateUniqueTempDir());
- delegate_.reset(new SandboxFileSystemBackendDelegate(
+ delegate_.reset(new fileapi::SandboxFileSystemBackendDelegate(
NULL /* quota_manager_proxy */,
base::MessageLoopProxy::current().get(),
data_dir_.path(),
@@ -39,44 +42,48 @@ class SandboxFileSystemBackendDelegateTest : public testing::Test {
CreateAllowFileAccessOptions()));
}
+ bool IsAccessValid(const FileSystemURL& url) const {
+ return delegate_->IsAccessValid(url);
+ }
+
base::ScopedTempDir data_dir_;
base::MessageLoop message_loop_;
- scoped_ptr<SandboxFileSystemBackendDelegate> delegate_;
+ scoped_ptr<fileapi::SandboxFileSystemBackendDelegate> delegate_;
};
TEST_F(SandboxFileSystemBackendDelegateTest, IsAccessValid) {
// Normal case.
- EXPECT_TRUE(delegate_->IsAccessValid(CreateFileSystemURL("a")));
+ EXPECT_TRUE(IsAccessValid(CreateFileSystemURL("a")));
// Access to a path with parent references ('..') should be disallowed.
- EXPECT_FALSE(delegate_->IsAccessValid(CreateFileSystemURL("a/../b")));
+ EXPECT_FALSE(IsAccessValid(CreateFileSystemURL("a/../b")));
// Access from non-allowed scheme should be disallowed.
- EXPECT_FALSE(delegate_->IsAccessValid(
+ EXPECT_FALSE(IsAccessValid(
FileSystemURL::CreateForTest(
- GURL("unknown://bar"), kFileSystemTypeTemporary,
+ GURL("unknown://bar"), fileapi::kFileSystemTypeTemporary,
base::FilePath::FromUTF8Unsafe("foo"))));
// Access with restricted name should be disallowed.
- EXPECT_FALSE(delegate_->IsAccessValid(CreateFileSystemURL(".")));
- EXPECT_FALSE(delegate_->IsAccessValid(CreateFileSystemURL("..")));
+ EXPECT_FALSE(IsAccessValid(CreateFileSystemURL(".")));
+ EXPECT_FALSE(IsAccessValid(CreateFileSystemURL("..")));
// This is also disallowed due to Windows XP parent path handling.
- EXPECT_FALSE(delegate_->IsAccessValid(CreateFileSystemURL("...")));
+ EXPECT_FALSE(IsAccessValid(CreateFileSystemURL("...")));
// These are identified as unsafe cases due to weird path handling
// on Windows.
- EXPECT_FALSE(delegate_->IsAccessValid(CreateFileSystemURL(" ..")));
- EXPECT_FALSE(delegate_->IsAccessValid(CreateFileSystemURL(".. ")));
+ EXPECT_FALSE(IsAccessValid(CreateFileSystemURL(" ..")));
+ EXPECT_FALSE(IsAccessValid(CreateFileSystemURL(".. ")));
// Similar but safe cases.
- EXPECT_TRUE(delegate_->IsAccessValid(CreateFileSystemURL(" .")));
- EXPECT_TRUE(delegate_->IsAccessValid(CreateFileSystemURL(". ")));
- EXPECT_TRUE(delegate_->IsAccessValid(CreateFileSystemURL("b.")));
- EXPECT_TRUE(delegate_->IsAccessValid(CreateFileSystemURL(".b")));
+ EXPECT_TRUE(IsAccessValid(CreateFileSystemURL(" .")));
+ EXPECT_TRUE(IsAccessValid(CreateFileSystemURL(". ")));
+ EXPECT_TRUE(IsAccessValid(CreateFileSystemURL("b.")));
+ EXPECT_TRUE(IsAccessValid(CreateFileSystemURL(".b")));
// A path that looks like a drive letter.
- EXPECT_TRUE(delegate_->IsAccessValid(CreateFileSystemURL("c:")));
+ EXPECT_TRUE(IsAccessValid(CreateFileSystemURL("c:")));
}
-} // namespace fileapi
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698