summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorhirono@chromium.org <hirono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-16 10:06:09 +0000
committerhirono@chromium.org <hirono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-16 10:06:09 +0000
commitc2ecc88f215eb81e257362a55c08232925c20688 (patch)
tree8a78074c729024954f506e76f8069bb6952f3bee /ui
parentbfdbd2f4fdc8d5d3d4627aba31fc333f6272a163 (diff)
downloadchromium_src-c2ecc88f215eb81e257362a55c08232925c20688.zip
chromium_src-c2ecc88f215eb81e257362a55c08232925c20688.tar.gz
chromium_src-c2ecc88f215eb81e257362a55c08232925c20688.tar.bz2
Files.app: Add browser tests to test the default action dialog.
BUG=383738 TEST=run the test Review URL: https://codereview.chromium.org/330003002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277392 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/file_manager/file_manager/background/js/test_util.js25
1 files changed, 21 insertions, 4 deletions
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 62aec6e..9d5e7ed 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;
};