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

Unified Diff: chrome/browser/chromeos/drive/drive_file_system_unittest.cc

Issue 14348016: chromeos: Add DriveFileSystem::Pin/Unpin (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use GetEntryInfoByPathSync Created 7 years, 8 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/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..25d85e854fcc1ce80b335db54e0a4e4c7af6270b 100644
--- a/chrome/browser/chromeos/drive/drive_file_system_unittest.cc
+++ b/chrome/browser/chromeos/drive/drive_file_system_unittest.cc
@@ -1531,6 +1531,36 @@ 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.
+ scoped_ptr<DriveEntryProto> entry(GetEntryInfoByPathSync(file_path));
+ ASSERT_TRUE(entry);
+
+ // Pin the file.
+ DriveFileError 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());
« no previous file with comments | « chrome/browser/chromeos/drive/drive_file_system_interface.h ('k') | chrome/browser/chromeos/drive/fake_drive_file_system.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698