OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * Expected files before tests are performed. Entries for Local tests. | 6 * Expected files before tests are performed. Entries for Local tests. |
7 * @type {Array.<Array.<string>>} | 7 * @type {Array.<Array.<string>>} |
8 * @const | 8 * @const |
9 */ | 9 */ |
10 var EXPECTED_FILES_BEFORE_LOCAL = [ | 10 var EXPECTED_FILES_BEFORE_LOCAL = [ |
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 checkIfNoErrorsOccured(this.next); | 810 checkIfNoErrorsOccured(this.next); |
811 return; | 811 return; |
812 } | 812 } |
813 } | 813 } |
814 chrome.test.fail(); | 814 chrome.test.fail(); |
815 } | 815 } |
816 ]); | 816 ]); |
817 }; | 817 }; |
818 | 818 |
819 /** | 819 /** |
| 820 * Test sharing dialog for a file or directory on Drive |
| 821 * @param {string} path Path for a file or a directory to be shared. |
| 822 */ |
| 823 testcase.intermediate.share = function(path) { |
| 824 var appId; |
| 825 StepsRunner.run([ |
| 826 // Set up File Manager. |
| 827 function() { |
| 828 setupAndWaitUntilReady('/drive/root/', this.next); |
| 829 }, |
| 830 // Select the source file. |
| 831 function(inAppId) { |
| 832 appId = inAppId; |
| 833 callRemoteTestUtil( |
| 834 'selectFile', appId, [path], this.next); |
| 835 }, |
| 836 // Wait for the share button. |
| 837 function(result) { |
| 838 chrome.test.assertTrue(result); |
| 839 callRemoteTestUtil('waitForElement', |
| 840 appId, |
| 841 ['#share-button:not([disabled])'], |
| 842 this.next); |
| 843 }, |
| 844 // Invoke the share dialog. |
| 845 function(result) { |
| 846 callRemoteTestUtil('fakeMouseClick', |
| 847 appId, |
| 848 ['#share-button'], |
| 849 this.next); |
| 850 }, |
| 851 // Wait until the share dialog's contents are shown. |
| 852 function(result) { |
| 853 chrome.test.assertTrue(result); |
| 854 callRemoteTestUtil('waitForElement', |
| 855 appId, |
| 856 ['.share-dialog-webview-wrapper.loaded'], |
| 857 this.next); |
| 858 }, |
| 859 function(result) { |
| 860 callRemoteTestUtil('waitForStyles', |
| 861 appId, |
| 862 [{ |
| 863 query: '.share-dialog-webview-wrapper.loaded', |
| 864 styles: { |
| 865 width: '350px', |
| 866 height: '250px' |
| 867 } |
| 868 }], |
| 869 this.next); |
| 870 }, |
| 871 // Wait until the share dialog's contents are shown. |
| 872 function(result) { |
| 873 callRemoteTestUtil('executeScriptInWebView', |
| 874 appId, |
| 875 ['.share-dialog-webview-wrapper.loaded webview', |
| 876 'document.querySelector("button").click()'], |
| 877 this.next); |
| 878 }, |
| 879 // Wait until the share dialog's contents are hidden. |
| 880 function(result) { |
| 881 callRemoteTestUtil('waitForElement', |
| 882 appId, |
| 883 ['.share-dialog-webview-wrapper.loaded', |
| 884 null, // iframeQuery |
| 885 true], // inverse |
| 886 this.next); |
| 887 }, |
| 888 // Check for Javascript errros. |
| 889 function() { |
| 890 checkIfNoErrorsOccured(this.next); |
| 891 } |
| 892 ]); |
| 893 }; |
| 894 |
| 895 /** |
820 * Tests copy from drive's root to local's downloads. | 896 * Tests copy from drive's root to local's downloads. |
821 */ | 897 */ |
822 testcase.transferFromDriveToDownloads = function() { | 898 testcase.transferFromDriveToDownloads = function() { |
823 testcase.intermediate.copyBetweenVolumes('hello.txt', | 899 testcase.intermediate.copyBetweenVolumes('hello.txt', |
824 'drive', | 900 'drive', |
825 EXPECTED_FILES_BEFORE_DRIVE, | 901 EXPECTED_FILES_BEFORE_DRIVE, |
826 'downloads', | 902 'downloads', |
827 EXPECTED_FILES_BEFORE_LOCAL); | 903 EXPECTED_FILES_BEFORE_LOCAL); |
828 }; | 904 }; |
829 | 905 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 */ | 974 */ |
899 testcase.transferFromOfflineToDrive = function() { | 975 testcase.transferFromOfflineToDrive = function() { |
900 testcase.intermediate.copyBetweenVolumes('Test Document.gdoc', | 976 testcase.intermediate.copyBetweenVolumes('Test Document.gdoc', |
901 'drive_offline', | 977 'drive_offline', |
902 EXPECTED_FILES_IN_OFFLINE, | 978 EXPECTED_FILES_IN_OFFLINE, |
903 'drive', | 979 'drive', |
904 EXPECTED_FILES_BEFORE_DRIVE); | 980 EXPECTED_FILES_BEFORE_DRIVE); |
905 }; | 981 }; |
906 | 982 |
907 /** | 983 /** |
| 984 * Tests sharing a file on Drive |
| 985 */ |
| 986 testcase.shareFile = function() { |
| 987 testcase.intermediate.share('world.ogv'); |
| 988 }; |
| 989 |
| 990 /** |
| 991 * Tests sharing a directory on Drive |
| 992 */ |
| 993 testcase.shareDirectory = function() { |
| 994 testcase.intermediate.share('photos'); |
| 995 }; |
| 996 |
| 997 /** |
908 * Tests hiding the search box. | 998 * Tests hiding the search box. |
909 */ | 999 */ |
910 testcase.hideSearchBox = function() { | 1000 testcase.hideSearchBox = function() { |
911 var appId; | 1001 var appId; |
912 StepsRunner.run([ | 1002 StepsRunner.run([ |
913 // Set up File Manager. | 1003 // Set up File Manager. |
914 function() { | 1004 function() { |
915 setupAndWaitUntilReady('/Downloads', this.next); | 1005 setupAndWaitUntilReady('/Downloads', this.next); |
916 }, | 1006 }, |
917 // Resize the window. | 1007 // Resize the window. |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 appId, | 1154 appId, |
1065 ['.detail-table[hidden]'], | 1155 ['.detail-table[hidden]'], |
1066 this.next); | 1156 this.next); |
1067 }, | 1157 }, |
1068 // Check the error. | 1158 // Check the error. |
1069 function() { | 1159 function() { |
1070 checkIfNoErrorsOccured(this.next); | 1160 checkIfNoErrorsOccured(this.next); |
1071 } | 1161 } |
1072 ]); | 1162 ]); |
1073 }; | 1163 }; |
OLD | NEW |