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

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

Issue 16092002: Added basic tests to test the audio player in Files.app. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 7 years, 6 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
« no previous file with comments | « chrome/browser/resources/file_manager/js/test_util.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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', '51 bytes', 'Plain text', 'Sep 4, 1998 12:34 PM'], 11 ['hello.txt', '51 bytes', 'Plain text', 'Sep 4, 1998 12:34 PM'],
12 ['world.ogv', '59 KB', 'OGG video', 'Jul 4, 2012 10:35 AM'], 12 ['world.ogv', '59 KB', 'OGG video', 'Jul 4, 2012 10:35 AM'],
13 ['My Desktop Background.png', '272 bytes', 'PNG image', 13 ['My Desktop Background.png', '272 bytes', 'PNG image',
14 'Jan 18, 2038 1:02 AM'], 14 'Jan 18, 2038 1:02 AM'],
15 ['Beautiful Song.ogg', '14 KB', 'OGG audio', 'Nov 12, 2086 12:00 PM'],
15 ['photos', '--', 'Folder', 'Jan 1, 1980 11:59 PM'] 16 ['photos', '--', 'Folder', 'Jan 1, 1980 11:59 PM']
16 // ['.warez', '--', 'Folder', 'Oct 26, 1985 1:39 PM'] # should be hidden 17 // ['.warez', '--', 'Folder', 'Oct 26, 1985 1:39 PM'] # should be hidden
17 ].sort(); 18 ].sort();
18 19
19 /** 20 /**
20 * Expected files before tests are performed. Entries for Drive tests. 21 * Expected files before tests are performed. Entries for Drive tests.
21 * @type {Array.<Array.<string>>} 22 * @type {Array.<Array.<string>>}
22 * @const 23 * @const
23 */ 24 */
24 var EXPECTED_FILES_BEFORE_DRIVE = [ 25 var EXPECTED_FILES_BEFORE_DRIVE = [
25 ['hello.txt', '51 bytes', 'Plain text', 'Sep 4, 1998 12:34 PM'], 26 ['hello.txt', '51 bytes', 'Plain text', 'Sep 4, 1998 12:34 PM'],
26 ['world.ogv', '59 KB', 'OGG video', 'Jul 4, 2012 10:35 AM'], 27 ['world.ogv', '59 KB', 'OGG video', 'Jul 4, 2012 10:35 AM'],
27 ['My Desktop Background.png', '272 bytes', 'PNG image', 28 ['My Desktop Background.png', '272 bytes', 'PNG image',
28 'Jan 18, 2038 1:02 AM'], 29 'Jan 18, 2038 1:02 AM'],
30 ['Beautiful Song.ogg', '14 KB', 'OGG audio', 'Nov 12, 2086 12:00 PM'],
29 ['photos', '--', 'Folder', 'Jan 1, 1980 11:59 PM'], 31 ['photos', '--', 'Folder', 'Jan 1, 1980 11:59 PM'],
30 ['Test Document.gdoc','--','Google document','Apr 10, 2013 4:20 PM'], 32 ['Test Document.gdoc','--','Google document','Apr 10, 2013 4:20 PM'],
31 ['Test Shared Document.gdoc','--','Google document','Mar 20, 2013 10:40 PM'] 33 ['Test Shared Document.gdoc','--','Google document','Mar 20, 2013 10:40 PM']
32 ].sort(); 34 ].sort();
33 35
34 /** 36 /**
35 * Expected files added during some tests. 37 * Expected files added during some tests.
36 * @type {Array.<Array.<string>>} 38 * @type {Array.<Array.<string>>}
37 * @const 39 * @const
38 */ 40 */
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 * list as they are not expected in "Recent". 84 * list as they are not expected in "Recent".
83 * 85 *
84 * @type {Array.<Array.<string>>} 86 * @type {Array.<Array.<string>>}
85 * @const 87 * @const
86 */ 88 */
87 var EXPECTED_FILES_IN_RECENT = [ 89 var EXPECTED_FILES_IN_RECENT = [
88 ['hello.txt', '51 bytes', 'Plain text', 'Sep 4, 1998 12:34 PM'], 90 ['hello.txt', '51 bytes', 'Plain text', 'Sep 4, 1998 12:34 PM'],
89 ['world.ogv', '59 KB', 'OGG video', 'Jul 4, 2012 10:35 AM'], 91 ['world.ogv', '59 KB', 'OGG video', 'Jul 4, 2012 10:35 AM'],
90 ['My Desktop Background.png', '272 bytes', 'PNG image', 92 ['My Desktop Background.png', '272 bytes', 'PNG image',
91 'Jan 18, 2038 1:02 AM'], 93 'Jan 18, 2038 1:02 AM'],
94 ['Beautiful Song.ogg', '14 KB', 'OGG audio', 'Nov 12, 2086 12:00 PM'],
92 ['Test Document.gdoc','--','Google document','Apr 10, 2013 4:20 PM'], 95 ['Test Document.gdoc','--','Google document','Apr 10, 2013 4:20 PM'],
93 ['Test Shared Document.gdoc','--','Google document','Mar 20, 2013 10:40 PM'] 96 ['Test Shared Document.gdoc','--','Google document','Mar 20, 2013 10:40 PM']
94 ].sort(); 97 ].sort();
95 98
96 /** 99 /**
97 * Expected files shown in "Offline", which should have the files 100 * Expected files shown in "Offline", which should have the files
98 * "available offline". Google Documents, Google Spreadsheets, and the files 101 * "available offline". Google Documents, Google Spreadsheets, and the files
99 * cached locally are "available offline". 102 * cached locally are "available offline".
100 * @type {Array.<Array.<string>>} 103 * @type {Array.<Array.<string>>}
101 * @const 104 * @const
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 }, 215 },
213 function(result) { 216 function(result) {
214 chrome.test.assertTrue(result); 217 chrome.test.assertTrue(result);
215 // Wait for the image in the gallery's screen image. 218 // Wait for the image in the gallery's screen image.
216 callRemoteTestUtil('waitForElement', 219 callRemoteTestUtil('waitForElement',
217 appId, 220 appId,
218 ['.gallery .content canvas.image', 221 ['.gallery .content canvas.image',
219 'iframe.overlay-pane'], 222 'iframe.overlay-pane'],
220 steps.shift()); 223 steps.shift());
221 }, 224 },
222 function(attributes) { 225 function(element) {
223 // Verify the gallery's screen image. 226 // Verify the gallery's screen image.
224 chrome.test.assertEq('320', attributes['width']); 227 chrome.test.assertEq('320', element.attributes.width);
225 chrome.test.assertEq('240', attributes['height']); 228 chrome.test.assertEq('240', element.attributes.height);
226 // Get the full-resolution image. 229 // Get the full-resolution image.
227 callRemoteTestUtil('waitForElement', 230 callRemoteTestUtil('waitForElement',
228 appId, 231 appId,
229 ['.gallery .content canvas.fullres', 232 ['.gallery .content canvas.fullres',
230 'iframe.overlay-pane'], 233 'iframe.overlay-pane'],
231 steps.shift()); 234 steps.shift());
232 }, 235 },
233 function(attributes) { 236 function(element) {
234 // Verify the gallery's screen image. 237 // Verify the gallery's screen image.
235 chrome.test.assertEq('800', attributes['width']); 238 chrome.test.assertEq('800', element.attributes.width);
236 chrome.test.assertEq('600', attributes['height']); 239 chrome.test.assertEq('600', element.attributes.height);
237 chrome.test.succeed(); 240 chrome.test.succeed();
238 }, 241 }
239 ]; 242 ];
240 steps = steps.map(function(f) { return chrome.test.callbackPass(f); }); 243 steps = steps.map(function(f) { return chrome.test.callbackPass(f); });
241 steps.shift()(); 244 steps.shift()();
245 };
246
247 /**
248 * Tests if the audio player shows up for the selected image and that the audio
249 * is loaded successfully.
250 *
251 * @param {string} path Directory path to be tested.
252 */
253 testcase.intermediate.audioOpen = function(path) {
254 var appId;
255 var audioAppId;
256 var steps = [
257 function() {
258 setupAndWaitUntilReady(path, steps.shift());
259 },
260 function(inAppId) {
261 appId = inAppId;
262 // Select the song.
263 callRemoteTestUtil(
264 'selectFile', appId, ['Beautiful Song.ogg'], steps.shift());
265 },
266 function(result) {
267 chrome.test.assertTrue(result);
268 // Click on the label to enter the audio player.
269 callRemoteTestUtil(
270 'fakeMouseClick',
271 appId,
272 ['#file-list li.table-row[selected] .filename-label span'],
273 steps.shift());
274 },
275 function(result) {
276 chrome.test.assertTrue(result);
277 // Wait for the audio player.
278 callRemoteTestUtil('waitForWindow',
279 null,
280 ['mediaplayer.html'],
281 steps.shift());
282 },
283 function(inAppId) {
284 audioAppId = inAppId;
285 // Wait for the audio tag and verify the source.
286 callRemoteTestUtil('waitForElement',
287 audioAppId,
288 ['audio[src]'],
289 steps.shift());
290 },
291 function(element) {
292 chrome.test.assertEq(
293 'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' +
294 'external' + path + '/Beautiful%20Song.ogg',
295 element.attributes.src);
296 // Get the title tag.
297 callRemoteTestUtil('waitForElement',
298 audioAppId,
299 ['.data-title'],
300 steps.shift());
301 },
302 function(element) {
303 chrome.test.assertEq('Beautiful Song', element.text);
304 // Get the artist tag.
305 callRemoteTestUtil('waitForElement',
306 audioAppId,
307 ['.data-artist'],
308 steps.shift());
309 },
310 function(element) {
311 chrome.test.assertEq('Unknown Artist', element.text);
312 chrome.test.succeed();
313 }
314 ];
315 steps = steps.map(function(f) { return chrome.test.callbackPass(f); });
316 steps.shift()();
242 }; 317 };
243 318
244 /** 319 /**
245 * Tests copying a file to the same directory and waits until the file lists 320 * Tests copying a file to the same directory and waits until the file lists
246 * changes. 321 * changes.
247 * 322 *
248 * @param {string} path Directory path to be tested. 323 * @param {string} path Directory path to be tested.
249 */ 324 */
250 testcase.intermediate.keyboardCopy = function(path, callback) { 325 testcase.intermediate.keyboardCopy = function(path, callback) {
251 // Returns true if |fileList| contains a copy of |filename|. 326 // Returns true if |fileList| contains a copy of |filename|.
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 }; 425 };
351 426
352 testcase.fileDisplayDownloads = function() { 427 testcase.fileDisplayDownloads = function() {
353 testcase.intermediate.fileDisplay('/Downloads'); 428 testcase.intermediate.fileDisplay('/Downloads');
354 }; 429 };
355 430
356 testcase.galleryOpenDownloads = function() { 431 testcase.galleryOpenDownloads = function() {
357 testcase.intermediate.galleryOpen('/Downloads'); 432 testcase.intermediate.galleryOpen('/Downloads');
358 }; 433 };
359 434
435 testcase.audioOpenDownloads = function() {
436 testcase.intermediate.audioOpen('/Downloads');
437 };
438
360 testcase.keyboardCopyDownloads = function() { 439 testcase.keyboardCopyDownloads = function() {
361 testcase.intermediate.keyboardCopy('/Downloads'); 440 testcase.intermediate.keyboardCopy('/Downloads');
362 }; 441 };
363 442
364 testcase.keyboardDeleteDownloads = function() { 443 testcase.keyboardDeleteDownloads = function() {
365 testcase.intermediate.keyboardDelete('/Downloads'); 444 testcase.intermediate.keyboardDelete('/Downloads');
366 }; 445 };
367 446
368 testcase.fileDisplayDrive = function() { 447 testcase.fileDisplayDrive = function() {
369 testcase.intermediate.fileDisplay('/drive/root'); 448 testcase.intermediate.fileDisplay('/drive/root');
370 }; 449 };
371 450
372 testcase.galleryOpenDrive = function() { 451 testcase.galleryOpenDrive = function() {
373 testcase.intermediate.galleryOpen('/drive/root'); 452 testcase.intermediate.galleryOpen('/drive/root');
374 }; 453 };
375 454
455 testcase.audioOpenDrive = function() {
456 testcase.intermediate.audioOpen('/drive/root');
457 };
458
376 testcase.keyboardCopyDrive = function() { 459 testcase.keyboardCopyDrive = function() {
377 testcase.intermediate.keyboardCopy('/drive/root'); 460 testcase.intermediate.keyboardCopy('/drive/root');
378 }; 461 };
379 462
380 testcase.keyboardDeleteDrive = function() { 463 testcase.keyboardDeleteDrive = function() {
381 testcase.intermediate.keyboardDelete('/drive/root'); 464 testcase.intermediate.keyboardDelete('/drive/root');
382 }; 465 };
383 466
384 /** 467 /**
385 * Tests opening the "Recent" on the sidebar navigation by clicking the icon, 468 * Tests opening the "Recent" on the sidebar navigation by clicking the icon,
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 /** 750 /**
668 * Tests copy from drive's offline to drive's root. 751 * Tests copy from drive's offline to drive's root.
669 */ 752 */
670 testcase.transferFromOfflineToDrive = function() { 753 testcase.transferFromOfflineToDrive = function() {
671 testcase.intermediate.copyBetweenVolumes('Test Document.gdoc', 754 testcase.intermediate.copyBetweenVolumes('Test Document.gdoc',
672 'drive_offline', 755 'drive_offline',
673 EXPECTED_FILES_IN_OFFLINE, 756 EXPECTED_FILES_IN_OFFLINE,
674 'drive', 757 'drive',
675 EXPECTED_FILES_BEFORE_DRIVE); 758 EXPECTED_FILES_BEFORE_DRIVE);
676 }; 759 };
OLDNEW
« no previous file with comments | « chrome/browser/resources/file_manager/js/test_util.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698