From a5a8b411638be7ba86fb9f26dbf7dd64263fd4dd Mon Sep 17 00:00:00 2001 From: "hashimoto@chromium.org" Date: Mon, 4 Mar 2013 15:03:11 +0000 Subject: chromeos: Use /tmp as mount root directory for stubs. Move RegisterFileSystem calls for default system mount points to CrosMountProvider. Add CrosDisksClient::GetArchiveMountRootDirectory/GetDiskMountRootDirectory. BUG=178987 TEST=git cl try Review URL: https://chromiumcodereview.appspot.com/12397002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@185898 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/chromeos/DEPS | 3 +++ webkit/chromeos/fileapi/cros_mount_point_provider.cc | 14 ++++++++++++++ .../fileapi/cros_mount_point_provider_unittest.cc | 11 ++++++++--- webkit/fileapi/external_mount_points.cc | 20 -------------------- 4 files changed, 25 insertions(+), 23 deletions(-) create mode 100644 webkit/chromeos/DEPS (limited to 'webkit') diff --git a/webkit/chromeos/DEPS b/webkit/chromeos/DEPS new file mode 100644 index 0000000..79b8e8b --- /dev/null +++ b/webkit/chromeos/DEPS @@ -0,0 +1,3 @@ +include_rules = [ + "+chromeos", +] diff --git a/webkit/chromeos/fileapi/cros_mount_point_provider.cc b/webkit/chromeos/fileapi/cros_mount_point_provider.cc index 7f13002..731b10c 100644 --- a/webkit/chromeos/fileapi/cros_mount_point_provider.cc +++ b/webkit/chromeos/fileapi/cros_mount_point_provider.cc @@ -11,6 +11,7 @@ #include "base/stringprintf.h" #include "base/synchronization/lock.h" #include "base/utf_string_conversions.h" +#include "chromeos/dbus/cros_disks_client.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebCString.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebFileSystem.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" @@ -57,6 +58,19 @@ CrosMountPointProvider::CrosMountPointProvider( new fileapi::IsolatedFileUtil())), mount_points_(mount_points), system_mount_points_(system_mount_points) { + // Add default system mount points. + system_mount_points_->RegisterFileSystem( + "archive", + fileapi::kFileSystemTypeNativeLocal, + chromeos::CrosDisksClient::GetArchiveMountPoint()); + system_mount_points_->RegisterFileSystem( + "removable", + fileapi::kFileSystemTypeNativeLocal, + chromeos::CrosDisksClient::GetRemovableDiskMountPoint()); + system_mount_points_->RegisterFileSystem( + "oem", + fileapi::kFileSystemTypeRestrictedNativeLocal, + base::FilePath(FILE_PATH_LITERAL("/usr/share/oem"))); } CrosMountPointProvider::~CrosMountPointProvider() { diff --git a/webkit/chromeos/fileapi/cros_mount_point_provider_unittest.cc b/webkit/chromeos/fileapi/cros_mount_point_provider_unittest.cc index 1910ee3..22f74df 100644 --- a/webkit/chromeos/fileapi/cros_mount_point_provider_unittest.cc +++ b/webkit/chromeos/fileapi/cros_mount_point_provider_unittest.cc @@ -7,6 +7,7 @@ #include #include "base/files/file_path.h" +#include "chromeos/dbus/cros_disks_client.h" #include "googleurl/src/url_util.h" #include "testing/gtest/include/gtest/gtest.h" #include "webkit/fileapi/external_mount_points.h" @@ -45,8 +46,10 @@ TEST(CrosMountPointProviderTest, DefaultMountPoints) { // By default there should be 3 mount points (in system mount points): EXPECT_EQ(3u, root_dirs.size()); - EXPECT_TRUE(root_dirs_set.count(base::FilePath(FPL("/media/removable")))); - EXPECT_TRUE(root_dirs_set.count(base::FilePath(FPL("/media/archive")))); + EXPECT_TRUE(root_dirs_set.count( + chromeos::CrosDisksClient::GetRemovableDiskMountPoint())); + EXPECT_TRUE(root_dirs_set.count( + chromeos::CrosDisksClient::GetArchiveMountPoint())); EXPECT_TRUE(root_dirs_set.count(base::FilePath(FPL("/usr/share/oem")))); } @@ -64,6 +67,8 @@ TEST(CrosMountPointProviderTest, GetRootDirectories) { mount_points.get(), system_mount_points.get()); + const size_t initial_root_dirs_size = provider.GetRootDirectories().size(); + // Register 'local' test mount points. mount_points->RegisterFileSystem("c", fileapi::kFileSystemTypeNativeLocal, @@ -82,7 +87,7 @@ TEST(CrosMountPointProviderTest, GetRootDirectories) { std::vector root_dirs = provider.GetRootDirectories(); std::set root_dirs_set(root_dirs.begin(), root_dirs.end()); - EXPECT_EQ(4u, root_dirs.size()); + EXPECT_EQ(initial_root_dirs_size + 4, root_dirs.size()); EXPECT_TRUE(root_dirs_set.count(base::FilePath(FPL("/a/b/c")))); EXPECT_TRUE(root_dirs_set.count(base::FilePath(FPL("/b/c/d")))); EXPECT_TRUE(root_dirs_set.count(base::FilePath(FPL("/g/c/d")))); diff --git a/webkit/fileapi/external_mount_points.cc b/webkit/fileapi/external_mount_points.cc index 5c84c1b..58a8883 100644 --- a/webkit/fileapi/external_mount_points.cc +++ b/webkit/fileapi/external_mount_points.cc @@ -37,7 +37,6 @@ class SystemMountPointsLazyWrapper { public: SystemMountPointsLazyWrapper() : system_mount_points_(fileapi::ExternalMountPoints::CreateRefCounted()) { - RegisterDefaultMountPoints(); } ~SystemMountPointsLazyWrapper() {} @@ -47,24 +46,6 @@ class SystemMountPointsLazyWrapper { } private: - void RegisterDefaultMountPoints() { -#if defined(OS_CHROMEOS) - // Add default system mount points. - system_mount_points_->RegisterFileSystem( - "archive", - fileapi::kFileSystemTypeNativeLocal, - base::FilePath(FILE_PATH_LITERAL("/media/archive"))); - system_mount_points_->RegisterFileSystem( - "removable", - fileapi::kFileSystemTypeNativeLocal, - base::FilePath(FILE_PATH_LITERAL("/media/removable"))); - system_mount_points_->RegisterFileSystem( - "oem", - fileapi::kFileSystemTypeRestrictedNativeLocal, - base::FilePath(FILE_PATH_LITERAL("/usr/share/oem"))); -#endif // defined(OS_CHROMEOS) - } - scoped_refptr system_mount_points_; }; @@ -351,4 +332,3 @@ ScopedExternalFileSystem::~ScopedExternalFileSystem() { } } // namespace fileapi - -- cgit v1.1