X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fchrome%2Fbrowser%2Fchromeos%2Fdrive%2Ffile_system%2Fcreate_file_operation_unittest.cc;h=fb12665191ed1630987bfe568640a42bae22376c;hb=4a1a0bdd01eef90b0826a0e761d3379d3715c10f;hp=12257df34b623d10c6870d1925ec6ad39109bbb2;hpb=b1be5ca53587d23e7aeb77b26861fdc0a181ffd8;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/chrome/browser/chromeos/drive/file_system/create_file_operation_unittest.cc b/src/chrome/browser/chromeos/drive/file_system/create_file_operation_unittest.cc index 12257df..fb12665 100644 --- a/src/chrome/browser/chromeos/drive/file_system/create_file_operation_unittest.cc +++ b/src/chrome/browser/chromeos/drive/file_system/create_file_operation_unittest.cc @@ -4,7 +4,9 @@ #include "chrome/browser/chromeos/drive/file_system/create_file_operation.h" +#include "chrome/browser/chromeos/drive/file_change.h" #include "chrome/browser/chromeos/drive/file_system/operation_test_base.h" +#include "content/public/test/test_utils.h" #include "google_apis/drive/test_util.h" #include "testing/gtest/include/gtest/gtest.h" @@ -15,7 +17,7 @@ typedef OperationTestBase CreateFileOperationTest; TEST_F(CreateFileOperationTest, CreateFile) { CreateFileOperation operation(blocking_task_runner(), - observer(), + delegate(), metadata()); const base::FilePath kFilePath(FILE_PATH_LITERAL("drive/root/New File.txt")); @@ -25,7 +27,7 @@ TEST_F(CreateFileOperationTest, CreateFile) { true, // is_exclusive std::string(), // no predetermined mime type google_apis::test_util::CreateCopyResultCallback(&error)); - test_util::RunBlockingPoolTask(); + content::RunAllBlockingPoolTasksUntilIdle(); EXPECT_EQ(FILE_ERROR_OK, error); ResourceEntry entry; @@ -36,15 +38,15 @@ TEST_F(CreateFileOperationTest, CreateFile) { EXPECT_FALSE(base::Time::FromInternalValue( entry.file_info().last_accessed()).is_null()); - EXPECT_EQ(1u, observer()->get_changed_paths().size()); - EXPECT_EQ(1u, observer()->get_changed_paths().count(kFilePath.DirName())); - EXPECT_EQ(1u, observer()->updated_local_ids().size()); - EXPECT_EQ(1u, observer()->updated_local_ids().count(entry.local_id())); + EXPECT_EQ(1u, delegate()->get_changed_files().size()); + EXPECT_EQ(1u, delegate()->get_changed_files().count(kFilePath)); + EXPECT_EQ(1u, delegate()->updated_local_ids().size()); + EXPECT_EQ(1u, delegate()->updated_local_ids().count(entry.local_id())); } TEST_F(CreateFileOperationTest, CreateFileIsExclusive) { CreateFileOperation operation(blocking_task_runner(), - observer(), + delegate(), metadata()); const base::FilePath kExistingFile( @@ -63,7 +65,7 @@ TEST_F(CreateFileOperationTest, CreateFileIsExclusive) { true, // is_exclusive std::string(), // no predetermined mime type google_apis::test_util::CreateCopyResultCallback(&error)); - test_util::RunBlockingPoolTask(); + content::RunAllBlockingPoolTasksUntilIdle(); EXPECT_EQ(FILE_ERROR_EXISTS, error); // Create succeeds if is_exclusive = false and a file exists. @@ -72,7 +74,7 @@ TEST_F(CreateFileOperationTest, CreateFileIsExclusive) { false, // is_exclusive std::string(), // no predetermined mime type google_apis::test_util::CreateCopyResultCallback(&error)); - test_util::RunBlockingPoolTask(); + content::RunAllBlockingPoolTasksUntilIdle(); EXPECT_EQ(FILE_ERROR_OK, error); // Create fails if a directory existed even when is_exclusive = false. @@ -81,7 +83,7 @@ TEST_F(CreateFileOperationTest, CreateFileIsExclusive) { false, // is_exclusive std::string(), // no predetermined mime type google_apis::test_util::CreateCopyResultCallback(&error)); - test_util::RunBlockingPoolTask(); + content::RunAllBlockingPoolTasksUntilIdle(); EXPECT_EQ(FILE_ERROR_EXISTS, error); // Create succeeds if no entry exists. @@ -90,7 +92,7 @@ TEST_F(CreateFileOperationTest, CreateFileIsExclusive) { true, // is_exclusive std::string(), // no predetermined mime type google_apis::test_util::CreateCopyResultCallback(&error)); - test_util::RunBlockingPoolTask(); + content::RunAllBlockingPoolTasksUntilIdle(); EXPECT_EQ(FILE_ERROR_OK, error); // Create fails if the parent directory does not exist. @@ -99,13 +101,13 @@ TEST_F(CreateFileOperationTest, CreateFileIsExclusive) { false, // is_exclusive std::string(), // no predetermined mime type google_apis::test_util::CreateCopyResultCallback(&error)); - test_util::RunBlockingPoolTask(); + content::RunAllBlockingPoolTasksUntilIdle(); EXPECT_EQ(FILE_ERROR_NOT_A_DIRECTORY, error); } TEST_F(CreateFileOperationTest, CreateFileMimeType) { CreateFileOperation operation(blocking_task_runner(), - observer(), + delegate(), metadata()); const base::FilePath kPng1(FILE_PATH_LITERAL("drive/root/1.png")); @@ -119,7 +121,7 @@ TEST_F(CreateFileOperationTest, CreateFileMimeType) { false, // is_exclusive std::string(), // no predetermined mime type google_apis::test_util::CreateCopyResultCallback(&error)); - test_util::RunBlockingPoolTask(); + content::RunAllBlockingPoolTasksUntilIdle(); EXPECT_EQ(FILE_ERROR_OK, error); // If no mime type is specified, it is guessed from the file name. @@ -133,7 +135,7 @@ TEST_F(CreateFileOperationTest, CreateFileMimeType) { false, // is_exclusive kSpecialMimeType, google_apis::test_util::CreateCopyResultCallback(&error)); - test_util::RunBlockingPoolTask(); + content::RunAllBlockingPoolTasksUntilIdle(); EXPECT_EQ(FILE_ERROR_OK, error); // If the mime type is explicitly set, respect it. @@ -146,7 +148,7 @@ TEST_F(CreateFileOperationTest, CreateFileMimeType) { false, // is_exclusive std::string(), // no predetermined mime type google_apis::test_util::CreateCopyResultCallback(&error)); - test_util::RunBlockingPoolTask(); + content::RunAllBlockingPoolTasksUntilIdle(); EXPECT_EQ(FILE_ERROR_OK, error); // If the mime type is not set and unknown, default to octet-stream.