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

Unified Diff: chrome/browser/media_galleries/media_scan_manager_unittest.cc

Issue 167863002: Update media galleries scan results, even when zero. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix up test Created 6 years, 10 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
« no previous file with comments | « chrome/browser/media_galleries/media_scan_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/media_galleries/media_scan_manager_unittest.cc
diff --git a/chrome/browser/media_galleries/media_scan_manager_unittest.cc b/chrome/browser/media_galleries/media_scan_manager_unittest.cc
index 92c74805c68ca812e2529e6b2dddc1af790f3fa5..232ee3b36eeb1b64e8508f0a379451e3fbcd7e31 100644
--- a/chrome/browser/media_galleries/media_scan_manager_unittest.cc
+++ b/chrome/browser/media_galleries/media_scan_manager_unittest.cc
@@ -384,8 +384,8 @@ TEST_F(MediaScanManagerTest, UpdateExistingScanResults) {
true);
EXPECT_EQ(galleries_before + 2, gallery_prefs()->known_galleries().size());
- // Run once with no scan results. "uscan" should go away, but "gscan" should
- // be unaffected.
+ // Run once with no scan results. "uscan" should go away and "gscan" should
+ // have its scan counts updated.
MediaFolderFinder::MediaFolderFinderResults found_folders;
SetFindFoldersResults(true, found_folders);
@@ -396,7 +396,7 @@ TEST_F(MediaScanManagerTest, UpdateExistingScanResults) {
base::RunLoop().RunUntilIdle();
EXPECT_EQ(1, FindFolderDestroyCount());
EXPECT_EQ(galleries_before + 1, gallery_prefs()->known_galleries().size());
- CheckFileCounts(granted_scan, 0, 2, 0);
+ CheckFileCounts(granted_scan, 0, 0, 0);
MediaGalleryPrefId id =
AddGallery("uscan", MediaGalleryPrefInfo::kScanResult, 1, 1, 1);
@@ -449,14 +449,14 @@ TEST_F(MediaScanManagerTest, UpdateExistingCounts) {
base::FilePath path = MakeTestFolder("auto/dir1");
found_folders[path] = file_counts;
- file_counts.audio_count = 5;
- path = MakeTestFolder("user/dir2");
- found_folders[path] = file_counts;
-
file_counts.audio_count = 6;
path = MakeTestFolder("scan");
found_folders[path] = file_counts;
+ file_counts.audio_count = 5;
+ path = MakeTestFolder("user/dir2");
+ found_folders[path] = file_counts;
+
SetFindFoldersResults(true, found_folders);
file_counts.audio_count = 0;
@@ -469,4 +469,16 @@ TEST_F(MediaScanManagerTest, UpdateExistingCounts) {
CheckFileCounts(auto_id, 4, 0, 0);
CheckFileCounts(user_id, 5, 0, 0);
CheckFileCounts(scan_id, 6, 0, 0);
+
+ EXPECT_EQ(1U, found_folders.erase(path));
+ SetFindFoldersResults(true, found_folders);
+ SetExpectedScanResults(0 /*gallery_count*/, file_counts);
+ StartScan();
+
+ base::RunLoop().RunUntilIdle();
+ EXPECT_EQ(2, FindFolderDestroyCount());
+ EXPECT_EQ(galleries_before + 3, gallery_prefs()->known_galleries().size());
+ CheckFileCounts(auto_id, 4, 0, 0);
+ CheckFileCounts(user_id, 0, 0, 0);
+ CheckFileCounts(scan_id, 6, 0, 0);
}
« no previous file with comments | « chrome/browser/media_galleries/media_scan_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698