Remove unused code from FileUtilProxy.

BUG=322664

Review URL: https://codereview.chromium.org/293433002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272073 0039d316-1c4b-4281-b951-d872f2087c98


CrOS-Libchrome-Original-Commit: d1b290804b850db6960d39773acfb171ca61a4c5
diff --git a/base/files/file_proxy_unittest.cc b/base/files/file_proxy_unittest.cc
index d44beb9..9be8abf 100644
--- a/base/files/file_proxy_unittest.cc
+++ b/base/files/file_proxy_unittest.cc
@@ -4,13 +4,10 @@
 
 #include "base/files/file_proxy.h"
 
-#include <map>
-
 #include "base/bind.h"
 #include "base/file_util.h"
 #include "base/files/file.h"
 #include "base/files/scoped_temp_dir.h"
-#include "base/logging.h"
 #include "base/memory/weak_ptr.h"
 #include "base/message_loop/message_loop.h"
 #include "base/threading/thread.h"
diff --git a/base/files/file_util_proxy.cc b/base/files/file_util_proxy.cc
index 0a86393..72d9436 100644
--- a/base/files/file_util_proxy.cc
+++ b/base/files/file_util_proxy.cc
@@ -7,9 +7,7 @@
 #include "base/bind.h"
 #include "base/bind_helpers.h"
 #include "base/file_util.h"
-#include "base/files/file.h"
 #include "base/location.h"
-#include "base/message_loop/message_loop_proxy.h"
 #include "base/task_runner.h"
 #include "base/task_runner_util.h"
 
@@ -23,97 +21,6 @@
   callback.Run(value ? File::FILE_OK : File::FILE_ERROR_FAILED);
 }
 
-// Helper classes or routines for individual methods.
-class CreateOrOpenHelper {
- public:
-  CreateOrOpenHelper(TaskRunner* task_runner,
-                     const FileUtilProxy::CloseTask& close_task)
-      : task_runner_(task_runner),
-        close_task_(close_task),
-        file_handle_(kInvalidPlatformFileValue),
-        created_(false),
-        error_(File::FILE_OK) {}
-
-  ~CreateOrOpenHelper() {
-    if (file_handle_ != kInvalidPlatformFileValue) {
-      task_runner_->PostTask(
-          FROM_HERE,
-          base::Bind(base::IgnoreResult(close_task_), file_handle_));
-    }
-  }
-
-  void RunWork(const FileUtilProxy::CreateOrOpenTask& task) {
-    error_ = task.Run(&file_handle_, &created_);
-  }
-
-  void Reply(const FileUtilProxy::CreateOrOpenCallback& callback) {
-    DCHECK(!callback.is_null());
-    callback.Run(error_, PassPlatformFile(&file_handle_), created_);
-  }
-
- private:
-  scoped_refptr<TaskRunner> task_runner_;
-  FileUtilProxy::CloseTask close_task_;
-  PlatformFile file_handle_;
-  bool created_;
-  File::Error error_;
-  DISALLOW_COPY_AND_ASSIGN(CreateOrOpenHelper);
-};
-
-class CreateTemporaryHelper {
- public:
-  explicit CreateTemporaryHelper(TaskRunner* task_runner)
-      : task_runner_(task_runner),
-        file_handle_(kInvalidPlatformFileValue),
-        error_(File::FILE_OK) {}
-
-  ~CreateTemporaryHelper() {
-    if (file_handle_ != kInvalidPlatformFileValue) {
-      FileUtilProxy::Close(
-          task_runner_.get(), file_handle_, FileUtilProxy::StatusCallback());
-    }
-  }
-
-  void RunWork(int additional_file_flags) {
-    // TODO(darin): file_util should have a variant of CreateTemporaryFile
-    // that returns a FilePath and a PlatformFile.
-    if (!base::CreateTemporaryFile(&file_path_)) {
-      // TODO(davidben): base::CreateTemporaryFile should preserve the error
-      // code.
-      error_ = File::FILE_ERROR_FAILED;
-      return;
-    }
-
-    int file_flags =
-        PLATFORM_FILE_WRITE |
-        PLATFORM_FILE_TEMPORARY |
-        PLATFORM_FILE_CREATE_ALWAYS |
-        additional_file_flags;
-
-    File file(file_path_, file_flags);
-    if (!file.IsValid()) {
-      base::DeleteFile(file_path_, false);
-      file_path_.clear();
-      error_ = file.error_details();
-      return;
-    }
-    error_ = File::FILE_OK;
-    file_handle_ = file.TakePlatformFile();
-  }
-
-  void Reply(const FileUtilProxy::CreateTemporaryCallback& callback) {
-    DCHECK(!callback.is_null());
-    callback.Run(error_, PassPlatformFile(&file_handle_), file_path_);
-  }
-
- private:
-  scoped_refptr<TaskRunner> task_runner_;
-  PlatformFile file_handle_;
-  FilePath file_path_;
-  File::Error error_;
-  DISALLOW_COPY_AND_ASSIGN(CreateTemporaryHelper);
-};
-
 class GetFileInfoHelper {
  public:
   GetFileInfoHelper()
@@ -124,18 +31,10 @@
       error_ = File::FILE_ERROR_NOT_FOUND;
       return;
     }
