Chromium Code Reviews| Index: chrome/browser/resources/file_manager/background/js/test_util.js |
| diff --git a/chrome/browser/resources/file_manager/background/js/test_util.js b/chrome/browser/resources/file_manager/background/js/test_util.js |
| index b122d5c1f5bcf2c3d44ec0b7a970ac27b14d0893..a5692980a13593528350952889812f0bb5f3d35f 100644 |
| --- a/chrome/browser/resources/file_manager/background/js/test_util.js |
| +++ b/chrome/browser/resources/file_manager/background/js/test_util.js |
| @@ -817,6 +817,52 @@ test.util.sync.visitDesktop = function(contentWindow, profileId) { |
| }; |
| /** |
| + * Waits for the "move to profileId" menu appears (if waitAppear = true) or |
|
hirono
2014/02/13 04:53:24
nit: Make the quotations consist with the comment
kinaba
2014/02/13 05:34:33
Done.
|
| + * disappears (if waitAppear = false). |
| + * |
| + * @param {Window} contentWindow Window to be tested. |
| + * @param {string} profileId Destination profile's ID. |
| + * @param {boolean} waitAppear Flag for specifying the mode to wait. |
| + * @param {function()} callback Callback for notifying the event. |
| + */ |
| +test.util.async.waitForVisitDesktopMenu = function( |
| + contentWindow, profileId, waitAppear, callback) { |
| + test.util.repeatUntilTrue_(function() { |
| + var list = contentWindow.document.querySelectorAll('.visit-desktop'); |
| + for (var i = 0; i < list.length; ++i) { |
| + if (list[i].label.indexOf(profileId) != -1) { // found |
| + if (waitAppear) |
| + callback(); |
| + return waitAppear; |
| + } |
| + } |
| + if (!waitAppear) |
| + callback(); |
| + return !waitAppear; |
| + }); |
| +}; |
| + |
| +/** |
| + * Runs the 'Move to profileId' menu. |
| + * |
| + * @param {Window} contentWindow Window to be tested. |
| + * @param {string} profileId Destination profile's ID. |
| + * @return {boolean} True if the menu is found and run. |
| + */ |
| +test.util.sync.runVisitDesktopMenu = function(contentWindow, profileId) { |
| + var list = contentWindow.document.querySelectorAll('.visit-desktop'); |
| + for (var i = 0; i < list.length; ++i) { |
| + if (list[i].label.indexOf(profileId) != -1) { |
| + var activateEvent = contentWindow.document.createEvent('Event'); |
| + activateEvent.initEvent('activate'); |
| + list[i].dispatchEvent(activateEvent); |
| + return true; |
| + } |
| + } |
| + return false; |
| +}; |
| + |
| +/** |
| * Registers message listener, which runs test utility functions. |
| */ |
| test.util.registerRemoteTestUtils = function() { |