Index: chrome/test/data/extensions/api_test/file_manager_browsertest/test_cases.js |
diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/test_cases.js b/chrome/test/data/extensions/api_test/file_manager_browsertest/test_cases.js |
index 92cf5ed0ca8ed87034c0dbab5d287fe314e2124d..26a407d5b6c1d544879591cc7fece2eb2a04d612 100644 |
--- a/chrome/test/data/extensions/api_test/file_manager_browsertest/test_cases.js |
+++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/test_cases.js |
@@ -817,6 +817,82 @@ testcase.intermediate.copyBetweenVolumes = function(targetFile, |
}; |
/** |
+ * Test sharing dialog for a file or directory on Drive |
+ * @param {string} path Path for a file or a directory to be shared. |
+ */ |
+testcase.intermediate.share = function(path) { |
+ var appId; |
+ StepsRunner.run([ |
+ // Set up File Manager. |
+ function() { |
+ setupAndWaitUntilReady('/drive/root/', this.next); |
+ }, |
+ // Select the source file. |
+ function(inAppId) { |
+ appId = inAppId; |
+ callRemoteTestUtil( |
+ 'selectFile', appId, [path], this.next); |
+ }, |
+ // Wait for the share button. |
+ function(result) { |
+ chrome.test.assertTrue(result); |
+ callRemoteTestUtil('waitForElement', |
+ appId, |
+ ['#share-button:not([disabled])'], |
+ this.next); |
+ }, |
+ // Invoke the share dialog. |
+ function(result) { |
+ callRemoteTestUtil('fakeMouseClick', |
+ appId, |
+ ['#share-button'], |
+ this.next); |
+ }, |
+ // Wait until the share dialog's contents are shown. |
+ function(result) { |
+ chrome.test.assertTrue(result); |
+ callRemoteTestUtil('waitForElement', |
+ appId, |
+ ['.share-dialog-webview-wrapper.loaded'], |
+ this.next); |
+ }, |
+ function(result) { |
+ callRemoteTestUtil('waitForStyles', |
+ appId, |
+ [{ |
+ query: '.share-dialog-webview-wrapper.loaded', |
+ styles: { |
+ width: '350px', |
+ height: '250px' |
+ } |
+ }], |
+ this.next); |
+ }, |
+ // Wait until the share dialog's contents are shown. |
+ function(result) { |
+ callRemoteTestUtil('executeScriptInWebView', |
+ appId, |
+ ['.share-dialog-webview-wrapper.loaded webview', |
+ 'document.querySelector("button").click()'], |
+ this.next); |
+ }, |
+ // Wait until the share dialog's contents are hidden. |
+ function(result) { |
+ callRemoteTestUtil('waitForElement', |
+ appId, |
+ ['.share-dialog-webview-wrapper.loaded', |
+ null, // iframeQuery |
+ true], // inverse |
+ this.next); |
+ }, |
+ // Check for Javascript errros. |
+ function() { |
+ checkIfNoErrorsOccured(this.next); |
+ } |
+ ]); |
+}; |
+ |
+/** |
* Tests copy from drive's root to local's downloads. |
*/ |
testcase.transferFromDriveToDownloads = function() { |
@@ -905,6 +981,20 @@ testcase.transferFromOfflineToDrive = function() { |
}; |
/** |
+ * Tests sharing a file on Drive |
+ */ |
+testcase.shareFile = function() { |
+ testcase.intermediate.share('world.ogv'); |
+}; |
+ |
+/** |
+ * Tests sharing a directory on Drive |
+ */ |
+testcase.shareDirectory = function() { |
+ testcase.intermediate.share('photos'); |
+}; |
+ |
+/** |
* Tests hiding the search box. |
*/ |
testcase.hideSearchBox = function() { |