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

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

Issue 2645353005: chromeos: Make filesystem mount notifications clickable. (Closed)
Patch Set: fix test Created 3 years, 11 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 5802c04cde5e5c686ba9da9af6a57413a6216e1f..0128634bf6aa94ab70418d9536d2b53943421143 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
@@ -71,9 +71,9 @@ function testGoodDevice(callback) {
var promise = chrome.notifications.resolver.promise.then(
function(notifications) {
assertEquals(1, Object.keys(notifications).length);
- assertEquals(
- 'DEVICE_NAVIGATION',
- notifications['deviceNavigation:/device/path'].message);
+ var options = notifications['deviceNavigation:/device/path'];
+ assertEquals('DEVICE_NAVIGATION', options.message);
+ assertTrue(options.isClickable);
});
reportPromise(promise, callback);
@@ -598,6 +598,30 @@ function testDeviceHardUnplugged() {
'hardUnplugged:/device/path'].message);
}
+function testNotificationClicked(callback) {
+ var devicePath = '/device/path';
+ var notificationId = 'deviceNavigation:' + devicePath;
+
+ // Add a listener for navigation-requested events.
+ var resolver = new importer.Resolver();
+ handler.addEventListener(
+ DeviceHandler.VOLUME_NAVIGATION_REQUESTED,
+ function(event) {
+ resolver.resolve(event);
+ });
+
+ // Call the notification-body-clicked handler and check that the
+ // navigation-requested event is dispatched.
+ chrome.notifications.onClicked.dispatch(notificationId);
+ var promise = resolver.promise.then(
+ function(event) {
+ assertEquals(null, event.volumeId);
+ assertEquals(devicePath, event.devicePath);
+ assertEquals(null, event.filePath);
+ });
+ reportPromise(promise, callback);
+}
+
/**
* @param {!VolumeManagerCommon.VolumeType} volumeType
* @param {string} volumeId
@@ -657,6 +681,11 @@ function setupChromeApis() {
this.dispatch = listener;
}
},
+ onClicked: {
+ addListener: function(listener) {
+ this.dispatch = listener;
+ }
+ },
getAll: function(callback) {
callback([]);
}
« 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