diff options
author | kerz@chromium.org <kerz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-20 22:19:17 +0000 |
---|---|---|
committer | kerz@chromium.org <kerz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-20 22:19:17 +0000 |
commit | eeed85c4662942e0c9e557d36fa0d26a938058e5 (patch) | |
tree | 3e6e267779cd0de15b1dfb8543e399023a4b1342 /webkit/fileapi/file_system_operation_unittest.cc | |
parent | fe2534f1d0294dadd3bc915982ef378906a2be57 (diff) | |
download | chromium_src-eeed85c4662942e0c9e557d36fa0d26a938058e5.zip chromium_src-eeed85c4662942e0c9e557d36fa0d26a938058e5.tar.gz chromium_src-eeed85c4662942e0c9e557d36fa0d26a938058e5.tar.bz2 |
Merge 82266 - Fixed file/directory url resolution for external mount point provider.Per Eric's request, refactored FileSystemDirURLRequestJob and FileSystemURLRequestJob classes to resolve local file system through a new operation.BUG=chromium-os:14225TEST=added new test cases to FileSystemPathManagerTest.*, added FileSystemOperationTest.TestGetLocalFilePathSuccessReview URL: http://codereview.chromium.org/6864040
TBR=zelidrag@chromium.org
Review URL: http://codereview.chromium.org/6882102
git-svn-id: svn://svn.chromium.org/chrome/branches/742/src@82372 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/fileapi/file_system_operation_unittest.cc')
-rw-r--r-- | webkit/fileapi/file_system_operation_unittest.cc | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/webkit/fileapi/file_system_operation_unittest.cc b/webkit/fileapi/file_system_operation_unittest.cc index 292104b..934504d 100644 --- a/webkit/fileapi/file_system_operation_unittest.cc +++ b/webkit/fileapi/file_system_operation_unittest.cc @@ -4,14 +4,19 @@ #include "webkit/fileapi/file_system_operation.h" +#include "base/file_util.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/memory/scoped_temp_dir.h" #include "base/message_loop.h" #include "testing/gtest/include/gtest/gtest.h" #include "webkit/fileapi/file_system_callback_dispatcher.h" +#include "webkit/fileapi/file_system_context.h" #include "webkit/fileapi/file_system_file_util.h" +#include "webkit/fileapi/file_system_mount_point_provider.h" #include "webkit/fileapi/file_system_operation.h" +#include "webkit/fileapi/file_system_path_manager.h" +#include "webkit/fileapi/file_system_util.h" namespace fileapi { @@ -39,6 +44,8 @@ class FileSystemOperationTest : public testing::Test { FileSystemOperation* operation(); + void set_local_path(const FilePath& path) { local_path_ = path; } + const FilePath& local_path() const { return local_path_; } void set_status(int status) { status_ = status; } int status() const { return status_; } void set_info(const base::PlatformFileInfo& info) { info_ = info; } @@ -70,6 +77,7 @@ class FileSystemOperationTest : public testing::Test { int status_; base::PlatformFileInfo info_; FilePath path_; + FilePath local_path_; std::vector<base::FileUtilProxy::Entry> entries_; DISALLOW_COPY_AND_ASSIGN(FileSystemOperationTest); @@ -87,6 +95,11 @@ class MockDispatcher : public FileSystemCallbackDispatcher { test_->set_status(kFileOperationSucceeded); } + virtual void DidGetLocalPath(const FilePath& local_path) { + test_->set_local_path(local_path); + test_->set_status(kFileOperationSucceeded); + } + virtual void DidReadMetadata( const base::PlatformFileInfo& info, const FilePath& platform_path) { @@ -126,6 +139,7 @@ FileSystemOperation* FileSystemOperationTest::operation() { GURL origin_url("fake://fake.foo/"); operation->file_system_operation_context()->set_src_origin_url(origin_url); operation->file_system_operation_context()->set_dest_origin_url(origin_url); + return operation; } @@ -610,6 +624,22 @@ TEST_F(FileSystemOperationTest, TestExistsAndMetadataSuccess) { EXPECT_EQ(file, path()); } +TEST_F(FileSystemOperationTest, TestGetLocalFilePathSuccess) { + ScopedTempDir dir; + ASSERT_TRUE(dir.CreateUniqueTempDir()); + operation()->GetLocalPath(URLForPath(dir.path())); + MessageLoop::current()->RunAllPending(); + EXPECT_EQ(kFileOperationSucceeded, status()); + EXPECT_EQ(local_path().value(), dir.path().value()); + + FilePath file; + file_util::CreateTemporaryFileInDir(dir.path(), &file); + operation()->GetLocalPath(URLForPath(file)); + MessageLoop::current()->RunAllPending(); + EXPECT_EQ(kFileOperationSucceeded, status()); + EXPECT_EQ(local_path().value(), file.value()); +} + TEST_F(FileSystemOperationTest, TestTypeMismatchErrors) { ScopedTempDir dir; ASSERT_TRUE(dir.CreateUniqueTempDir()); |