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

Unified Diff: ui/file_manager/file_manager/foreground/js/task_controller_unittest.js

Issue 821003002: Files.app: Fix TaskController so that it calls correct default task. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add Licence Created 6 years 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
Index: ui/file_manager/file_manager/foreground/js/task_controller_unittest.js
diff --git a/ui/file_manager/file_manager/foreground/js/task_controller_unittest.js b/ui/file_manager/file_manager/foreground/js/task_controller_unittest.js
new file mode 100644
index 0000000000000000000000000000000000000000..afe116b7045ab0d828d1513e1bfbf4db8c58873b
--- /dev/null
+++ b/ui/file_manager/file_manager/foreground/js/task_controller_unittest.js
@@ -0,0 +1,58 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+window.chrome = {
+ fileManagerPrivate: {
+ getFileTasks: function(entries, callback) {
+ setTimeout(callback.bind(null, [
+ {taskId:'handler-extension-id|file|open', isDefault: false},
+ {taskId:'handler-extension-id|file|play', isDefault: true}
+ ]), 0);
+ }
+ },
+ runtime: {id: 'test-extension-id'}
+};
+
+window.metrics = {
+ recordEnum: function() {}
+};
+
+function testDoEntryAction(callback) {
+ cr.ui.decorate('command', cr.ui.Command);
+ var fileSystem = new MockFileSystem('volumeId');
+ fileSystem.entries['/test.png'] =
+ new MockFileEntry(fileSystem, '/test.png', {});
+ var metadataCache = new MockMetadataCache();
+ metadataCache.setForTest(fileSystem.entries['/test.png'], 'external', {});
+ var controller = new TaskController(
+ DialogType.FULL_PAGE,
+ {
+ taskMenuButton: document.createElement('button'),
+ fileContextMenu: {
+ defaultActionMenuItem: document.createElement('div')
+ }
+ },
+ metadataCache,
+ new cr.EventTarget(),
+ null,
+ function() {
+ return new FileTasks({
+ volumeManager: {
+ getDriveConnectionState: function() {
+ return VolumeManagerCommon.DriveConnectionType.ONLINE;
+ }
+ },
+ isOnDrive: function() {
+ return true;
+ }
+ });
+ });
+
+ controller.doEntryAction(fileSystem.entries['/test.png']);
+ reportPromise(new Promise(function(fulfill) {
+ chrome.fileManagerPrivate.executeTask = fulfill;
+ }).then(function(info) {
+ assertEquals("handler-extension-id|file|play", info);
+ }), callback);
+}
« no previous file with comments | « ui/file_manager/file_manager/foreground/js/task_controller_unittest.html ('k') | ui/file_manager/file_manager/main.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698