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

Unified Diff: webkit/fileapi/file_system_context_unittest.cc

Issue 14096022: Make MountPointProvider pluggable from outside webkit/fileapi (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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: webkit/fileapi/file_system_context_unittest.cc
diff --git a/webkit/fileapi/file_system_context_unittest.cc b/webkit/fileapi/file_system_context_unittest.cc
index b72929cbc97912e11aa9bb245aeab38c197322fe..acf3ba45f0eba53ce3243051faf01366cec042e3 100644
--- a/webkit/fileapi/file_system_context_unittest.cc
+++ b/webkit/fileapi/file_system_context_unittest.cc
@@ -9,6 +9,7 @@
#include "base/stringprintf.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "webkit/fileapi/external_mount_points.h"
+#include "webkit/fileapi/file_system_mount_point_provider.h"
#include "webkit/fileapi/file_system_task_runners.h"
#include "webkit/fileapi/isolated_context.h"
#include "webkit/fileapi/mock_file_system_options.h"
@@ -46,24 +47,25 @@ class FileSystemContextTest : public testing::Test {
virtual void SetUp() {
ASSERT_TRUE(data_dir_.CreateUniqueTempDir());
- storage_policy_ = new quota::MockSpecialStoragePolicy();
-
mock_quota_manager_ = new quota::MockQuotaManager(
false /* is_incognito */,
data_dir_.path(),
base::MessageLoopProxy::current(),
base::MessageLoopProxy::current(),
- storage_policy_);
+ new quota::MockSpecialStoragePolicy());
}
protected:
FileSystemContext* CreateFileSystemContextForTest(
ExternalMountPoints* external_mount_points) {
+ std::vector<MountPoints*> additional_mount_points;
+ if (external_mount_points)
+ additional_mount_points.push_back(external_mount_points);
return new FileSystemContext(
FileSystemTaskRunners::CreateMockTaskRunners(),
- external_mount_points,
- storage_policy_,
mock_quota_manager_->proxy(),
+ ScopedVector<FileSystemMountPointProvider>(),
+ additional_mount_points,
data_dir_.path(),
CreateAllowFileAccessOptions());
}
@@ -89,13 +91,9 @@ class FileSystemContextTest : public testing::Test {
private:
base::ScopedTempDir data_dir_;
MessageLoop message_loop_;
- scoped_refptr<quota::SpecialStoragePolicy> storage_policy_;
scoped_refptr<quota::MockQuotaManager> mock_quota_manager_;
};
-// It is not valid to pass NULL ExternalMountPoints to FileSystemContext on
-// ChromeOS.
-#if !defined(OS_CHROMEOS)
TEST_F(FileSystemContextTest, NullExternalMountPoints) {
scoped_refptr<FileSystemContext> file_system_context(
CreateFileSystemContextForTest(NULL));
@@ -121,7 +119,8 @@ TEST_F(FileSystemContextTest, NullExternalMountPoints) {
GURL(kTestOrigin),
kFileSystemTypeIsolated,
kFileSystemTypeNativeLocal,
- base::FilePath(DRIVE FPL("/test/isolated/root/file")).NormalizePathSeparators(),
+ base::FilePath(
+ DRIVE FPL("/test/isolated/root/file")).NormalizePathSeparators(),
base::FilePath::FromUTF8Unsafe(isolated_id).Append(FPL("root/file")).
NormalizePathSeparators(),
isolated_id);
@@ -134,7 +133,8 @@ TEST_F(FileSystemContextTest, NullExternalMountPoints) {
GURL(kTestOrigin),
kFileSystemTypeExternal,
kFileSystemTypeNativeLocal,
- base::FilePath(DRIVE FPL("/test/sys/root/file")).NormalizePathSeparators(),
+ base::FilePath(
+ DRIVE FPL("/test/sys/root/file")).NormalizePathSeparators(),
base::FilePath(FPL("system/root/file")).NormalizePathSeparators(),
"system");
@@ -142,41 +142,6 @@ TEST_F(FileSystemContextTest, NullExternalMountPoints) {
IsolatedContext::GetInstance()->RevokeFileSystem(isolated_id);
ExternalMountPoints::GetSystemInstance()->RevokeFileSystem("system");
}
-#endif // !defiend(OS_CHROMEOS)
-
-TEST_F(FileSystemContextTest, FileSystemContextKeepsMountPointsAlive) {
- scoped_refptr<ExternalMountPoints> mount_points =
- ExternalMountPoints::CreateRefCounted();
-
- // Register system external mount point.
- ASSERT_TRUE(mount_points->RegisterFileSystem(
- "system",
- kFileSystemTypeNativeLocal,
- base::FilePath(DRIVE FPL("/test/sys/"))));
-
- scoped_refptr<FileSystemContext> file_system_context(
- CreateFileSystemContextForTest(mount_points.get()));
-
- // Release a MountPoints reference created in the test.
- mount_points = NULL;
-
- // FileSystemContext should keep a reference to the |mount_points|, so it
- // should be able to resolve the URL.
- FileSystemURL cracked_external = file_system_context->CrackURL(
- CreateRawFileSystemURL("external", "system"));
-
- ExpectFileSystemURLMatches(
- cracked_external,
- GURL(kTestOrigin),
- kFileSystemTypeExternal,
- kFileSystemTypeNativeLocal,
- base::FilePath(DRIVE FPL("/test/sys/root/file")).NormalizePathSeparators(),
- base::FilePath(FPL("system/root/file")).NormalizePathSeparators(),
- "system");
-
- // No need to revoke the registered filesystem since |mount_points| lifetime
- // is bound to this test.
-}
TEST_F(FileSystemContextTest, CrackFileSystemURL) {
scoped_refptr<ExternalMountPoints> external_mount_points(

Powered by Google App Engine
This is Rietveld 408576698