Index: chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc |
diff --git a/chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc b/chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc |
index 5267ca4abab391a6dbdeebb680b74642b912f43e..7651e69aad5f1391eb5e26b6c7d4e0adf2db73ef 100644 |
--- a/chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc |
+++ b/chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc |
@@ -190,6 +190,14 @@ class GDataFileSystemTest : public testing::Test { |
return search_delegate.file(); |
} |
+ GDataFileBase* FindFileElementByResourceId(const std::string& resource_id) { |
+ ReadOnlyFindFileDelegate search_delegate; |
+ file_system_->FindFileByPathSync(FilePath(FILE_PATH_LITERAL("gdata")), |
+ &search_delegate); |
+ return search_delegate.file()->AsGDataRootDirectory()->GetFileByResourceId( |
+ resource_id); |
+ } |
+ |
void FindAndTestFilePath(const FilePath& file_path) { |
GDataFileBase* file = FindFile(file_path); |
ASSERT_TRUE(file) << "File can't be found " << file_path.value(); |
@@ -929,6 +937,14 @@ TEST_F(GDataFileSystemTest, CachedFeedLoading) { |
FindAndTestFilePath( |
FilePath(FILE_PATH_LITERAL( |
"gdata/Directory 1/Sub Directory Folder/Feed 2 Directory"))); |
+ |
+ // Make sure orphaned files didn't make into the file system. |
+ ASSERT_FALSE(FindFileElementByResourceId( |
+ "file:orphan_file_resource_id")); |
+ ASSERT_FALSE(FindFileElementByResourceId( |
+ "folder:orphan_feed_folder_resouce_id")); |
+ ASSERT_FALSE(FindFileElementByResourceId( |
+ "file:orphan_subfolder_file_resource_id")); |
} |
TEST_F(GDataFileSystemTest, CopyNotExistingFile) { |