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 ddc26da980adaa75e81cee0bf5cbb2328721766f..a4fa5430dce25cc94f9d3c088dc11e3904b0b1b6 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 |
@@ -103,6 +103,14 @@ TestMediaScanner.prototype.assertScanCount = function(expected) { |
}; |
/** |
+ * @param {number} expected |
mtomasz
2015/04/01 02:28:45
There is no "expected" in the argument list.
Steve McKay
2015/04/01 03:52:52
Done.
|
+ */ |
+TestMediaScanner.prototype.assertLastScanCanceled = function() { |
+ assertTrue(this.scans_.length > 0); |
+ assertTrue(this.scans_[this.scans_.length - 1].canceled()); |
+}; |
+ |
+/** |
* importer.MediaScanner and importer.ScanResult test double. |
* |
* @constructor |
@@ -112,6 +120,8 @@ TestMediaScanner.prototype.assertScanCount = function(expected) { |
* @param {!Array.<!FileEntry>} fileEntries |
*/ |
function TestScanResult(fileEntries) { |
+ |
+ this.scanId_ = ++TestScanResult.lastId_; |
/** |
* List of file entries found while scanning. |
* @type {!Array.<!FileEntry>} |
@@ -133,6 +143,9 @@ function TestScanResult(fileEntries) { |
/** @type {boolean} */ |
this.settled_ = false; |
+ /** @private {boolean} */ |
+ this.canceled_ = false; |
+ |
/** @type {!Promise.<!importer.ScanResult>} */ |
this.whenFinal_ = new Promise( |
function(resolve, reject) { |
@@ -147,6 +160,15 @@ function TestScanResult(fileEntries) { |
}.bind(this)); |
} |
+/** @private {number} */ |
+TestScanResult.lastId_ = 0; |
+ |
+/** @struct */ |
+TestScanResult.prototype = { |
+ /** @return {string} */ |
+ get name() { return 'TestScanResult(' + this.scanId_ + ')' } |
+}; |
+ |
/** @override */ |
TestScanResult.prototype.getFileEntries = function() { |
return this.fileEntries; |
@@ -168,8 +190,13 @@ TestScanResult.prototype.isFinal = function() { |
}; |
/** @override */ |
-TestScanResult.prototype.isInvalidated = function() { |
- return false; |
+TestScanResult.prototype.cancel = function() { |
+ this.canceled_ = true; |
+}; |
+ |
+/** @override */ |
+TestScanResult.prototype.canceled = function() { |
+ return this.canceled_; |
}; |
/** @override */ |