| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/drive/file_write_helper.h" | 5 #include "chrome/browser/chromeos/drive/file_write_helper.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/threading/thread_restrictions.h" | 9 #include "base/threading/thread_restrictions.h" |
| 10 #include "chrome/browser/chromeos/drive/dummy_file_system.h" | 10 #include "chrome/browser/chromeos/drive/dummy_file_system.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 } // namespace | 70 } // namespace |
| 71 | 71 |
| 72 class FileWriteHelperTest : public testing::Test { | 72 class FileWriteHelperTest : public testing::Test { |
| 73 public: | 73 public: |
| 74 FileWriteHelperTest() | 74 FileWriteHelperTest() |
| 75 : ui_thread_(content::BrowserThread::UI, &message_loop_), | 75 : ui_thread_(content::BrowserThread::UI, &message_loop_), |
| 76 test_file_system_(new TestFileSystem) { | 76 test_file_system_(new TestFileSystem) { |
| 77 } | 77 } |
| 78 | 78 |
| 79 protected: | 79 protected: |
| 80 MessageLoopForUI message_loop_; | 80 base::MessageLoopForUI message_loop_; |
| 81 content::TestBrowserThread ui_thread_; | 81 content::TestBrowserThread ui_thread_; |
| 82 scoped_ptr<TestFileSystem> test_file_system_; | 82 scoped_ptr<TestFileSystem> test_file_system_; |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 TEST_F(FileWriteHelperTest, PrepareFileForWritingSuccess) { | 85 TEST_F(FileWriteHelperTest, PrepareFileForWritingSuccess) { |
| 86 FileWriteHelper file_write_helper(test_file_system_.get()); | 86 FileWriteHelper file_write_helper(test_file_system_.get()); |
| 87 FileError error = FILE_ERROR_FAILED; | 87 FileError error = FILE_ERROR_FAILED; |
| 88 base::FilePath path; | 88 base::FilePath path; |
| 89 // The file should successfully be opened. | 89 // The file should successfully be opened. |
| 90 file_write_helper.PrepareWritableFileAndRun( | 90 file_write_helper.PrepareWritableFileAndRun( |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 file_write_helper.PrepareWritableFileAndRun( | 132 file_write_helper.PrepareWritableFileAndRun( |
| 133 base::FilePath(kDrivePath), | 133 base::FilePath(kDrivePath), |
| 134 google_apis::test_util::CreateCopyResultCallback(&error, &path)); | 134 google_apis::test_util::CreateCopyResultCallback(&error, &path)); |
| 135 google_apis::test_util::RunBlockingPoolTask(); | 135 google_apis::test_util::RunBlockingPoolTask(); |
| 136 | 136 |
| 137 EXPECT_EQ(FILE_ERROR_IN_USE, error); | 137 EXPECT_EQ(FILE_ERROR_IN_USE, error); |
| 138 EXPECT_TRUE(path.empty()); | 138 EXPECT_TRUE(path.empty()); |
| 139 } | 139 } |
| 140 | 140 |
| 141 } // namespace drive | 141 } // namespace drive |
| OLD | NEW |