Chromium Code Reviews| Index: chrome/browser/chromeos/drive/drive_file_system_unittest.cc |
| diff --git a/chrome/browser/chromeos/drive/drive_file_system_unittest.cc b/chrome/browser/chromeos/drive/drive_file_system_unittest.cc |
| index c711edd181bc0e44c65601c58b56c442734c387b..3c0622caaa33dd6280bd5d66dd3abd0dc02500d6 100644 |
| --- a/chrome/browser/chromeos/drive/drive_file_system_unittest.cc |
| +++ b/chrome/browser/chromeos/drive/drive_file_system_unittest.cc |
| @@ -1531,6 +1531,42 @@ TEST_F(DriveFileSystemTest, CreateDirectoryWithService) { |
| EXPECT_EQ(DRIVE_FILE_OK, error); |
| } |
| +TEST_F(DriveFileSystemTest, PinAndUnpin) { |
| + ASSERT_TRUE(LoadRootFeedDocument()); |
| + |
| + base::FilePath file_path(FILE_PATH_LITERAL("drive/root/File 1.txt")); |
| + |
| + // Get the file info. |
| + DriveFileError error = DRIVE_FILE_ERROR_FAILED; |
| + scoped_ptr<DriveEntryProto> entry; |
|
hidehiko
2013/04/19 08:56:28
nit: GetEntryInfoByPathSync should work here?
hashimoto
2013/04/19 10:34:47
Done.
|
| + file_system_->GetEntryInfoByPath( |
| + file_path, |
| + google_apis::test_util::CreateCopyResultCallback(&error, &entry)); |
| + google_apis::test_util::RunBlockingPoolTask(); |
| + EXPECT_EQ(DRIVE_FILE_OK, error); |
| + ASSERT_TRUE(entry); |
| + |
| + // Pin the file. |
| + error = DRIVE_FILE_ERROR_FAILED; |
| + EXPECT_CALL(*mock_cache_observer_, |
| + OnCachePinned(entry->resource_id(), |
| + entry->file_specific_info().file_md5())).Times(1); |
| + file_system_->Pin(file_path, |
| + google_apis::test_util::CreateCopyResultCallback(&error)); |
| + google_apis::test_util::RunBlockingPoolTask(); |
| + EXPECT_EQ(DRIVE_FILE_OK, error); |
| + |
| + // Unpin the file. |
| + error = DRIVE_FILE_ERROR_FAILED; |
| + EXPECT_CALL(*mock_cache_observer_, |
| + OnCacheUnpinned(entry->resource_id(), |
| + entry->file_specific_info().file_md5())).Times(1); |
| + file_system_->Unpin(file_path, |
| + google_apis::test_util::CreateCopyResultCallback(&error)); |
| + google_apis::test_util::RunBlockingPoolTask(); |
| + EXPECT_EQ(DRIVE_FILE_OK, error); |
| +} |
| + |
| TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_EnoughSpace) { |
| ASSERT_TRUE(LoadRootFeedDocument()); |