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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 function(element) { | 310 function(element) { |
311 chrome.test.assertEq('Unknown Artist', element.text); | 311 chrome.test.assertEq('Unknown Artist', element.text); |
312 chrome.test.succeed(); | 312 chrome.test.succeed(); |
313 } | 313 } |
314 ]; | 314 ]; |
315 steps = steps.map(function(f) { return chrome.test.callbackPass(f); }); | 315 steps = steps.map(function(f) { return chrome.test.callbackPass(f); }); |
316 steps.shift()(); | 316 steps.shift()(); |
317 }; | 317 }; |
318 | 318 |
319 /** | 319 /** |
| 320 * Tests if the video player shows up for the selected movie and that it is |
| 321 * loaded successfully. |
| 322 * |
| 323 * @param {string} path Directory path to be tested. |
| 324 */ |
| 325 testcase.intermediate.videoOpen = function(path) { |
| 326 var appId; |
| 327 var videoAppId; |
| 328 var steps = [ |
| 329 function() { |
| 330 setupAndWaitUntilReady(path, steps.shift()); |
| 331 }, |
| 332 function(inAppId) { |
| 333 appId = inAppId; |
| 334 // Select the song. |
| 335 callRemoteTestUtil( |
| 336 'selectFile', appId, ['world.ogv'], steps.shift()); |
| 337 }, |
| 338 function(result) { |
| 339 chrome.test.assertTrue(result); |
| 340 // Click on the label to enter the video player. |
| 341 callRemoteTestUtil( |
| 342 'fakeMouseClick', |
| 343 appId, |
| 344 ['#file-list li.table-row[selected] .filename-label span'], |
| 345 steps.shift()); |
| 346 }, |
| 347 function(result) { |
| 348 chrome.test.assertTrue(result); |
| 349 // Wait for the video player. |
| 350 callRemoteTestUtil('waitForWindow', |
| 351 null, |
| 352 ['video_player.html'], |
| 353 steps.shift()); |
| 354 }, |
| 355 function(inAppId) { |
| 356 videoAppId = inAppId; |
| 357 // Wait for the video tag and verify the source. |
| 358 callRemoteTestUtil('waitForElement', |
| 359 videoAppId, |
| 360 ['video[src]'], |
| 361 steps.shift()); |
| 362 }, |
| 363 function(element) { |
| 364 chrome.test.assertEq( |
| 365 'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' + |
| 366 'external' + path + '/world.ogv', |
| 367 element.attributes.src); |
| 368 // Wait for the window's inner dimensions. Should be changed to the video |
| 369 // size once the metadata is loaded. |
| 370 callRemoteTestUtil('waitForWindowGeometry', |
| 371 videoAppId, |
| 372 [320, 192], |
| 373 steps.shift()); |
| 374 }, |
| 375 function(element) { |
| 376 chrome.test.succeed(); |
| 377 } |
| 378 ]; |
| 379 steps = steps.map(function(f) { return chrome.test.callbackPass(f); }); |
| 380 steps.shift()(); |
| 381 }; |
| 382 |
| 383 /** |
320 * Tests copying a file to the same directory and waits until the file lists | 384 * Tests copying a file to the same directory and waits until the file lists |
321 * changes. | 385 * changes. |
322 * | 386 * |
323 * @param {string} path Directory path to be tested. | 387 * @param {string} path Directory path to be tested. |
324 */ | 388 */ |
325 testcase.intermediate.keyboardCopy = function(path, callback) { | 389 testcase.intermediate.keyboardCopy = function(path, callback) { |
326 // Returns true if |fileList| contains a copy of |filename|. | 390 // Returns true if |fileList| contains a copy of |filename|. |
327 var isCopyPresent = function(filename, fileList) { | 391 var isCopyPresent = function(filename, fileList) { |
328 var originalEntry; | 392 var originalEntry; |
329 for (var i = 0; i < fileList.length; i++) { | 393 for (var i = 0; i < fileList.length; i++) { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 }; | 493 }; |
430 | 494 |
431 testcase.galleryOpenDownloads = function() { | 495 testcase.galleryOpenDownloads = function() { |
432 testcase.intermediate.galleryOpen('/Downloads'); | 496 testcase.intermediate.galleryOpen('/Downloads'); |
433 }; | 497 }; |
434 | 498 |
435 testcase.audioOpenDownloads = function() { | 499 testcase.audioOpenDownloads = function() { |
436 testcase.intermediate.audioOpen('/Downloads'); | 500 testcase.intermediate.audioOpen('/Downloads'); |
437 }; | 501 }; |
438 | 502 |
| 503 testcase.videoOpenDownloads = function() { |
| 504 testcase.intermediate.videoOpen('/Downloads'); |
| 505 }; |
| 506 |
439 testcase.keyboardCopyDownloads = function() { | 507 testcase.keyboardCopyDownloads = function() { |
440 testcase.intermediate.keyboardCopy('/Downloads'); | 508 testcase.intermediate.keyboardCopy('/Downloads'); |
441 }; | 509 }; |
442 | 510 |
443 testcase.keyboardDeleteDownloads = function() { | 511 testcase.keyboardDeleteDownloads = function() { |
444 testcase.intermediate.keyboardDelete('/Downloads'); | 512 testcase.intermediate.keyboardDelete('/Downloads'); |
445 }; | 513 }; |
446 | 514 |
447 testcase.fileDisplayDrive = function() { | 515 testcase.fileDisplayDrive = function() { |
448 testcase.intermediate.fileDisplay('/drive/root'); | 516 testcase.intermediate.fileDisplay('/drive/root'); |
449 }; | 517 }; |
450 | 518 |
451 testcase.galleryOpenDrive = function() { | 519 testcase.galleryOpenDrive = function() { |
452 testcase.intermediate.galleryOpen('/drive/root'); | 520 testcase.intermediate.galleryOpen('/drive/root'); |
453 }; | 521 }; |
454 | 522 |
455 testcase.audioOpenDrive = function() { | 523 testcase.audioOpenDrive = function() { |
456 testcase.intermediate.audioOpen('/drive/root'); | 524 testcase.intermediate.audioOpen('/drive/root'); |
457 }; | 525 }; |
458 | 526 |
| 527 testcase.videoOpenDrive = function() { |
| 528 testcase.intermediate.videoOpen('/drive/root'); |
| 529 }; |
| 530 |
459 testcase.keyboardCopyDrive = function() { | 531 testcase.keyboardCopyDrive = function() { |
460 testcase.intermediate.keyboardCopy('/drive/root'); | 532 testcase.intermediate.keyboardCopy('/drive/root'); |
461 }; | 533 }; |
462 | 534 |
463 testcase.keyboardDeleteDrive = function() { | 535 testcase.keyboardDeleteDrive = function() { |
464 testcase.intermediate.keyboardDelete('/drive/root'); | 536 testcase.intermediate.keyboardDelete('/drive/root'); |
465 }; | 537 }; |
466 | 538 |
467 /** | 539 /** |
468 * Tests opening the "Recent" on the sidebar navigation by clicking the icon, | 540 * Tests opening the "Recent" on the sidebar navigation by clicking the icon, |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 /** | 822 /** |
751 * Tests copy from drive's offline to drive's root. | 823 * Tests copy from drive's offline to drive's root. |
752 */ | 824 */ |
753 testcase.transferFromOfflineToDrive = function() { | 825 testcase.transferFromOfflineToDrive = function() { |
754 testcase.intermediate.copyBetweenVolumes('Test Document.gdoc', | 826 testcase.intermediate.copyBetweenVolumes('Test Document.gdoc', |
755 'drive_offline', | 827 'drive_offline', |
756 EXPECTED_FILES_IN_OFFLINE, | 828 EXPECTED_FILES_IN_OFFLINE, |
757 'drive', | 829 'drive', |
758 EXPECTED_FILES_BEFORE_DRIVE); | 830 EXPECTED_FILES_BEFORE_DRIVE); |
759 }; | 831 }; |
OLD | NEW |