| Index: ui/file_manager/file_manager/background/js/device_handler_unittest.js
|
| diff --git a/ui/file_manager/file_manager/background/js/device_handler_unittest.js b/ui/file_manager/file_manager/background/js/device_handler_unittest.js
|
| index 012d31e794dace5c79b65b180a0c8dc9131a9424..5802c04cde5e5c686ba9da9af6a57413a6216e1f 100644
|
| --- a/ui/file_manager/file_manager/background/js/device_handler_unittest.js
|
| +++ b/ui/file_manager/file_manager/background/js/device_handler_unittest.js
|
| @@ -29,6 +29,7 @@ loadTimeData.data = {
|
| REMOVABLE_DEVICE_IMPORT_BUTTON_LABEL: '',
|
| DEVICE_UNKNOWN_BUTTON_LABEL: 'DEVICE_UNKNOWN_BUTTON_LABEL',
|
| DEVICE_UNKNOWN_MESSAGE: 'DEVICE_UNKNOWN: $1',
|
| + DEVICE_UNKNOWN_DEFAULT_MESSAGE: 'DEVICE_UNKNOWN_DEFAULT_MESSAGE',
|
| DEVICE_UNSUPPORTED_MESSAGE: 'DEVICE_UNSUPPORTED: $1',
|
| DEVICE_HARD_UNPLUGGED_TITLE: 'DEVICE_HARD_UNPLUGGED_TITLE',
|
| DEVICE_HARD_UNPLUGGED_MESSAGE: 'DEVICE_HARD_UNPLUGGED_MESSAGE',
|
| @@ -283,6 +284,56 @@ function testUnsupportedDevice(callback) {
|
| reportPromise(promise, callback);
|
| }
|
|
|
| +function testUnknownDevice(callback) {
|
| + // Emulate adding a device which has unknown filesystem.
|
| + chrome.fileManagerPrivate.onMountCompleted.dispatch({
|
| + eventType: 'mount',
|
| + status: 'error_unknown_filesystem',
|
| + volumeMetadata: {
|
| + isParentDevice: false,
|
| + isReadOnly: false,
|
| + deviceType: 'usb',
|
| + devicePath: '/device/path',
|
| + },
|
| + shouldNotify: true
|
| + });
|
| + var promise = chrome.notifications.resolver.promise.then(
|
| + function(notifications) {
|
| + assertFalse(!!chrome.notifications.items['device:/device/path']);
|
| + var item = chrome.notifications.items['deviceFail:/device/path'];
|
| + assertEquals('DEVICE_UNKNOWN_DEFAULT_MESSAGE', item.message);
|
| + // "Format device" button should appear.
|
| + assertEquals('DEVICE_UNKNOWN_BUTTON_LABEL', item.buttons[0].title);
|
| + });
|
| +
|
| + reportPromise(promise, callback);
|
| +}
|
| +
|
| +function testUnknownReadonlyDevice(callback) {
|
| + // Emulate adding a device which has unknown filesystem but is read-only.
|
| + chrome.fileManagerPrivate.onMountCompleted.dispatch({
|
| + eventType: 'mount',
|
| + status: 'error_unknown_filesystem',
|
| + volumeMetadata: {
|
| + isParentDevice: true,
|
| + isReadOnly: true,
|
| + deviceType: 'sd',
|
| + devicePath: '/device/path',
|
| + },
|
| + shouldNotify: true
|
| + });
|
| + var promise = chrome.notifications.resolver.promise.then(
|
| + function(notifications) {
|
| + assertFalse(!!chrome.notifications.items['device:/device/path']);
|
| + var item = chrome.notifications.items['deviceFail:/device/path'];
|
| + assertEquals('DEVICE_UNKNOWN_DEFAULT_MESSAGE', item.message);
|
| + // "Format device" button should not appear.
|
| + assertFalse(!!item.buttons);
|
| + });
|
| +
|
| + reportPromise(promise, callback);
|
| +}
|
| +
|
| function testUnsupportedWithUnknownParentReplacesNotification() {
|
| chrome.fileManagerPrivate.onMountCompleted.dispatch({
|
| eventType: 'mount',
|
|
|