-    // TODO(rvargas): switch this file to base::File.
-    if (!GetFileInfo(file_path, reinterpret_cast<File::Info*>(&file_info_)))
+    if (!GetFileInfo(file_path, &file_info_))
       error_ = File::FILE_ERROR_FAILED;
   }
 
-  void RunWorkForPlatformFile(PlatformFile file) {
-    if (!GetPlatformFileInfo(
-            file, reinterpret_cast<PlatformFileInfo*>(&file_info_))) {
-      error_ = File::FILE_ERROR_FAILED;
-    }
-  }
-
   void Reply(const FileUtilProxy::GetFileInfoCallback& callback) {
     if (!callback.is_null()) {
       callback.Run(error_, file_info_);
@@ -148,87 +47,6 @@
   DISALLOW_COPY_AND_ASSIGN(GetFileInfoHelper);
 };
 
-class ReadHelper {
- public:
-  explicit ReadHelper(int bytes_to_read)
-      : buffer_(new char[bytes_to_read]),
-        bytes_to_read_(bytes_to_read),
-        bytes_read_(0) {}
-
-  void RunWork(PlatformFile file, int64 offset) {
-    bytes_read_ = ReadPlatformFile(file, offset, buffer_.get(), bytes_to_read_);
-  }
-
-  void Reply(const FileUtilProxy::ReadCallback& callback) {
-    if (!callback.is_null()) {
-      File::Error error =
-          (bytes_read_ < 0) ? File::FILE_ERROR_FAILED : File::FILE_OK;
-      callback.Run(error, buffer_.get(), bytes_read_);
-    }
-  }
-
- private:
-  scoped_ptr<char[]> buffer_;
-  int bytes_to_read_;
-  int bytes_read_;
-  DISALLOW_COPY_AND_ASSIGN(ReadHelper);
-};
-
-class WriteHelper {
- public:
-  WriteHelper(const char* buffer, int bytes_to_write)
-      : buffer_(new char[bytes_to_write]),
-        bytes_to_write_(bytes_to_write),
-        bytes_written_(0) {
-    memcpy(buffer_.get(), buffer, bytes_to_write);
-  }
-
-  void RunWork(PlatformFile file, int64 offset) {
-    bytes_written_ = WritePlatformFile(file, offset, buffer_.get(),
-                                       bytes_to_write_);
-  }
-
-  void Reply(const FileUtilProxy::WriteCallback& callback) {
-    if (!callback.is_null()) {
-      File::Error error =
-          (bytes_written_ < 0) ? File::FILE_ERROR_FAILED : File::FILE_OK;
-      callback.Run(error, bytes_written_);
-    }
-  }
-
- private:
-  scoped_ptr<char[]> buffer_;
-  int bytes_to_write_;
-  int bytes_written_;
-  DISALLOW_COPY_AND_ASSIGN(WriteHelper);
-};
-
-File::Error CreateOrOpenAdapter(
-    const FilePath& file_path, int file_flags,
-    PlatformFile* file_handle, bool* created) {
-  DCHECK(file_handle);
-  DCHECK(created);
-  if (!DirectoryExists(file_path.DirName())) {
-    // If its parent does not exist, should return NOT_FOUND error.
-    return File::FILE_ERROR_NOT_FOUND;
-  }
-
-  File file(file_path, file_flags);
-  if (!file.IsValid())
-    return file.error_details();
-
-  *file_handle = file.TakePlatformFile();
-  *created = file.created();
-  return File::FILE_OK;
-}
-
-File::Error CloseAdapter(PlatformFile file_handle) {
-  if (!ClosePlatformFile(file_handle)) {
-    return File::FILE_ERROR_FAILED;
-  }
-  return File::FILE_OK;
-}
-
 File::Error DeleteAdapter(const FilePath& file_path, bool recursive) {
   if (!PathExists(file_path)) {
     return File::FILE_ERROR_NOT_FOUND;
@@ -244,42 +62,6 @@
 
 }  // namespace
 
-// static
-bool FileUtilProxy::CreateOrOpen(
-    TaskRunner* task_runner,
-    const FilePath& file_path, int file_flags,
-    const CreateOrOpenCallback& callback) {
-  return RelayCreateOrOpen(
-      task_runner,
-      base::Bind(&CreateOrOpenAdapter, file_path, file_flags),
-      base::Bind(&CloseAdapter),
-      callback);
-}
-
-// static
-bool FileUtilProxy::CreateTemporary(
-    TaskRunner* task_runner,
-    int additional_file_flags,
-    const CreateTemporaryCallback& callback) {
-  CreateTemporaryHelper* helper = new CreateTemporaryHelper(task_runner);
-  return task_runner->PostTaskAndReply(
-      FROM_HERE,
-      Bind(&CreateTemporaryHelper::RunWork, Unretained(helper),
-           additional_file_flags),
-      Bind(&CreateTemporaryHelper::Reply, Owned(helper), callback));
-}
-
-// static
-bool FileUtilProxy::Close(
-    TaskRunner* task_runner,
-    base::PlatformFile file_handle,
-    const StatusCallback& callback) {
-  return RelayClose(
-      task_runner,
-      base::Bind(&CloseAdapter),
-      file_handle, callback);
-}
-
 // Retrieves the information about a file. It is invalid to pass NULL for the
 // callback.
 bool FileUtilProxy::GetFileInfo(
@@ -295,19 +77,6 @@
 }
 
 // static
-bool FileUtilProxy::GetFileInfoFromPlatformFile(
-    TaskRunner* task_runner,
-    PlatformFile file,
-    const GetFileInfoCallback& callback) {
-  GetFileInfoHelper* helper = new GetFileInfoHelper;
-  return task_runner->PostTaskAndReply(
-      FROM_HERE,
-      Bind(&GetFileInfoHelper::RunWorkForPlatformFile,
-           Unretained(helper), file),
-      Bind(&GetFileInfoHelper::Reply, Owned(helper), callback));
-}
-
-// static
 bool FileUtilProxy::DeleteFile(TaskRunner* task_runner,
                                const FilePath& file_path,
                                bool recursive,
@@ -319,56 +88,6 @@
 }
 
 // static
-bool FileUtilProxy::Read(
-    TaskRunner* task_runner,
-    PlatformFile file,
-    int64 offset,
-    int bytes_to_read,
-    const ReadCallback& callback) {
-  if (bytes_to_read < 0) {
-    return false;
-  }
-  ReadHelper* helper = new ReadHelper(bytes_to_read);
-  return task_runner->PostTaskAndReply(
-      FROM_HERE,
-      Bind(&ReadHelper::RunWork, Unretained(helper), file, offset),
-      Bind(&ReadHelper::Reply, Owned(helper), callback));
-}
-
-// static
-bool FileUtilProxy::Write(
-    TaskRunner* task_runner,
-    PlatformFile file,
-    int64 offset,
-    const char* buffer,
-    int bytes_to_write,
-    const WriteCallback& callback) {
-  if (bytes_to_write <= 0 || buffer == NULL) {
-    return false;
-  }
-  WriteHelper* helper = new WriteHelper(buffer, bytes_to_write);
-  return task_runner->PostTaskAndReply(
-      FROM_HERE,
-      Bind(&WriteHelper::RunWork, Unretained(helper), file, offset),
-      Bind(&WriteHelper::Reply, Owned(helper), callback));
-}
-
-// static
-bool FileUtilProxy::Touch(
-    TaskRunner* task_runner,
-    PlatformFile file,
-    const Time& last_access_time,
-    const Time& last_modified_time,
-    const StatusCallback& callback) {
-  return base::PostTaskAndReplyWithResult(
-      task_runner,
-      FROM_HERE,
-      Bind(&TouchPlatformFile, file,
-           last_access_time, last_modified_time),
-      Bind(&CallWithTranslatedParameter, callback));
-}
-
-// static
 bool FileUtilProxy::Touch(
     TaskRunner* task_runner,
     const FilePath& file_path,
@@ -382,53 +101,4 @@
       Bind(&CallWithTranslatedParameter, callback));
 }
 
-// static
-bool FileUtilProxy::Truncate(
-    TaskRunner* task_runner,
-    PlatformFile file,
-    int64 length,
-    const StatusCallback& callback) {
-  return base::PostTaskAndReplyWithResult(
-      task_runner,
-      FROM_HERE,
-      Bind(&TruncatePlatformFile, file, length),
-      Bind(&CallWithTranslatedParameter, callback));
-}
-
-// static
-bool FileUtilProxy::Flush(
-    TaskRunner* task_runner,
-    PlatformFile file,
-    const StatusCallback& callback) {
-  return base::PostTaskAndReplyWithResult(
-      task_runner,
-      FROM_HERE,
-      Bind(&FlushPlatformFile, file),
-      Bind(&CallWithTranslatedParameter, callback));
-}
-
-// static
-bool FileUtilProxy::RelayCreateOrOpen(
-    TaskRunner* task_runner,
-    const CreateOrOpenTask& open_task,
-    const CloseTask& close_task,
-    const CreateOrOpenCallback& callback) {
-  CreateOrOpenHelper* helper = new CreateOrOpenHelper(
-      task_runner, close_task);
-  return task_runner->PostTaskAndReply(
-      FROM_HERE,
-      Bind(&CreateOrOpenHelper::RunWork, Unretained(helper), open_task),
-      Bind(&CreateOrOpenHelper::Reply, Owned(helper), callback));
-}
-
-// static
-bool FileUtilProxy::RelayClose(
-    TaskRunner* task_runner,
-    const CloseTask& close_task,
-    PlatformFile file_handle,
-    const StatusCallback& callback) {
-  return base::PostTaskAndReplyWithResult(
-      task_runner, FROM_HERE, Bind(close_task, file_handle), callback);
-}
-
 }  // namespace base
