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

Unified Diff: chrome/browser/chromeos/drive/write_on_cache_file_unittest.cc

Issue 23050014: Convert drive::FileWriteHelper to a single function for simplification. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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
« no previous file with comments | « chrome/browser/chromeos/drive/write_on_cache_file.cc ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/drive/write_on_cache_file_unittest.cc
diff --git a/chrome/browser/chromeos/drive/file_write_helper_unittest.cc b/chrome/browser/chromeos/drive/write_on_cache_file_unittest.cc
similarity index 77%
rename from chrome/browser/chromeos/drive/file_write_helper_unittest.cc
rename to chrome/browser/chromeos/drive/write_on_cache_file_unittest.cc
index 42703499b48c3f7de214ae501013026ac3525383..ba4fe85c4dbd5201e65a915dfcf5ffbf3a2b97fc 100644
--- a/chrome/browser/chromeos/drive/file_write_helper_unittest.cc
+++ b/chrome/browser/chromeos/drive/write_on_cache_file_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/chromeos/drive/file_write_helper.h"
+#include "chrome/browser/chromeos/drive/write_on_cache_file.h"
#include "base/bind.h"
#include "chrome/browser/chromeos/drive/dummy_file_system.h"
@@ -57,23 +57,15 @@ class TestFileSystem : public DummyFileSystem {
} // namespace
-class FileWriteHelperTest : public testing::Test {
- public:
- FileWriteHelperTest()
- : test_file_system_(new TestFileSystem) {
- }
+TEST(WriteOnCacheFileTest, PrepareFileForWritingSuccess) {
+ content::TestBrowserThreadBundle thread_bundle;
+ TestFileSystem test_file_system;
- protected:
- content::TestBrowserThreadBundle thread_bundle_;
- scoped_ptr<TestFileSystem> test_file_system_;
-};
-
-TEST_F(FileWriteHelperTest, PrepareFileForWritingSuccess) {
- FileWriteHelper file_write_helper(test_file_system_.get());
FileError error = FILE_ERROR_FAILED;
base::FilePath path;
// The file should successfully be opened.
- file_write_helper.PrepareWritableFileAndRun(
+ WriteOnCacheFile(
+ &test_file_system,
base::FilePath(kDrivePath),
google_apis::test_util::CreateCopyResultCallback(&error, &path));
test_util::RunBlockingPoolTask();
@@ -82,16 +74,19 @@ TEST_F(FileWriteHelperTest, PrepareFileForWritingSuccess) {
EXPECT_EQ(kLocalPath, path.value());
// Make sure that the file is actually closed.
- EXPECT_EQ(1, test_file_system_->num_closed());
+ EXPECT_EQ(1, test_file_system.num_closed());
}
-TEST_F(FileWriteHelperTest, PrepareFileForWritingCreateFail) {
- FileWriteHelper file_write_helper(test_file_system_.get());
+TEST(WriteOnCacheFileTest, PrepareFileForWritingCreateFail) {
+ content::TestBrowserThreadBundle thread_bundle;
+ TestFileSystem test_file_system;
+
FileError error = FILE_ERROR_FAILED;
base::FilePath path;
// Access to kInvalidPath should fail, and FileWriteHelper should not try to
// open or close the file.
- file_write_helper.PrepareWritableFileAndRun(
+ WriteOnCacheFile(
+ &test_file_system,
base::FilePath(kInvalidPath),
google_apis::test_util::CreateCopyResultCallback(&error, &path));
test_util::RunBlockingPoolTask();
« no previous file with comments | « chrome/browser/chromeos/drive/write_on_cache_file.cc ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698