Index: ui/file_manager/file_manager/foreground/js/import_controller_unittest.js |
diff --git a/ui/file_manager/file_manager/foreground/js/import_controller_unittest.js b/ui/file_manager/file_manager/foreground/js/import_controller_unittest.js |
index 9e9fef5541e7498b53df9b940c38049d5d27d8f4..bcabcbc71dcee4604d00de8d2ba889eab1b837fb 100644 |
--- a/ui/file_manager/file_manager/foreground/js/import_controller_unittest.js |
+++ b/ui/file_manager/file_manager/foreground/js/import_controller_unittest.js |
@@ -116,7 +116,7 @@ function testGetCommandUpdate_InitiatesScan() { |
mediaScanner.assertScanCount(1); |
} |
-function testUnmountInvalidatesScans() { |
+function testGetCommandUpdate_NoSpace() { |
var controller = createController( |
VolumeManagerCommon.VolumeType.MTP, |
'mtp-volume', |
@@ -133,12 +133,12 @@ function testUnmountInvalidatesScans() { |
controller.getCommandUpdate(); |
mediaScanner.assertScanCount(1); |
+ environment.setAvailableSpace(0); |
+ mediaScanner.finalizeScans(); |
- // Faux unmount the volume, then request an update again. |
- // A fresh new scan should be started. |
- environment.simulateUnmount(); |
- controller.getCommandUpdate(); |
- mediaScanner.assertScanCount(2); |
+ var response = controller.getCommandUpdate(); |
+ assertTrue(response.visible); |
+ assertFalse(response.executable); |
} |
function testGetCommandUpdate_CanExecuteAfterScanIsFinalized() { |
@@ -335,9 +335,6 @@ TestControllerEnvironment = function(volumeInfo, directory) { |
/** @private {!DirectoryEntry} */ |
this.directory_ = directory; |
- /** @private {function(string)} */ |
- this.volumeUnmountListener_; |
- |
/** @public {!DirectoryEntry} */ |
this.selection = []; |
@@ -351,6 +348,9 @@ TestControllerEnvironment = function(volumeInfo, directory) { |
this.directoryWasSetPromise_ = new Promise(function(resolve, reject) { |
this.directoryWasSet_ = resolve; |
}.bind(this)); |
+ |
+ /** @private {number} */ |
+ this.availableSpace_ = /* 1GB */ 1024 * 1024 * 1024; |
Steve McKay
2015/01/26 18:08:44
1024 * 1024 * 1024; // 1GB
|
}; |
/** @override */ |
@@ -383,17 +383,11 @@ TestControllerEnvironment.prototype.isGoogleDriveMounted = |
return this.isDriveMounted; |
}; |
-/** @override */ |
-TestControllerEnvironment.prototype.addVolumeUnmountListener = |
- function(listener) { |
- this.volumeUnmountListener_ = listener; |
-}; |
- |
/** |
- * Simulates an unmount event. |
+ * @param {number} |
*/ |
-TestControllerEnvironment.prototype.simulateUnmount = function() { |
- this.volumeUnmountListener_(this.volumeInfo_.volumeId); |
+TestControllerEnvironment.prototype.setAvailableSpace = function(number) { |
+ this.availableSpace_ = number; |
}; |
/** |
@@ -404,6 +398,11 @@ TestControllerEnvironment.prototype.whenCurrentDirectoryIsSet = function() { |
return this.directoryWasSetPromise_; |
}; |
+TestControllerEnvironment.prototype.getLocalVolumeAvailableSize = function() { |
+ return {then: function(callback) { |
+ callback(this.availableSpace_); }.bind(this)}; |
+}; |
+ |
/** |
* @param {!VolumeManagerCommon.VolumeType} volumeType |
* @param {string} volumeId |