diff --git a/base/files/file_util_proxy.h b/base/files/file_util_proxy.h
index 846e8fb..80688cf 100644
--- a/base/files/file_util_proxy.h
+++ b/base/files/file_util_proxy.h
@@ -9,12 +9,6 @@
 #include "base/callback_forward.h"
 #include "base/files/file.h"
 #include "base/files/file_path.h"
-#include "base/memory/ref_counted.h"
-#include "base/platform_file.h"
-
-namespace tracked_objects {
-class Location;
-};
 
 namespace base {
 
@@ -30,54 +24,7 @@
   typedef Callback<void(File::Error)> StatusCallback;
 
   typedef Callback<void(File::Error,
-                        PassPlatformFile,
-                        bool /* created */)> CreateOrOpenCallback;
-  typedef Callback<void(File::Error,
-                        PassPlatformFile,
-                        const FilePath&)> CreateTemporaryCallback;
-  typedef Callback<void(File::Error,
                         const File::Info&)> GetFileInfoCallback;
-  typedef Callback<void(File::Error,
-                        const char* /* data */,
-                        int /* bytes read */)> ReadCallback;
-  typedef Callback<void(File::Error,
-                        int /* bytes written */)> WriteCallback;
-
-  typedef Callback<File::Error(PlatformFile*, bool*)> CreateOrOpenTask;
-  typedef Callback<File::Error(PlatformFile)> CloseTask;
-  typedef Callback<File::Error(void)> FileTask;
-
-  // Creates or opens a file with the given flags. It is invalid to pass a null
-  // callback. If PLATFORM_FILE_CREATE is set in |file_flags| it always tries to
-  // create a new file at the given |file_path| and calls back with
-  // PLATFORM_FILE_ERROR_FILE_EXISTS if the |file_path| already exists.
-  //
-  // This returns false if task posting to |task_runner| has failed.
-  static bool CreateOrOpen(TaskRunner* task_runner,
-                           const FilePath& file_path,
-                           int file_flags,
-                           const CreateOrOpenCallback& callback);
-
-  // Creates a temporary file for writing. The path and an open file handle are
-  // returned. It is invalid to pass a null callback. The additional file flags
-  // will be added on top of the default file flags which are:
-  //   base::PLATFORM_FILE_CREATE_ALWAYS
-  //   base::PLATFORM_FILE_WRITE
-  //   base::PLATFORM_FILE_TEMPORARY.
-  // Set |additional_file_flags| to 0 for synchronous writes and set to
-  // base::PLATFORM_FILE_ASYNC to support asynchronous file operations.
-  //
-  // This returns false if task posting to |task_runner| has failed.
-  static bool CreateTemporary(
-      TaskRunner* task_runner,
-      int additional_file_flags,
-      const CreateTemporaryCallback& callback);
-
-  // Close the given file handle.
-  // This returns false if task posting to |task_runner| has failed.
-  static bool Close(TaskRunner* task_runner,
-                    PlatformFile,
-                    const StatusCallback& callback);
 
   // Retrieves the information about a file. It is invalid to pass a null
   // callback.
@@ -87,13 +34,6 @@
       const FilePath& file_path,
       const GetFileInfoCallback& callback);
 
