chrome/browser/chromeos/drive/drive_file_system_unittest.cc
// Test the case where the parent of |dest_file_path| is an existing file,
// not a directory.
Test the case where the parent of |dest_file_path| is an existing file,
not a directory.
Test the case where the parent of |dest_file_path| is an existing file not a directory .
TEST_F(DriveFileSystemTest, CopyFileToInvalidPath) {
  FilePath src_file_path(FILE_PATH_LITERAL("drive/Document 1.gdoc"));
  FilePath dest_parent_path(FILE_PATH_LITERAL("drive/Duplicate Name.txt"));
  FilePath dest_file_path(FILE_PATH_LITERAL(
      "drive/Duplicate Name.txt/Document 1.gdoc"));
  ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json"));
  ASSERT_TRUE(EntryExists(src_file_path));
  scoped_ptr<DriveEntryProto> src_entry_proto = GetEntryInfoByPathSync(
      src_file_path);
  ASSERT_TRUE(src_entry_proto.get());
  std::string src_file_resource_id =
      src_entry_proto->resource_id();
  EXPECT_FALSE(src_entry_proto->edit_url().empty());
  ASSERT_TRUE(EntryExists(dest_parent_path));
  scoped_ptr<DriveEntryProto> dest_entry_proto = GetEntryInfoByPathSync(
      dest_parent_path);
  ASSERT_TRUE(dest_entry_proto.get());
  FileOperationCallback callback =
      base::Bind(&CallbackHelper::FileOperationCallback,
                 callback_helper_.get());
  file_system_->Copy(src_file_path, dest_file_path, callback);
  google_apis::test_util::RunBlockingPoolTask();
  EXPECT_EQ(DRIVE_FILE_ERROR_NOT_A_DIRECTORY,
            callback_helper_->last_error_);
  EXPECT_TRUE(EntryExists(src_file_path));
  EXPECT_TRUE(EntryExists(src_file_path));
  EXPECT_TRUE(EntryExists(dest_parent_path));
  EXPECT_FALSE(EntryExists(dest_file_path));
}
TEST_F ( DriveFileSystemTest , CopyFileToInvalidPath ) { FilePath src_file_path ( FILE_PATH_LITERAL ( " " ) ) ; FilePath dest_parent_path ( FILE_PATH_LITERAL ( " " ) ) ; FilePath dest_file_path ( FILE_PATH_LITERAL ( " " ) ) ; ASSERT_TRUE ( LoadRootFeedDocument ( " " ) ) ; ASSERT_TRUE ( EntryExists ( src_file_path ) ) ; scoped_ptr < DriveEntryProto > src_entry_proto = GetEntryInfoByPathSync ( src_file_path ) ; ASSERT_TRUE ( src_entry_proto . get ( ) ) ; std :: string src_file_resource_id = src_entry_proto -> resource_id ( ) ; EXPECT_FALSE ( src_entry_proto -> edit_url ( ) . empty ( ) ) ; ASSERT_TRUE ( EntryExists ( dest_parent_path ) ) ; scoped_ptr < DriveEntryProto > dest_entry_proto = GetEntryInfoByPathSync ( dest_parent_path ) ; ASSERT_TRUE ( dest_entry_proto . get ( ) ) ; FileOperationCallback callback = base :: Bind ( & CallbackHelper :: FileOperationCallback , callback_helper_ . get ( ) ) ; file_system_ -> Copy ( src_file_path , dest_file_path , callback ) ; google_apis :: test_util :: RunBlockingPoolTask ( ) ; EXPECT_EQ ( DRIVE_FILE_ERROR_NOT_A_DIRECTORY , callback_helper_ -> last_error_ ) ; EXPECT_TRUE ( EntryExists ( src_file_path ) ) ; EXPECT_TRUE ( EntryExists ( src_file_path ) ) ; EXPECT_TRUE ( EntryExists ( dest_parent_path ) ) ; EXPECT_FALSE ( EntryExists ( dest_file_path ) ) ; }
Test the case where the parent of |dest_file_path| is an existing file,
not a directory.
Test the case where the parent of |dest_file_path| is an existing file not a directory .