Index: ui/file_manager/file_manager/background/js/mock_media_scanner.js |
diff --git a/ui/file_manager/file_manager/background/js/mock_media_scanner.js b/ui/file_manager/file_manager/background/js/mock_media_scanner.js |
index 59f21e9e958830536654ea032900a06e3b4f6f19..407c02f886273ed279fa0c4976f368ab1c35574c 100644 |
--- a/ui/file_manager/file_manager/background/js/mock_media_scanner.js |
+++ b/ui/file_manager/file_manager/background/js/mock_media_scanner.js |
@@ -47,11 +47,11 @@ TestMediaScanner.prototype.removeObserver = function(observer) { |
/** @override */ |
TestMediaScanner.prototype.scan = function(entries) { |
- var result = new TestScanResult(this.fileEntries); |
- result.totalBytes = this.totalBytes; |
- result.scanDuration = this.scanDuration; |
- this.scans_.push(result); |
- return result; |
+ var scan = new TestScanResult(this.fileEntries); |
+ scan.totalBytes = this.totalBytes; |
+ scan.scanDuration = this.scanDuration; |
+ this.scans_.push(scan); |
+ return scan; |
}; |
/** |
@@ -62,6 +62,19 @@ TestMediaScanner.prototype.finalizeScans = function() { |
}; |
/** |
+ * Notifies observers that the most recently started scan has been updated. |
+ * @param {!importer.ScanResult} result |
+ */ |
+TestMediaScanner.prototype.update = function() { |
+ assertTrue(this.scans_.length > 0); |
+ var scan = this.scans_[this.scans_.length - 1]; |
+ this.observers.forEach( |
+ function(observer) { |
+ observer(importer.ScanEvent.UPDATED, scan); |
+ }); |
+}; |
+ |
+/** |
* Notifies observers that a scan has finished. |
* @param {!importer.ScanResult} result |
*/ |