-  // Does the same as GetFileInfo but takes PlatformFile instead of FilePath.
-  // This returns false if task posting to |task_runner| has failed.
-  static bool GetFileInfoFromPlatformFile(
-      TaskRunner* task_runner,
-      PlatformFile file,
-      const GetFileInfoCallback& callback);
-
   // Deletes a file or a directory.
   // It is an error to delete a non-empty directory with recursive=false.
   // This returns false if task posting to |task_runner| has failed.
@@ -102,42 +42,6 @@
                          bool recursive,
                          const StatusCallback& callback);
 
-  // Reads from a file. On success, the file pointer is moved to position
-  // |offset + bytes_to_read| in the file. The callback can be null.
-  //
-  // This returns false if |bytes_to_read| is less than zero, or
-  // if task posting to |task_runner| has failed.
-  static bool Read(
-      TaskRunner* task_runner,
-      PlatformFile file,
-      int64 offset,
-      int bytes_to_read,
-      const ReadCallback& callback);
-
-  // Writes to a file. If |offset| is greater than the length of the file,
-  // |false| is returned. On success, the file pointer is moved to position
-  // |offset + bytes_to_write| in the file. The callback can be null.
-  // |bytes_to_write| must be greater than zero.
-  //
-  // This returns false if |bytes_to_write| is less than or equal to zero,
-  // if |buffer| is NULL, or if task posting to |task_runner| has failed.
-  static bool Write(
-      TaskRunner* task_runner,
-      PlatformFile file,
-      int64 offset,
-      const char* buffer,
-      int bytes_to_write,
-      const WriteCallback& callback);
-
-  // Touches a file. The callback can be null.
-  // This returns false if task posting to |task_runner| has failed.
-  static bool Touch(
-      TaskRunner* task_runner,
-      PlatformFile file,
-      const Time& last_access_time,
-      const Time& last_modified_time,
-      const StatusCallback& callback);
-
   // Touches a file. The callback can be null.
   // This returns false if task posting to |task_runner| has failed.
   static bool Touch(
@@ -147,46 +51,6 @@
       const Time& last_modified_time,
       const StatusCallback& callback);
 
