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

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

Issue 330003002: Files.app: Add browser tests to test the default action dialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
Index: ui/file_manager/file_manager/background/js/test_util.js
diff --git a/ui/file_manager/file_manager/background/js/test_util.js b/ui/file_manager/file_manager/background/js/test_util.js
index 62aec6e9525627102c2ed3fc85c2161feea85e9f..9d5e7ed2ddb7f695d02f0274c0e160f7f7a9c527 100644
--- a/ui/file_manager/file_manager/background/js/test_util.js
+++ b/ui/file_manager/file_manager/background/js/test_util.js
@@ -352,12 +352,22 @@ test.util.sync.sendEvent = function(
*
* @param {Window} contentWindow Window to be tested.
* @param {string} targetQuery Query to specify the element.
- * @param {string} event Type of event.
+ * @param {string} eventType Type of event.
+ * @param {Object=} opt_additionalProperties Object contaning additional
+ * properties.
* @return {boolean} True if the event is sent to the target, false otherwise.
*/
-test.util.sync.fakeEvent = function(contentWindow, targetQuery, event) {
- return test.util.sync.sendEvent(
- contentWindow, targetQuery, new Event(event));
+test.util.sync.fakeEvent = function(contentWindow,
+ targetQuery,
+ eventType,
+ opt_additionalProperties) {
+ var event = new Event(eventType, opt_additionalProperties || {});
+ if (opt_additionalProperties) {
+ for (var name in opt_additionalProperties) {
+ event[name] = opt_additionalProperties[name];
+ }
+ }
+ return test.util.sync.sendEvent(contentWindow, targetQuery, event);
};
/**
@@ -591,9 +601,16 @@ test.util.sync.overrideTasks = function(contentWindow, taskList) {
test.util.executedTasks_.push(taskId);
};
+ var setDefaultTask = function(taskId) {
+ for (var i = 0; i < taskList.length; i++) {
+ taskList[i].isDefault = taskList[i].taskId === taskId;
+ }
+ };
+
test.util.executedTasks_ = [];
contentWindow.chrome.fileBrowserPrivate.getFileTasks = getFileTasks;
contentWindow.chrome.fileBrowserPrivate.executeTask = executeTask;
+ contentWindow.chrome.fileBrowserPrivate.setDefaultTask = setDefaultTask;
return true;
};

Powered by Google App Engine
This is Rietveld 408576698