| 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([]);
|
| }
|
|
|