-  // Truncates a file to the given length. If |length| is greater than the
-  // current length of the file, the file will be extended with zeroes.
-  // The callback can be null.
-  // This returns false if task posting to |task_runner| has failed.
-  static bool Truncate(
-      TaskRunner* task_runner,
-      PlatformFile file,
-      int64 length,
-      const StatusCallback& callback);
-
-  // Truncates a file to the given length. If |length| is greater than the
-  // current length of the file, the file will be extended with zeroes.
-  // The callback can be null.
-  // This returns false if task posting to |task_runner| has failed.
-  static bool Truncate(
-      TaskRunner* task_runner,
-      const FilePath& path,
-      int64 length,
-      const StatusCallback& callback);
-
-  // Flushes a file. The callback can be null.
-  // This returns false if task posting to |task_runner| has failed.
-  static bool Flush(
-      TaskRunner* task_runner,
-      PlatformFile file,
-      const StatusCallback& callback);
-
-  // Relay helpers.
-  // They return false if posting a given task to |task_runner| has failed.
-  static bool RelayCreateOrOpen(
-      TaskRunner* task_runner,
-      const CreateOrOpenTask& open_task,
-      const CloseTask& close_task,
-      const CreateOrOpenCallback& callback);
-  static bool RelayClose(
-      TaskRunner* task_runner,
-      const CloseTask& close_task,
-      PlatformFile,
-      const StatusCallback& callback);
-
  private:
   DISALLOW_IMPLICIT_CONSTRUCTORS(FileUtilProxy);
 };
diff --git a/base/files/file_util_proxy_unittest.cc b/base/files/file_util_proxy_unittest.cc
index 4fa6890..52073ae 100644
--- a/base/files/file_util_proxy_unittest.cc
+++ b/base/files/file_util_proxy_unittest.cc
@@ -4,15 +4,11 @@
 
 #include "base/files/file_util_proxy.h"
 
-#include <map>
-
 #include "base/bind.h"
 #include "base/file_util.h"
 #include "base/files/scoped_temp_dir.h"
-#include "base/logging.h"
 #include "base/memory/weak_ptr.h"
 #include "base/message_loop/message_loop.h"
