drive: Use OperationTestBase from CreateDirectoryOperationTest

Replace FileSystemTest.CreateDirectory with CreateDirectoryOperationTest.CreateDirectory.
FileSystemTest.CreateDirectoryByImplicitLoad is left unchanged because it's testing that LoadIfNeeded is called by FileSystem::CreateDirectory.

BUG=244168
TEST=unit_tests
R=kinaba@chromium.org

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202516 0039d316-1c4b-4281-b951-d872f2087c98
parent d5fd4c05
......@@ -58,17 +58,16 @@ class CreateDirectoryOperation {
bool is_recursive,
const FileOperationCallback& callback);
private:
// Returns the file path to the existing deepest directory, which appears
// in the |file_path|, with |entry| storing the directory's resource entry.
// If not found, returns an empty file path.
// This should run on |blocking_task_runner_|.
// This is public for testing.
static base::FilePath GetExistingDeepestDirectory(
internal::ResourceMetadata* metadata,
const base::FilePath& directory_path,
ResourceEntry* entry);
private:
// Part of CreateDirectory(). Called after GetExistingDeepestDirectory
// is completed.
void CreateDirectoryAfterGetExistingDeepestDirectory(
......
......@@ -161,16 +161,6 @@ class FileSystemTest : public testing::Test {
return true;
}
FileError AddDirectory(const base::FilePath& directory_path) {
FileError error = FILE_ERROR_FAILED;
file_system_->CreateDirectory(
directory_path,
false, // is_exclusive
false, // is_recursive
google_apis::test_util::CreateCopyResultCallback(&error));
google_apis::test_util::RunBlockingPoolTask();
return error;
}
// Gets resource entry by path synchronously.
scoped_ptr<ResourceEntry> GetResourceEntryByPathSync(
......@@ -1127,30 +1117,6 @@ TEST_F(FileSystemTest, CopyFileToInvalidPath) {
EXPECT_FALSE(EntryExists(dest_file_path));
}
TEST_F(FileSystemTest, CreateDirectory) {
ASSERT_TRUE(LoadRootFeedDocument());
EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged(
Eq(base::FilePath(FILE_PATH_LITERAL("drive/root"))))).Times(1);
// Create directory in root.
base::FilePath dir_path(FILE_PATH_LITERAL("drive/root/New Folder 1"));
EXPECT_FALSE(EntryExists(dir_path));
EXPECT_EQ(FILE_ERROR_OK, AddDirectory(dir_path));
EXPECT_TRUE(EntryExists(dir_path));
EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged(
Eq(base::FilePath(FILE_PATH_LITERAL("drive/root/New Folder 1")))))
.Times(1);
// Create directory in a sub directory.
base::FilePath subdir_path(
FILE_PATH_LITERAL("drive/root/New Folder 1/New Folder 2"));
EXPECT_FALSE(EntryExists(subdir_path));
EXPECT_EQ(FILE_ERROR_OK, AddDirectory(subdir_path));
EXPECT_TRUE(EntryExists(subdir_path));
}
TEST_F(FileSystemTest, CreateDirectoryByImplicitLoad) {
// Intentionally *not* calling LoadRootFeedDocument(), for testing that
// CreateDirectory ensures feed loading before it runs.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment