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 = [ |
11 ['hello.txt', '123 bytes', 'Plain text', 'Sep 4, 1998 12:34 PM'], | 11 ['hello.txt', '123 bytes', 'Plain text', 'Sep 4, 1998 12:34 PM'], |
12 ['world.mpeg', '1,000 bytes', 'MPEG video', 'Jul 4, 2012 10:35 AM'], | 12 ['world.mpeg', '1,000 bytes', 'MPEG video', 'Jul 4, 2012 10:35 AM'], |
13 ['My Desktop Background.png', '1 KB', 'PNG image', 'Jan 18, 2038 1:02 AM'], | 13 ['My Desktop Background.png', '1 KB', 'PNG image', 'Jan 18, 2038 1:02 AM'], |
14 ['photos', '--', 'Folder', 'Jan 1, 1980 11:59 PM'] | 14 ['photos', '--', 'Folder', 'Jan 1, 1980 11:59 PM'] |
15 // ['.warez', '--', 'Folder', 'Oct 26, 1985 1:39 PM'] # should be hidden | 15 // ['.warez', '--', 'Folder', 'Oct 26, 1985 1:39 PM'] # should be hidden |
16 ].sort(); | 16 ].sort(); |
17 | 17 |
18 /** | 18 /** |
19 * Expected files before tests are performed. Entries for Drive tests. | 19 * Expected files before tests are performed. Entries for Drive tests. |
20 * @type {Array.<Array.<string>>} | 20 * @type {Array.<Array.<string>>} |
21 * @const | 21 * @const |
22 */ | 22 */ |
23 var EXPECTED_FILES_BEFORE_DRIVE = [ | 23 var EXPECTED_FILES_BEFORE_DRIVE = [ |
24 ['hello.txt', '123 bytes', 'Plain text', 'Sep 4, 1998 12:34 PM'], | 24 ['hello.txt', '123 bytes', 'Plain text', 'Sep 4, 1998 12:34 PM'], |
25 ['world.mpeg', '1,000 bytes', 'MPEG video', 'Jul 4, 2012 10:35 AM'], | 25 ['world.mpeg', '1,000 bytes', 'MPEG video', 'Jul 4, 2012 10:35 AM'], |
26 ['My Desktop Background.png', '1 KB', 'PNG image', 'Jan 18, 2038 1:02 AM'], | 26 ['My Desktop Background.png', '1 KB', 'PNG image', 'Jan 18, 2038 1:02 AM'], |
27 ['photos', '--', 'Folder', 'Jan 1, 1980 11:59 PM'], | 27 ['photos', '--', 'Folder', 'Jan 1, 1980 11:59 PM'], |
28 ['Test Document.gdoc','--','Google document','Apr 10, 2013 4:20 PM'] | 28 ['Test Document.gdoc','--','Google document','Apr 10, 2013 4:20 PM'], |
| 29 ['Test Shared Document.gdoc','--','Google document','Mar 20, 2013 10:40 PM'] |
29 ].sort(); | 30 ].sort(); |
30 | 31 |
31 /** | 32 /** |
32 * Expected files added during some tests. | 33 * Expected files added during some tests. |
33 * @type {Array.<Array.<string>>} | 34 * @type {Array.<Array.<string>>} |
34 * @const | 35 * @const |
35 */ | 36 */ |
36 var EXPECTED_NEWLY_ADDED_FILE = [ | 37 var EXPECTED_NEWLY_ADDED_FILE = [ |
37 ['newly added file.mp3', '2 KB', 'MP3 audio', 'Sep 4, 1998 12:00 AM'] | 38 ['newly added file.mp3', '2 KB', 'MP3 audio', 'Sep 4, 1998 12:00 AM'] |
38 ]; | 39 ]; |
(...skipping 28 matching lines...) Expand all Loading... |
67 * Expected files shown in "Recent". Directories (e.g. 'photos') are not in this | 68 * Expected files shown in "Recent". Directories (e.g. 'photos') are not in this |
68 * list as they are not expected in "Recent". | 69 * list as they are not expected in "Recent". |
69 * @type {Array.<Array.<string>>} | 70 * @type {Array.<Array.<string>>} |
70 * @const | 71 * @const |
71 */ | 72 */ |
72 var EXPECTED_FILES_IN_RECENT = [ | 73 var EXPECTED_FILES_IN_RECENT = [ |
73 ['hello.txt', '123 bytes', 'Plain text', 'Sep 4, 1998 12:34 PM'], | 74 ['hello.txt', '123 bytes', 'Plain text', 'Sep 4, 1998 12:34 PM'], |
74 ['world.mpeg', '1,000 bytes', 'MPEG video', 'Jul 4, 2012 10:35 AM'], | 75 ['world.mpeg', '1,000 bytes', 'MPEG video', 'Jul 4, 2012 10:35 AM'], |
75 ['My Desktop Background.png', '1 KB', 'PNG image', 'Jan 18, 2038 1:02 AM'], | 76 ['My Desktop Background.png', '1 KB', 'PNG image', 'Jan 18, 2038 1:02 AM'], |
76 ['Test Document.gdoc','--','Google document','Apr 10, 2013 4:20 PM'], | 77 ['Test Document.gdoc','--','Google document','Apr 10, 2013 4:20 PM'], |
| 78 ['Test Shared Document.gdoc','--','Google document','Mar 20, 2013 10:40 PM'] |
77 ].sort(); | 79 ].sort(); |
78 | 80 |
79 /** | 81 /** |
80 * Expected files shown in "Offline", which should have the files | 82 * Expected files shown in "Offline", which should have the files |
81 * "available offline". Google Documents, Google Spreadsheets, and the files | 83 * "available offline". Google Documents, Google Spreadsheets, and the files |
82 * cached locally are "available offline". | 84 * cached locally are "available offline". |
83 * @type {Array.<Array.<string>>} | 85 * @type {Array.<Array.<string>>} |
84 * @const | 86 * @const |
85 */ | 87 */ |
86 var EXPECTED_FILES_IN_OFFLINE = [ | 88 var EXPECTED_FILES_IN_OFFLINE = [ |
87 ['Test Document.gdoc','--','Google document','Apr 10, 2013 4:20 PM'], | 89 ['Test Document.gdoc','--','Google document','Apr 10, 2013 4:20 PM'], |
| 90 ['Test Shared Document.gdoc','--','Google document','Mar 20, 2013 10:40 PM'] |
88 ]; | 91 ]; |
89 | 92 |
90 /** | 93 /** |
| 94 * Expected files shown in "Shared with me", which should be the entries labeled |
| 95 * with "shared-with-me". |
| 96 * @type {Array.<Array.<string>>} |
| 97 * @const |
| 98 */ |
| 99 var EXPECTED_FILES_IN_SHARED_WITH_ME = [ |
| 100 ['Test Shared Document.gdoc','--','Google document','Mar 20, 2013 10:40 PM'] |
| 101 ]; |
| 102 |
| 103 /** |
91 * Namespace for test cases. | 104 * Namespace for test cases. |
92 */ | 105 */ |
93 var testcase = {}; | 106 var testcase = {}; |
94 | 107 |
95 /** | 108 /** |
96 * Namespace for intermediate test cases. | 109 * Namespace for intermediate test cases. |
97 * */ | 110 * */ |
98 testcase.intermediate = {}; | 111 testcase.intermediate = {}; |
99 | 112 |
100 /** | 113 /** |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 callRemoteTestUtil( | 243 callRemoteTestUtil( |
231 'waitForFileListChange', | 244 'waitForFileListChange', |
232 appId, | 245 appId, |
233 [getExpectedFilesBefore(true /* isDrive */).length], | 246 [getExpectedFilesBefore(true /* isDrive */).length], |
234 onFileListChange); | 247 onFileListChange); |
235 }); | 248 }); |
236 }); | 249 }); |
237 }; | 250 }; |
238 | 251 |
239 /** | 252 /** |
| 253 * Tests opening the "Shared with me" on the sidebar navigation by clicking the |
| 254 * icon, and checks contents of the file list. Only the entries labeled with |
| 255 * "shared-with-me" should be shown. |
| 256 */ |
| 257 testcase.openSidebarSharedWithMe = function() { |
| 258 var onFileListChange = chrome.test.callbackPass(function(actualFilesAfter) { |
| 259 chrome.test.assertEq(EXPECTED_FILES_IN_SHARED_WITH_ME, actualFilesAfter); |
| 260 }); |
| 261 |
| 262 setupAndWaitUntilReady('/drive/root/', function(appId) { |
| 263 // Use the icon for a click target. |
| 264 callRemoteTestUtil( |
| 265 'fakeMouseClick', appId, ['[volume-type-icon=drive_shared_with_me]'], |
| 266 function(result) { |
| 267 chrome.test.assertFalse(!result); |
| 268 callRemoteTestUtil( |
| 269 'waitForFileListChange', |
| 270 appId, |
| 271 [getExpectedFilesBefore(true /* isDrive */).length], |
| 272 onFileListChange); |
| 273 }); |
| 274 }); |
| 275 }; |
| 276 |
| 277 /** |
240 * Tests autocomplete with a query 'hello'. This test is only available for | 278 * Tests autocomplete with a query 'hello'. This test is only available for |
241 * Drive. | 279 * Drive. |
242 */ | 280 */ |
243 testcase.autocomplete = function() { | 281 testcase.autocomplete = function() { |
244 var EXPECTED_AUTOCOMPLETE_LIST = [ | 282 var EXPECTED_AUTOCOMPLETE_LIST = [ |
245 '\'hello\' - search Drive\n', | 283 '\'hello\' - search Drive\n', |
246 'hello.txt\n', | 284 'hello.txt\n', |
247 ]; | 285 ]; |
248 | 286 |
249 var onAutocompleteListShown = chrome.test.callbackPass( | 287 var onAutocompleteListShown = chrome.test.callbackPass( |
250 function(autocompleteList) { | 288 function(autocompleteList) { |
251 chrome.test.assertEq(EXPECTED_AUTOCOMPLETE_LIST, autocompleteList); | 289 chrome.test.assertEq(EXPECTED_AUTOCOMPLETE_LIST, autocompleteList); |
252 }); | 290 }); |
253 | 291 |
254 setupAndWaitUntilReady('/drive/root', function(appId, list) { | 292 setupAndWaitUntilReady('/drive/root', function(appId, list) { |
255 callRemoteTestUtil('performAutocompleteAndWait', | 293 callRemoteTestUtil('performAutocompleteAndWait', |
256 appId, | 294 appId, |
257 ['hello', EXPECTED_AUTOCOMPLETE_LIST.length], | 295 ['hello', EXPECTED_AUTOCOMPLETE_LIST.length], |
258 onAutocompleteListShown); | 296 onAutocompleteListShown); |
259 }); | 297 }); |
260 }; | 298 }; |
OLD | NEW |