| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 window.metrics = { | 5 window.metrics = { |
| 6 recordEnum: function() {} | 6 recordEnum: function() {} |
| 7 }; | 7 }; |
| 8 | 8 |
| 9 function MockMetadataModel(properties) { | 9 function MockMetadataModel(properties) { |
| 10 this.properties_ = properties; | 10 this.properties_ = properties; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 cr.ui.decorate('command', cr.ui.Command); | 27 cr.ui.decorate('command', cr.ui.Command); |
| 28 } | 28 } |
| 29 | 29 |
| 30 function testExecuteEntryTask(callback) { | 30 function testExecuteEntryTask(callback) { |
| 31 window.chrome.fileManagerPrivate = { | 31 window.chrome.fileManagerPrivate = { |
| 32 getFileTasks: function(entries, callback) { | 32 getFileTasks: function(entries, callback) { |
| 33 setTimeout(callback.bind(null, [ | 33 setTimeout(callback.bind(null, [ |
| 34 {taskId:'handler-extension-id|file|open', isDefault: false}, | 34 {taskId:'handler-extension-id|file|open', isDefault: false}, |
| 35 {taskId:'handler-extension-id|file|play', isDefault: true} | 35 {taskId:'handler-extension-id|file|play', isDefault: true} |
| 36 ]), 0); | 36 ]), 0); |
| 37 } | 37 }, |
| 38 onAppsUpdated: { |
| 39 addListener: function() {}, |
| 40 }, |
| 38 }; | 41 }; |
| 39 | 42 |
| 40 var fileSystem = new MockFileSystem('volumeId'); | 43 var fileSystem = new MockFileSystem('volumeId'); |
| 41 fileSystem.entries['/test.png'] = | 44 fileSystem.entries['/test.png'] = |
| 42 new MockFileEntry(fileSystem, '/test.png', {}); | 45 new MockFileEntry(fileSystem, '/test.png', {}); |
| 43 var controller = new TaskController( | 46 var controller = new TaskController( |
| 44 DialogType.FULL_PAGE, | 47 DialogType.FULL_PAGE, |
| 45 { | 48 { |
| 46 getDriveConnectionState: function() { | 49 getDriveConnectionState: function() { |
| 47 return VolumeManagerCommon.DriveConnectionType.ONLINE; | 50 return VolumeManagerCommon.DriveConnectionType.ONLINE; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 63 new cr.EventTarget(), | 66 new cr.EventTarget(), |
| 64 null); | 67 null); |
| 65 | 68 |
| 66 controller.executeEntryTask(fileSystem.entries['/test.png']); | 69 controller.executeEntryTask(fileSystem.entries['/test.png']); |
| 67 reportPromise(new Promise(function(fulfill) { | 70 reportPromise(new Promise(function(fulfill) { |
| 68 chrome.fileManagerPrivate.executeTask = fulfill; | 71 chrome.fileManagerPrivate.executeTask = fulfill; |
| 69 }).then(function(info) { | 72 }).then(function(info) { |
| 70 assertEquals("handler-extension-id|file|play", info); | 73 assertEquals("handler-extension-id|file|play", info); |
| 71 }), callback); | 74 }), callback); |
| 72 } | 75 } |
| OLD | NEW |