Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Side by Side Diff: chrome/test/data/extensions/api_test/file_manager_browsertest/test_cases.js

Issue 13896006: filemanager: Add a browsertest for the sidebar item "Shared with Me". (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comments, remove debug lines. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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'],
88 ]; 90 ];
89 91
90 /** 92 /**
93 * Expected files shown in "Shared with me", which should be the entries labeled
94 * with "shared-with-me".
95 * @type {Array.<Array.<string>>}
96 * @const
97 */
98 var EXPECTED_FILES_IN_SHARED_WITH_ME = [
99 ['Test Shared Document.gdoc','--','Google document','Mar 20, 2013 10:40 PM']
100 ];
101
102 /**
91 * Namespace for test cases. 103 * Namespace for test cases.
92 */ 104 */
93 var testcase = {}; 105 var testcase = {};
94 106
95 /** 107 /**
96 * Namespace for intermediate test cases. 108 * Namespace for intermediate test cases.
97 * */ 109 * */
98 testcase.intermediate = {}; 110 testcase.intermediate = {};
99 111
100 /** 112 /**
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 callRemoteTestUtil( 242 callRemoteTestUtil(
231 'waitForFileListChange', 243 'waitForFileListChange',
232 appId, 244 appId,
233 [getExpectedFilesBefore(true /* isDrive */).length], 245 [getExpectedFilesBefore(true /* isDrive */).length],
234 onFileListChange); 246 onFileListChange);
235 }); 247 });
236 }); 248 });
237 }; 249 };
238 250
239 /** 251 /**
252 * Tests opening the "Shared with me" on the sidebar navigation by clicking the
253 * icon, and checks contents of the file list. Only the entries labeled with
254 * "shared-with-me" should be shown.
255 */
256 testcase.openSidebarSharedWithMe = function() {
257 var onFileListChange = chrome.test.callbackPass(function(actualFilesAfter) {
258 chrome.test.assertEq(EXPECTED_FILES_IN_SHARED_WITH_ME, actualFilesAfter);
259 });
260
261 setupAndWaitUntilReady('/drive/root/', function(appId) {
262 // Use the icon for a click target.
263 callRemoteTestUtil(
264 'fakeMouseClick', appId, ['[volume-type-icon=drive_shared_with_me]'],
265 function(result) {
266 chrome.test.assertFalse(!result);
267 callRemoteTestUtil(
268 'waitForFileListChange',
269 appId,
270 [getExpectedFilesBefore(true /* isDrive */).length],
271 onFileListChange);
272 });
273 });
274 };
275
276 /**
240 * Tests autocomplete with a query 'hello'. This test is only available for 277 * Tests autocomplete with a query 'hello'. This test is only available for
241 * Drive. 278 * Drive.
242 */ 279 */
243 testcase.autocomplete = function() { 280 testcase.autocomplete = function() {
244 var EXPECTED_AUTOCOMPLETE_LIST = [ 281 var EXPECTED_AUTOCOMPLETE_LIST = [
245 '\'hello\' - search Drive\n', 282 '\'hello\' - search Drive\n',
246 'hello.txt\n', 283 'hello.txt\n',
247 ]; 284 ];
248 285
249 var onAutocompleteListShown = chrome.test.callbackPass( 286 var onAutocompleteListShown = chrome.test.callbackPass(
250 function(autocompleteList) { 287 function(autocompleteList) {
251 chrome.test.assertEq(EXPECTED_AUTOCOMPLETE_LIST, autocompleteList); 288 chrome.test.assertEq(EXPECTED_AUTOCOMPLETE_LIST, autocompleteList);
252 }); 289 });
253 290
254 setupAndWaitUntilReady('/drive/root', function(appId, list) { 291 setupAndWaitUntilReady('/drive/root', function(appId, list) {
255 callRemoteTestUtil('performAutocompleteAndWait', 292 callRemoteTestUtil('performAutocompleteAndWait',
256 appId, 293 appId,
257 ['hello', EXPECTED_AUTOCOMPLETE_LIST.length], 294 ['hello', EXPECTED_AUTOCOMPLETE_LIST.length],
258 onAutocompleteListShown); 295 onAutocompleteListShown);
259 }); 296 });
260 }; 297 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698