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

Unified Diff: ui/file_manager/file_manager/background/js/media_scanner_unittest.js

Issue 865343002: Files.app: Invalidate ScanResult when the scanned directory is changed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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: ui/file_manager/file_manager/background/js/media_scanner_unittest.js
diff --git a/ui/file_manager/file_manager/background/js/media_scanner_unittest.js b/ui/file_manager/file_manager/background/js/media_scanner_unittest.js
index fbe3df09e7237ea41302660c32964a78a38a61c5..77fe1c1dfca5f42631d57cbf24a1d0783029b20f 100644
--- a/ui/file_manager/file_manager/background/js/media_scanner_unittest.js
+++ b/ui/file_manager/file_manager/background/js/media_scanner_unittest.js
@@ -17,6 +17,9 @@ var scanner;
/** @type {!importer.TestImportHistory} */
var importHistory;
+/** @type {!importer.TestDirectoryWatcher} */
+var watcher;
+
// Set up the test components.
function setUp() {
@@ -26,7 +29,11 @@ function setUp() {
function(entry) {
return Promise.resolve(entry.name);
},
- importHistory);
+ importHistory,
+ function(callback) {
+ watcher = new TestDirectoryWatcher(callback);
+ return watcher;
+ });
}
/**
@@ -311,6 +318,25 @@ function testDedupesFiles(callback) {
callback);
}
+function testInvalidation(callback) {
+ var invalidatePromise = new Promise(function(fulfill) {
+ scanner.addObserver(fulfill);
+ });
+ reportPromise(
+ makeTestFileSystemRoot('testInvalidation')
+ .then(populateDir.bind(null, ['DCIM']))
+ .then(
+ /**
+ * Scans the directories.
+ * @param {!DirectoryEntry} root
+ */
+ function(root) {
+ scan = scanner.scan([root]);
+ watcher.callback();
+ return invalidatePromise;
+ }),
+ callback);
+}
/**
* Verifies the results of the media scan are as expected.

Powered by Google App Engine
This is Rietveld 408576698