diff options
author | michaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-19 02:28:02 +0000 |
---|---|---|
committer | michaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-19 02:28:02 +0000 |
commit | ba683f9e34fbe517955f88ed12fd632d2c270704 (patch) | |
tree | 8b8faf996e5ea8b58da03235a200eebf47781c5d /webkit/fileapi/file_system_operation_unittest.cc | |
parent | e3a00bdfecc30949ceef3af5b244accf30915405 (diff) | |
download | chromium_src-ba683f9e34fbe517955f88ed12fd632d2c270704.zip chromium_src-ba683f9e34fbe517955f88ed12fd632d2c270704.tar.gz chromium_src-ba683f9e34fbe517955f88ed12fd632d2c270704.tar.bz2 |
WebFileWriterBase unit tests
BUG=none
TEST=webfilewriter_base_unittest.cc
Review URL: http://codereview.chromium.org/3806009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63007 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 | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/webkit/fileapi/file_system_operation_unittest.cc b/webkit/fileapi/file_system_operation_unittest.cc index 00e13ad..fb300bf 100644 --- a/webkit/fileapi/file_system_operation_unittest.cc +++ b/webkit/fileapi/file_system_operation_unittest.cc @@ -12,17 +12,19 @@ #include "webkit/fileapi/file_system_callback_dispatcher.h" #include "webkit/fileapi/file_system_operation.h" +namespace fileapi { + const int kInvalidRequestId = -1; const int kFileOperationStatusNotSet = 0; const int kFileOperationSucceeded = 1; static int last_request_id = -1; -bool FileExists(FilePath path) { +static bool FileExists(FilePath path) { return file_util::PathExists(path) && !file_util::DirectoryExists(path); } -class MockDispatcher : public fileapi::FileSystemCallbackDispatcher { +class MockDispatcher : public FileSystemCallbackDispatcher { public: MockDispatcher(int request_id) : status_(kFileOperationStatusNotSet), @@ -80,10 +82,10 @@ class FileSystemOperationTest : public testing::Test { EXPECT_TRUE(base_.IsValid()); } - fileapi::FileSystemOperation* operation() { + FileSystemOperation* operation() { request_id_ = ++last_request_id; mock_dispatcher_ = new MockDispatcher(request_id_); - operation_.reset(new fileapi::FileSystemOperation( + operation_.reset(new FileSystemOperation( mock_dispatcher_, base::MessageLoopProxy::CreateForCurrentThread())); return operation_.get(); } @@ -93,7 +95,7 @@ class FileSystemOperationTest : public testing::Test { ScopedTempDir base_; int request_id_; - scoped_ptr<fileapi::FileSystemOperation> operation_; + scoped_ptr<FileSystemOperation> operation_; // Owned by |operation_|. MockDispatcher* mock_dispatcher_; @@ -784,3 +786,5 @@ TEST_F(FileSystemOperationTest, TestTruncate) { for (int i = 0; i < length; ++i) EXPECT_EQ(test_data[i], data[i]); } + +} // namespace fileapi |