summaryrefslogtreecommitdiffstats
path: root/webkit/fileapi/file_system_path_manager_unittest.cc
diff options
context:
space:
mode:
authorericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-28 01:12:18 +0000
committerericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-28 01:12:18 +0000
commit054702d224472e01faf94482e2219ff1cd2b1aa7 (patch)
tree4e4a2074c84c7acf8a31ff40af9eb372b0037c0d /webkit/fileapi/file_system_path_manager_unittest.cc
parent1ebd7b1c556b39785a7e7fb80e959caf2e43fe93 (diff)
downloadchromium_src-054702d224472e01faf94482e2219ff1cd2b1aa7.zip
chromium_src-054702d224472e01faf94482e2219ff1cd2b1aa7.tar.gz
chromium_src-054702d224472e01faf94482e2219ff1cd2b1aa7.tar.bz2
Code to turn on obfuscated filesystems for all, and to migrate all existing users automatically whenever they next access the filesystem or check its quota usage.
Avi, I've added you just for the ChildProcessSecurity stuff in worker_process_host.cc and browser_render_process_host.cc. Drop me a line if you need to know what's going on there. This is for M13, so please ask soon. BUG=none TEST=unit tests Review URL: http://codereview.chromium.org/6976017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87129 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/fileapi/file_system_path_manager_unittest.cc')
-rw-r--r--webkit/fileapi/file_system_path_manager_unittest.cc50
1 files changed, 20 insertions, 30 deletions
diff --git a/webkit/fileapi/file_system_path_manager_unittest.cc b/webkit/fileapi/file_system_path_manager_unittest.cc
index f1f9122..cfdd5ca 100644
--- a/webkit/fileapi/file_system_path_manager_unittest.cc
+++ b/webkit/fileapi/file_system_path_manager_unittest.cc
@@ -8,7 +8,6 @@
#include <string>
#include "base/basictypes.h"
-#include "base/command_line.h" // TODO(ericu): Remove this.
#include "base/file_util.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_callback_factory.h"
@@ -27,9 +26,6 @@
namespace fileapi {
namespace {
-// TODO(ericu): Remove this.
-static const char kObfuscationFlag[] = "use-obfuscated-file-system";
-
// PS stands for path separator.
#if defined(FILE_PATH_USES_WIN_SEPARATORS)
#define PS "\\"
@@ -49,21 +45,21 @@ const struct RootPathTest {
const char* expected_path;
} kRootPathTestCases[] = {
{ fileapi::kFileSystemTypeTemporary, "http://foo:1/",
- "http_foo_1" PS "Temporary" },
+ "000" PS "t" },
{ fileapi::kFileSystemTypePersistent, "http://foo:1/",
- "http_foo_1" PS "Persistent" },
+ "000" PS "p" },
{ fileapi::kFileSystemTypeTemporary, "http://bar.com/",
- "http_bar.com_0" PS "Temporary" },
+ "001" PS "t" },
{ fileapi::kFileSystemTypePersistent, "http://bar.com/",
- "http_bar.com_0" PS "Persistent" },
+ "001" PS "p" },
{ fileapi::kFileSystemTypeTemporary, "https://foo:2/",
- "https_foo_2" PS "Temporary" },
+ "002" PS "t" },
{ fileapi::kFileSystemTypePersistent, "https://foo:2/",
- "https_foo_2" PS "Persistent" },
+ "002" PS "p" },
{ fileapi::kFileSystemTypeTemporary, "https://bar.com/",
- "https_bar.com_0" PS "Temporary" },
+ "003" PS "t" },
{ fileapi::kFileSystemTypePersistent, "https://bar.com/",
- "https_bar.com_0" PS "Persistent" },
+ "003" PS "p" },
#if defined(OS_CHROMEOS)
{ fileapi::kFileSystemTypeExternal, "chrome-extension://foo/",
"chrome-extension__0" PS "External" },
@@ -77,9 +73,9 @@ const struct RootPathFileURITest {
const char* virtual_path;
} kRootPathFileURITestCases[] = {
{ fileapi::kFileSystemTypeTemporary, "file:///",
- "file__0" PS "Temporary", NULL },
+ "000" PS "t", NULL },
{ fileapi::kFileSystemTypePersistent, "file:///",
- "file__0" PS "Persistent", NULL },
+ "000" PS "p", NULL },
#if defined(OS_CHROMEOS)
{ fileapi::kFileSystemTypeExternal, "chrome-extension://foo/",
"chrome-extension__0" PS "External", "testing" },
@@ -259,7 +255,7 @@ class FileSystemPathManagerTest : public testing::Test {
FilePath data_path() { return data_dir_.path(); }
FilePath file_system_path() {
return data_dir_.path().Append(
- SandboxMountPointProvider::kFileSystemDirectory);
+ SandboxMountPointProvider::kNewFileSystemDirectory);
}
FilePath external_file_system_path() {
return UTF8ToFilePath(std::string(fileapi::kExternalDir));
@@ -296,13 +292,9 @@ TEST_F(FileSystemPathManagerTest, GetRootPathCreateAndExamine) {
true /* create */, &root_path));
if (kRootPathTestCases[i].type != fileapi::kFileSystemTypeExternal) {
- // TODO(ericu): Put this test back, with new expectations, when we've
- // switched over to the obfuscated filesystem.
- if (!CommandLine::ForCurrentProcess()->HasSwitch(kObfuscationFlag)) {
- FilePath expected = file_system_path().AppendASCII(
- kRootPathTestCases[i].expected_path);
- EXPECT_EQ(expected.value(), root_path.DirName().value());
- }
+ FilePath expected = file_system_path().AppendASCII(
+ kRootPathTestCases[i].expected_path);
+ EXPECT_EQ(expected.value(), root_path.value());
EXPECT_TRUE(file_util::DirectoryExists(root_path));
} else {
// External file system root path is virtual one and does not match
@@ -333,16 +325,17 @@ TEST_F(FileSystemPathManagerTest, GetRootPathCreateAndExamine) {
TEST_F(FileSystemPathManagerTest, GetRootPathCreateAndExamineWithNewManager) {
std::vector<FilePath> returned_root_path(
ARRAYSIZE_UNSAFE(kRootPathTestCases));
- scoped_ptr<FileSystemPathManager> manager1(NewPathManager(false, false));
- scoped_ptr<FileSystemPathManager> manager2(NewPathManager(false, false));
+ scoped_ptr<FileSystemPathManager> manager(NewPathManager(false, false));
GURL origin_url("http://foo.com:1/");
FilePath root_path1;
- EXPECT_TRUE(GetRootPath(manager1.get(), origin_url,
+ EXPECT_TRUE(GetRootPath(manager.get(), origin_url,
kFileSystemTypeTemporary, true, &root_path1));
+
+ manager.reset(NewPathManager(false, false));
FilePath root_path2;
- EXPECT_TRUE(GetRootPath(manager2.get(), origin_url,
+ EXPECT_TRUE(GetRootPath(manager.get(), origin_url,
kFileSystemTypeTemporary, false, &root_path2));
EXPECT_EQ(root_path1.value(), root_path2.value());
@@ -403,10 +396,7 @@ TEST_F(FileSystemPathManagerTest, GetRootPathFileURIWithAllowFlag) {
if (kRootPathFileURITestCases[i].type != fileapi::kFileSystemTypeExternal) {
FilePath expected = file_system_path().AppendASCII(
kRootPathFileURITestCases[i].expected_path);
- // TODO(ericu): Put this test back, with new expectations, when we've
- // switched over to the obfuscated filesystem.
- if (!CommandLine::ForCurrentProcess()->HasSwitch(kObfuscationFlag))
- EXPECT_EQ(expected.value(), root_path.DirName().value());
+ EXPECT_EQ(expected.value(), root_path.value());
EXPECT_TRUE(file_util::DirectoryExists(root_path));
} else {
EXPECT_EQ(external_file_path_root().value(), root_path.value());