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

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

Issue 2319603002: Hide "Format device" button in notification of unknown device when it is read only. (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « ui/file_manager/file_manager/background/js/device_handler.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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',
« no previous file with comments | « ui/file_manager/file_manager/background/js/device_handler.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698