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 2f370649b4dcdab72c395ac3ea22493cc8a5c857..8f4d229551b068cfd0aca4c3b1f4d062f6e908fb 100644 |
--- a/chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc |
+++ b/chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc |
@@ -192,6 +192,14 @@ class GDataFileSystemTest : public testing::Test { |
return search_delegate.file(); |
} |
+ GDataFileBase* FindFileByResourceId(const std::string& resource_id) { |
+ ReadOnlyFindFileDelegate search_delegate; |
+ file_system_->FindFileByPathSync(FilePath(FILE_PATH_LITERAL("gdata")), |
+ &search_delegate); |
+ return search_delegate.file()->AsGDataRootDirectory()->GetFileByResource( |
+ resource_id); |
+ } |
+ |
void FindAndTestFilePath(const FilePath& file_path) { |
GDataFileBase* file = FindFile(file_path); |
ASSERT_TRUE(file) << "File can't be found " << file_path.value(); |
@@ -926,6 +934,11 @@ 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(FindFileByResourceId("file:orphan_file_resource_id")); |
+ ASSERT_FALSE(FindFileByResourceId("folder:orphan_feed_folder_resouce_id")); |
+ ASSERT_FALSE(FindFileByResourceId("file:orphan_subfolder_file_resource_id")); |
} |
TEST_F(GDataFileSystemTest, CopyNotExistingFile) { |