-#include "base/platform_file.h"
 #include "base/threading/thread.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
@@ -24,7 +20,6 @@
       : file_thread_("FileUtilProxyTestFileThread"),
         error_(File::FILE_OK),
         created_(false),
-        file_(kInvalidPlatformFileValue),
         bytes_written_(-1),
         weak_factory_(this) {}
 
@@ -33,34 +28,11 @@
     ASSERT_TRUE(file_thread_.Start());
   }
 
-  virtual void TearDown() OVERRIDE {
-    if (file_ != kInvalidPlatformFileValue)
-      ClosePlatformFile(file_);
-  }
-
   void DidFinish(File::Error error) {
     error_ = error;
     MessageLoop::current()->QuitWhenIdle();
   }
 
-  void DidCreateOrOpen(File::Error error,
-                       PassPlatformFile file,
-                       bool created) {
-    error_ = error;
-    file_ = file.ReleaseValue();
-    created_ = created;
-    MessageLoop::current()->QuitWhenIdle();
-  }
-
-  void DidCreateTemporary(File::Error error,
-                          PassPlatformFile file,
-                          const FilePath& path) {
-    error_ = error;
-    file_ = file.ReleaseValue();
-    path_ = path;
-    MessageLoop::current()->QuitWhenIdle();
-  }
-
   void DidGetFileInfo(File::Error error,
                       const File::Info& file_info) {
     error_ = error;
@@ -68,33 +40,7 @@
     MessageLoop::current()->QuitWhenIdle();
   }
 
-  void DidRead(File::Error error,
-               const char* data,
-               int bytes_read) {
-    error_ = error;
-    buffer_.resize(bytes_read);
-    memcpy(&buffer_[0], data, bytes_read);
-    MessageLoop::current()->QuitWhenIdle();
-  }
-
-  void DidWrite(File::Error error,
-                int bytes_written) {
-    error_ = error;
-    bytes_written_ = bytes_written;
-    MessageLoop::current()->QuitWhenIdle();
-  }
-
  protected:
-  PlatformFile GetTestPlatformFile(int flags) {
-    if (file_ != kInvalidPlatformFileValue)
-      return file_;
-
-    File file(test_path(), flags);
-    EXPECT_TRUE(file.IsValid());
-    file_ = file.TakePlatformFile();
-    return file_;
-  }
-
   TaskRunner* file_task_runner() const {
     return file_thread_.message_loop_proxy().get();
   }
@@ -107,7 +53,6 @@
   ScopedTempDir dir_;
   File::Error error_;
   bool created_;
-  PlatformFile file_;
   FilePath path_;
   File::Info file_info_;
   std::vector<char> buffer_;
@@ -115,110 +60,6 @@
   WeakPtrFactory<FileUtilProxyTest> weak_factory_;
 };
 
