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

Unified Diff: chrome/browser/chromeos/drive/file_system/create_file_operation_unittest.cc

Issue 137423010: drive: Support offline file creation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 11 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
Index: chrome/browser/chromeos/drive/file_system/create_file_operation_unittest.cc
diff --git a/chrome/browser/chromeos/drive/file_system/create_file_operation_unittest.cc b/chrome/browser/chromeos/drive/file_system/create_file_operation_unittest.cc
index 05e51a9d0b28cdc7c967b0c7d2372b9221c9df47..12257df34b623d10c6870d1925ec6ad39109bbb2 100644
--- a/chrome/browser/chromeos/drive/file_system/create_file_operation_unittest.cc
+++ b/chrome/browser/chromeos/drive/file_system/create_file_operation_unittest.cc
@@ -16,9 +16,36 @@ typedef OperationTestBase CreateFileOperationTest;
TEST_F(CreateFileOperationTest, CreateFile) {
CreateFileOperation operation(blocking_task_runner(),
observer(),
- scheduler(),
- metadata(),
- cache());
+ metadata());
+
+ const base::FilePath kFilePath(FILE_PATH_LITERAL("drive/root/New File.txt"));
+ FileError error = FILE_ERROR_FAILED;
+ operation.CreateFile(
+ kFilePath,
+ true, // is_exclusive
+ std::string(), // no predetermined mime type
+ google_apis::test_util::CreateCopyResultCallback(&error));
+ test_util::RunBlockingPoolTask();
+ EXPECT_EQ(FILE_ERROR_OK, error);
+
+ ResourceEntry entry;
+ EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(kFilePath, &entry));
+ EXPECT_EQ(ResourceEntry::DIRTY, entry.metadata_edit_state());
+ EXPECT_FALSE(base::Time::FromInternalValue(
+ entry.file_info().last_modified()).is_null());
+ 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()));
+}
+
+TEST_F(CreateFileOperationTest, CreateFileIsExclusive) {
+ CreateFileOperation operation(blocking_task_runner(),
+ observer(),
+ metadata());
const base::FilePath kExistingFile(
FILE_PATH_LITERAL("drive/root/File 1.txt"));
@@ -79,9 +106,7 @@ TEST_F(CreateFileOperationTest, CreateFile) {
TEST_F(CreateFileOperationTest, CreateFileMimeType) {
CreateFileOperation operation(blocking_task_runner(),
observer(),
- scheduler(),
- metadata(),
- cache());
+ metadata());
const base::FilePath kPng1(FILE_PATH_LITERAL("drive/root/1.png"));
const base::FilePath kPng2(FILE_PATH_LITERAL("drive/root/2.png"));
@@ -130,6 +155,5 @@ TEST_F(CreateFileOperationTest, CreateFileMimeType) {
entry.file_specific_info().content_mime_type());
}
-
} // namespace file_system
} // namespace drive

Powered by Google App Engine
This is Rietveld 408576698