-TEST_F(FileUtilProxyTest, CreateOrOpen_Create) {
-  FileUtilProxy::CreateOrOpen(
-      file_task_runner(),
-      test_path(),
-      PLATFORM_FILE_CREATE | PLATFORM_FILE_READ,
-      Bind(&FileUtilProxyTest::DidCreateOrOpen, weak_factory_.GetWeakPtr()));
-  MessageLoop::current()->Run();
-
-  EXPECT_EQ(File::FILE_OK, error_);
-  EXPECT_TRUE(created_);
-  EXPECT_NE(kInvalidPlatformFileValue, file_);
-  EXPECT_TRUE(PathExists(test_path()));
-}
-
-TEST_F(FileUtilProxyTest, CreateOrOpen_Open) {
-  // Creates a file.
-  WriteFile(test_path(), NULL, 0);
-  ASSERT_TRUE(PathExists(test_path()));
-
-  // Opens the created file.
-  FileUtilProxy::CreateOrOpen(
-      file_task_runner(),
-      test_path(),
-      PLATFORM_FILE_OPEN | PLATFORM_FILE_READ,
-      Bind(&FileUtilProxyTest::DidCreateOrOpen, weak_factory_.GetWeakPtr()));
-  MessageLoop::current()->Run();
-
-  EXPECT_EQ(File::FILE_OK, error_);
-  EXPECT_FALSE(created_);
-  EXPECT_NE(kInvalidPlatformFileValue, file_);
-}
-
-TEST_F(FileUtilProxyTest, CreateOrOpen_OpenNonExistent) {
-  FileUtilProxy::CreateOrOpen(
-      file_task_runner(),
-      test_path(),
-      PLATFORM_FILE_OPEN | PLATFORM_FILE_READ,
-      Bind(&FileUtilProxyTest::DidCreateOrOpen, weak_factory_.GetWeakPtr()));
-  MessageLoop::current()->Run();
-  EXPECT_EQ(File::FILE_ERROR_NOT_FOUND, error_);
-  EXPECT_FALSE(created_);
-  EXPECT_EQ(kInvalidPlatformFileValue, file_);
-  EXPECT_FALSE(PathExists(test_path()));
-}
-
-TEST_F(FileUtilProxyTest, Close) {
-  // Creates a file.
-  PlatformFile file = GetTestPlatformFile(
-      PLATFORM_FILE_CREATE | PLATFORM_FILE_WRITE);
-
-#if defined(OS_WIN)
-  // This fails on Windows if the file is not closed.
-  EXPECT_FALSE(base::Move(test_path(),
-                               test_dir_path().AppendASCII("new")));
-#endif
-
-  FileUtilProxy::Close(
-      file_task_runner(),
-      file,
-      Bind(&FileUtilProxyTest::DidFinish, weak_factory_.GetWeakPtr()));
-  MessageLoop::current()->Run();
-  EXPECT_EQ(File::FILE_OK, error_);
-
-  // Now it should pass on all platforms.
-  EXPECT_TRUE(base::Move(test_path(), test_dir_path().AppendASCII("new")));
-}
-
-TEST_F(FileUtilProxyTest, CreateTemporary) {
-  FileUtilProxy::CreateTemporary(
-      file_task_runner(), 0 /* additional_file_flags */,
-      Bind(&FileUtilProxyTest::DidCreateTemporary, weak_factory_.GetWeakPtr()));
-  MessageLoop::current()->Run();
-  EXPECT_EQ(File::FILE_OK, error_);
-  EXPECT_TRUE(PathExists(path_));
-  EXPECT_NE(kInvalidPlatformFileValue, file_);
-
-  // The file should be writable.
-#if defined(OS_WIN)
-  HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
-  OVERLAPPED overlapped = {0};
-  overlapped.hEvent = hEvent;
-  DWORD bytes_written;
-  if (!::WriteFile(file_, "test", 4, &bytes_written, &overlapped)) {
-    // Temporary file is created with ASYNC flag, so WriteFile may return 0
-    // with ERROR_IO_PENDING.
-    EXPECT_EQ(ERROR_IO_PENDING, GetLastError());
-    GetOverlappedResult(file_, &overlapped, &bytes_written, TRUE);
-  }
-  EXPECT_EQ(4, bytes_written);
-#else
-  // On POSIX ASYNC flag does not affect synchronous read/write behavior.
-  EXPECT_EQ(4, WritePlatformFile(file_, 0, "test", 4));
-#endif
-  EXPECT_TRUE(ClosePlatformFile(file_));
-  file_ = kInvalidPlatformFileValue;
-
-  // Make sure the written data can be read from the returned path.
-  std::string data;
-  EXPECT_TRUE(ReadFileToString(path_, &data));
-  EXPECT_EQ("test", data);
-
-  // Make sure we can & do delete the created file to prevent leaks on the bots.
-  EXPECT_TRUE(base::DeleteFile(path_, false));
-}
 
 TEST_F(FileUtilProxyTest, GetFileInfo_File) {
   // Setup.
@@ -266,73 +107,14 @@
   EXPECT_EQ(expected_info.creation_time, file_info_.creation_time);
 }
 
-TEST_F(FileUtilProxyTest, Read) {
-  // Setup.
-  const char expected_data[] = "bleh";
-  int expected_bytes = arraysize(expected_data);
-  ASSERT_EQ(expected_bytes,
-            WriteFile(test_path(), expected_data, expected_bytes));
-
-  // Run.
-  FileUtilProxy::Read(
-      file_task_runner(),
-      GetTestPlatformFile(PLATFORM_FILE_OPEN | PLATFORM_FILE_READ),
-      0,  // offset
-      128,
-      Bind(&FileUtilProxyTest::DidRead, weak_factory_.GetWeakPtr()));
-  MessageLoop::current()->Run();
-
-  // Verify.
-  EXPECT_EQ(File::FILE_OK, error_);
-  EXPECT_EQ(expected_bytes, static_cast<int>(buffer_.size()));
-  for (size_t i = 0; i < buffer_.size(); ++i) {
-    EXPECT_EQ(expected_data[i], buffer_[i]);
-  }
-}
-
-TEST_F(FileUtilProxyTest, WriteAndFlush) {
-  const char data[] = "foo!";
-  int data_bytes = ARRAYSIZE_UNSAFE(data);
-  PlatformFile file = GetTestPlatformFile(
-      PLATFORM_FILE_CREATE | PLATFORM_FILE_WRITE);
-
-  FileUtilProxy::Write(
-      file_task_runner(),
-      file,
-      0,  // offset
-      data,
-      data_bytes,
-      Bind(&FileUtilProxyTest::DidWrite, weak_factory_.GetWeakPtr()));
-  MessageLoop::current()->Run();
-  EXPECT_EQ(File::FILE_OK, error_);
-  EXPECT_EQ(data_bytes, bytes_written_);
-
-  // Flush the written data.  (So that the following read should always
-  // succeed.  On some platforms it may work with or without this flush.)
-  FileUtilProxy::Flush(
-      file_task_runner(),
-      file,
-      Bind(&FileUtilProxyTest::DidFinish, weak_factory_.GetWeakPtr()));
-  MessageLoop::current()->Run();
-  EXPECT_EQ(File::FILE_OK, error_);
-
-  // Verify the written data.
-  char buffer[10];
-  EXPECT_EQ(data_bytes, base::ReadFile(test_path(), buffer, data_bytes));
-  for (int i = 0; i < data_bytes; ++i) {
-    EXPECT_EQ(data[i], buffer[i]);
-  }
-}
-
 TEST_F(FileUtilProxyTest, Touch) {
+  ASSERT_EQ(4, WriteFile(test_path(), "test", 4));
   Time last_accessed_time = Time::Now() - TimeDelta::FromDays(12345);
   Time last_modified_time = Time::Now() - TimeDelta::FromHours(98765);
 
   FileUtilProxy::Touch(
       file_task_runner(),
-      GetTestPlatformFile(PLATFORM_FILE_CREATE |
-                          PLATFORM_FILE_WRITE |
-                          PLATFORM_FILE_WRITE_ATTRIBUTES),
+      test_path(),
       last_accessed_time,
       last_modified_time,
       Bind(&FileUtilProxyTest::DidFinish, weak_factory_.GetWeakPtr()));
@@ -350,60 +132,4 @@
             static_cast<int>(info.last_accessed.ToDoubleT()));
 }
 
-TEST_F(FileUtilProxyTest, Truncate_Shrink) {
-  // Setup.
-  const char kTestData[] = "0123456789";
-  ASSERT_EQ(10, WriteFile(test_path(), kTestData, 10));
-  File::Info info;
-  GetFileInfo(test_path(), &info);
-  ASSERT_EQ(10, info.size);
-
-  // Run.
-  FileUtilProxy::Truncate(
-      file_task_runner(),
-      GetTestPlatformFile(PLATFORM_FILE_OPEN | PLATFORM_FILE_WRITE),
-      7,
-      Bind(&FileUtilProxyTest::DidFinish, weak_factory_.GetWeakPtr()));
-  MessageLoop::current()->Run();
-
-  // Verify.
-  GetFileInfo(test_path(), &info);
-  ASSERT_EQ(7, info.size);
-
-  char buffer[7];
-  EXPECT_EQ(7, base::ReadFile(test_path(), buffer, 7));
-  int i = 0;
-  for (; i < 7; ++i)
-    EXPECT_EQ(kTestData[i], buffer[i]);
-}
-
-TEST_F(FileUtilProxyTest, Truncate_Expand) {
-  // Setup.
-  const char kTestData[] = "9876543210";
-  ASSERT_EQ(10, WriteFile(test_path(), kTestData, 10));
-  File::Info info;
-  GetFileInfo(test_path(), &info);
-  ASSERT_EQ(10, info.size);
-
-  // Run.
-  FileUtilProxy::Truncate(
-      file_task_runner(),
-      GetTestPlatformFile(PLATFORM_FILE_OPEN | PLATFORM_FILE_WRITE),
-      53,
-      Bind(&FileUtilProxyTest::DidFinish, weak_factory_.GetWeakPtr()));
-  MessageLoop::current()->Run();
-
-  // Verify.
-  GetFileInfo(test_path(), &info);
-  ASSERT_EQ(53, info.size);
-
-  char buffer[53];
-  EXPECT_EQ(53, base::ReadFile(test_path(), buffer, 53));
-  int i = 0;
-  for (; i < 10; ++i)
-    EXPECT_EQ(kTestData[i], buffer[i]);
-  for (; i < 53; ++i)
-    EXPECT_EQ(0, buffer[i]);
-}
-
 }  // namespace base