| 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 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * @enum {string} | 8 * @enum {string} |
| 9 * @const | 9 * @const |
| 10 */ | 10 */ |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 * with "shared-with-me". | 220 * with "shared-with-me". |
| 221 * | 221 * |
| 222 * @type {Array.<TestEntryInfo>} | 222 * @type {Array.<TestEntryInfo>} |
| 223 * @const | 223 * @const |
| 224 */ | 224 */ |
| 225 var SHARED_WITH_ME_ENTRY_SET = [ | 225 var SHARED_WITH_ME_ENTRY_SET = [ |
| 226 ENTRIES.testSharedDocument | 226 ENTRIES.testSharedDocument |
| 227 ]; | 227 ]; |
| 228 | 228 |
| 229 /** | 229 /** |
| 230 * Opens a Files.app's main window and waits until it is initialized. | 230 * Opens a Files.app's main window. |
| 231 * |
| 232 * TODO(mtomasz): Pass a volumeId or an enum value instead of full paths. |
| 233 * |
| 234 * @param {Object} appState App state to be passed with on opening Files.app. |
| 235 * Can be null. |
| 236 * @param {?string} initialRoot Root path to be used as a default current |
| 237 * directory during initialization. Can be null, for no default path. |
| 238 * @param {function(string)} Callback with the app id. |
| 239 */ |
| 240 function openNewWindow(appState, initialRoot, callback) { |
| 241 var appId; |
| 242 |
| 243 // TODO(mtomasz): Migrate from full paths to a pair of a volumeId and a |
| 244 // relative path. To compose the URL communicate via messages with |
| 245 // file_manager_browser_test.cc. |
| 246 var processedAppState = appState || {}; |
| 247 if (initialRoot) { |
| 248 processedAppState.currentDirectoryURL = |
| 249 'filesystem:chrome-extension://' + FILE_MANAGER_EXTENSIONS_ID + |
| 250 '/external' + initialRoot; |
| 251 } |
| 252 |
| 253 callRemoteTestUtil('openMainWindow', null, [processedAppState], callback); |
| 254 } |
| 255 |
| 256 /** |
| 257 * Opens a Files.app's main window and waits until it is initialized. Fills |
| 258 * the window with initial files. Should be called for the first window only. |
| 231 * | 259 * |
| 232 * TODO(hirono): Add parameters to specify the entry set to be prepared. | 260 * TODO(hirono): Add parameters to specify the entry set to be prepared. |
| 261 * TODO(mtomasz): Pass a volumeId or an enum value instead of full paths. |
| 233 * | 262 * |
| 234 * @param {Object} appState App state to be passed with on opening Files.app. | 263 * @param {Object} appState App state to be passed with on opening Files.app. |
| 264 * Can be null. |
| 265 * @param {?string} initialRoot Root path to be used as a default current |
| 266 * directory during initialization. Can be null, for no default path. |
| 235 * @param {function(string, Array.<Array.<string>>)} Callback with the app id | 267 * @param {function(string, Array.<Array.<string>>)} Callback with the app id |
| 236 * and with the file list. | 268 * and with the file list. |
| 237 */ | 269 */ |
| 238 function setupAndWaitUntilReady(appState, callback) { | 270 function setupAndWaitUntilReady(appState, initialRoot, callback) { |
| 239 var appId; | 271 var appId; |
| 240 var steps = [ | 272 |
| 273 StepsRunner.run([ |
| 241 function() { | 274 function() { |
| 242 callRemoteTestUtil('openMainWindow', null, [appState], steps.shift()); | 275 openNewWindow(appState, initialRoot, this.next); |
| 243 }, | 276 }, |
| 244 function(inAppId) { | 277 function(inAppId) { |
| 245 appId = inAppId; | 278 appId = inAppId; |
| 246 addEntries(['local'], BASIC_LOCAL_ENTRY_SET, steps.shift()); | 279 addEntries(['local'], BASIC_LOCAL_ENTRY_SET, this.next); |
| 247 }, | 280 }, |
| 248 function(success) { | 281 function(success) { |
| 249 chrome.test.assertTrue(success); | 282 chrome.test.assertTrue(success); |
| 250 addEntries(['drive'], BASIC_DRIVE_ENTRY_SET, steps.shift()); | 283 addEntries(['drive'], BASIC_DRIVE_ENTRY_SET, this.next); |
| 251 }, | 284 }, |
| 252 function(success) { | 285 function(success) { |
| 253 chrome.test.assertTrue(success); | 286 chrome.test.assertTrue(success); |
| 254 callRemoteTestUtil('waitForFileListChange', appId, [0], steps.shift()); | 287 callRemoteTestUtil('waitForFileListChange', appId, [0], this.next); |
| 255 }, | 288 }, |
| 256 function(fileList) { | 289 function(fileList) { |
| 257 callback(appId, fileList); | 290 callback(appId, fileList); |
| 291 this.next(); |
| 258 } | 292 } |
| 259 ]; | 293 ]); |
| 260 steps.shift()(); | |
| 261 } | 294 } |
| 262 | 295 |
| 263 /** | 296 /** |
| 264 * Verifies if there are no Javascript errors in any of the app windows. | 297 * Verifies if there are no Javascript errors in any of the app windows. |
| 265 * @param {function()} Completion callback. | 298 * @param {function()} Completion callback. |
| 266 */ | 299 */ |
| 267 function checkIfNoErrorsOccured(callback) { | 300 function checkIfNoErrorsOccured(callback) { |
| 268 callRemoteTestUtil('getErrorCount', null, [], function(count) { | 301 callRemoteTestUtil('getErrorCount', null, [], function(count) { |
| 269 chrome.test.assertEq(0, count); | 302 chrome.test.assertEq(0, count); |
| 270 callback(); | 303 callback(); |
| 271 }); | 304 }); |
| 272 } | 305 } |
| 273 | 306 |
| 274 | |
| 275 | |
| 276 /** | 307 /** |
| 277 * Returns the name of the given file list entry. | 308 * Returns the name of the given file list entry. |
| 278 * @param {Array.<string>} file An entry in a file list. | 309 * @param {Array.<string>} file An entry in a file list. |
| 279 * @return {string} Name of the file. | 310 * @return {string} Name of the file. |
| 280 */ | 311 */ |
| 281 function getFileName(fileListEntry) { | 312 function getFileName(fileListEntry) { |
| 282 return fileListEntry[0]; | 313 return fileListEntry[0]; |
| 283 } | 314 } |
| 284 | 315 |
| 285 /** | 316 /** |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 | 352 |
| 322 var expectedFilesBefore = | 353 var expectedFilesBefore = |
| 323 TestEntryInfo.getExpectedRows(path == RootPath.DRIVE ? | 354 TestEntryInfo.getExpectedRows(path == RootPath.DRIVE ? |
| 324 BASIC_DRIVE_ENTRY_SET : BASIC_LOCAL_ENTRY_SET).sort(); | 355 BASIC_DRIVE_ENTRY_SET : BASIC_LOCAL_ENTRY_SET).sort(); |
| 325 | 356 |
| 326 var expectedFilesAfter = | 357 var expectedFilesAfter = |
| 327 expectedFilesBefore.concat([ENTRIES.newlyAdded.getExpectedRow()]).sort(); | 358 expectedFilesBefore.concat([ENTRIES.newlyAdded.getExpectedRow()]).sort(); |
| 328 | 359 |
| 329 StepsRunner.run([ | 360 StepsRunner.run([ |
| 330 function() { | 361 function() { |
| 331 var appState = {currentDirectoryPath: path}; | 362 setupAndWaitUntilReady(null, path, this.next); |
| 332 setupAndWaitUntilReady(appState, this.next); | |
| 333 }, | 363 }, |
| 334 // Notify that the list has been verified and a new file can be added | 364 // Notify that the list has been verified and a new file can be added |
| 335 // in file_manager_browsertest.cc. | 365 // in file_manager_browsertest.cc. |
| 336 function(inAppId, actualFilesBefore) { | 366 function(inAppId, actualFilesBefore) { |
| 337 appId = inAppId; | 367 appId = inAppId; |
| 338 chrome.test.assertEq(expectedFilesBefore, actualFilesBefore); | 368 chrome.test.assertEq(expectedFilesBefore, actualFilesBefore); |
| 339 addEntries(['local', 'drive'], [ENTRIES.newlyAdded], this.next); | 369 addEntries(['local', 'drive'], [ENTRIES.newlyAdded], this.next); |
| 340 }, | 370 }, |
| 341 function(result) { | 371 function(result) { |
| 342 chrome.test.assertTrue(result); | 372 chrome.test.assertTrue(result); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 357 /** | 387 /** |
| 358 * Tests if the gallery shows up for the selected image and that the image | 388 * Tests if the gallery shows up for the selected image and that the image |
| 359 * gets displayed. | 389 * gets displayed. |
| 360 * | 390 * |
| 361 * @param {string} path Directory path to be tested. | 391 * @param {string} path Directory path to be tested. |
| 362 */ | 392 */ |
| 363 testcase.intermediate.galleryOpen = function(path) { | 393 testcase.intermediate.galleryOpen = function(path) { |
| 364 var appId; | 394 var appId; |
| 365 StepsRunner.run([ | 395 StepsRunner.run([ |
| 366 function() { | 396 function() { |
| 367 var appState = {currentDirectoryPath: path}; | 397 setupAndWaitUntilReady(null, path, this.next); |
| 368 setupAndWaitUntilReady(appState, this.next); | |
| 369 }, | 398 }, |
| 370 // Resize the window to desired dimensions to avoid flakyness. | 399 // Resize the window to desired dimensions to avoid flakyness. |
| 371 function(inAppId) { | 400 function(inAppId) { |
| 372 appId = inAppId; | 401 appId = inAppId; |
| 373 callRemoteTestUtil('resizeWindow', | 402 callRemoteTestUtil('resizeWindow', |
| 374 appId, | 403 appId, |
| 375 [320, 320], | 404 [320, 320], |
| 376 this.next); | 405 this.next); |
| 377 }, | 406 }, |
| 378 // Select the image. | 407 // Select the image. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 * Tests if the audio player shows up for the selected image and that the audio | 445 * Tests if the audio player shows up for the selected image and that the audio |
| 417 * is loaded successfully. | 446 * is loaded successfully. |
| 418 * | 447 * |
| 419 * @param {string} path Directory path to be tested. | 448 * @param {string} path Directory path to be tested. |
| 420 */ | 449 */ |
| 421 testcase.intermediate.audioOpen = function(path) { | 450 testcase.intermediate.audioOpen = function(path) { |
| 422 var appId; | 451 var appId; |
| 423 var audioAppId; | 452 var audioAppId; |
| 424 StepsRunner.run([ | 453 StepsRunner.run([ |
| 425 function() { | 454 function() { |
| 426 var appState = {currentDirectoryPath: path}; | 455 setupAndWaitUntilReady(null, path, this.next); |
| 427 setupAndWaitUntilReady(appState, this.next); | |
| 428 }, | 456 }, |
| 429 // Select the song. | 457 // Select the song. |
| 430 function(inAppId) { | 458 function(inAppId) { |
| 431 appId = inAppId; | 459 appId = inAppId; |
| 432 callRemoteTestUtil( | 460 callRemoteTestUtil( |
| 433 'openFile', appId, ['Beautiful Song.ogg'], this.next); | 461 'openFile', appId, ['Beautiful Song.ogg'], this.next); |
| 434 }, | 462 }, |
| 435 // Wait for the audio player. | 463 // Wait for the audio player. |
| 436 function(result) { | 464 function(result) { |
| 437 chrome.test.assertTrue(result); | 465 chrome.test.assertTrue(result); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 * Tests if the video player shows up for the selected movie and that it is | 507 * Tests if the video player shows up for the selected movie and that it is |
| 480 * loaded successfully. | 508 * loaded successfully. |
| 481 * | 509 * |
| 482 * @param {string} path Directory path to be tested. | 510 * @param {string} path Directory path to be tested. |
| 483 */ | 511 */ |
| 484 testcase.intermediate.videoOpen = function(path) { | 512 testcase.intermediate.videoOpen = function(path) { |
| 485 var appId; | 513 var appId; |
| 486 var videoAppId; | 514 var videoAppId; |
| 487 StepsRunner.run([ | 515 StepsRunner.run([ |
| 488 function() { | 516 function() { |
| 489 var appState = {currentDirectoryPath: path}; | 517 setupAndWaitUntilReady(null, path, this.next); |
| 490 setupAndWaitUntilReady(appState, this.next); | |
| 491 }, | 518 }, |
| 492 function(inAppId) { | 519 function(inAppId) { |
| 493 appId = inAppId; | 520 appId = inAppId; |
| 494 // Select the song. | 521 // Select the song. |
| 495 callRemoteTestUtil( | 522 callRemoteTestUtil( |
| 496 'openFile', appId, ['world.ogv'], this.next); | 523 'openFile', appId, ['world.ogv'], this.next); |
| 497 }, | 524 }, |
| 498 function(result) { | 525 function(result) { |
| 499 chrome.test.assertTrue(result); | 526 chrome.test.assertTrue(result); |
| 500 // Wait for the video player. | 527 // Wait for the video player. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 var expectedFilesBefore = | 567 var expectedFilesBefore = |
| 541 TestEntryInfo.getExpectedRows(path == RootPath.DRIVE ? | 568 TestEntryInfo.getExpectedRows(path == RootPath.DRIVE ? |
| 542 BASIC_DRIVE_ENTRY_SET : BASIC_LOCAL_ENTRY_SET).sort(); | 569 BASIC_DRIVE_ENTRY_SET : BASIC_LOCAL_ENTRY_SET).sort(); |
| 543 var expectedFilesAfter = | 570 var expectedFilesAfter = |
| 544 expectedFilesBefore.concat([['world (1).ogv', '59 KB', 'OGG video']]); | 571 expectedFilesBefore.concat([['world (1).ogv', '59 KB', 'OGG video']]); |
| 545 | 572 |
| 546 var appId, fileListBefore; | 573 var appId, fileListBefore; |
| 547 StepsRunner.run([ | 574 StepsRunner.run([ |
| 548 // Set up File Manager. | 575 // Set up File Manager. |
| 549 function() { | 576 function() { |
| 550 var appState = {currentDirectoryPath: path}; | 577 setupAndWaitUntilReady(null, path, this.next); |
| 551 setupAndWaitUntilReady(appState, this.next); | |
| 552 }, | 578 }, |
| 553 // Copy the file. | 579 // Copy the file. |
| 554 function(inAppId, inFileListBefore) { | 580 function(inAppId, inFileListBefore) { |
| 555 appId = inAppId; | 581 appId = inAppId; |
| 556 fileListBefore = inFileListBefore; | 582 fileListBefore = inFileListBefore; |
| 557 chrome.test.assertEq(expectedFilesBefore, inFileListBefore); | 583 chrome.test.assertEq(expectedFilesBefore, inFileListBefore); |
| 558 callRemoteTestUtil('copyFile', appId, [filename], this.next); | 584 callRemoteTestUtil('copyFile', appId, [filename], this.next); |
| 559 }, | 585 }, |
| 560 // Wait for a file list change. | 586 // Wait for a file list change. |
| 561 function(result) { | 587 function(result) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 586 } | 612 } |
| 587 return false; | 613 return false; |
| 588 }; | 614 }; |
| 589 | 615 |
| 590 var filename = 'world.ogv'; | 616 var filename = 'world.ogv'; |
| 591 var directoryName = 'photos'; | 617 var directoryName = 'photos'; |
| 592 var appId, fileListBefore; | 618 var appId, fileListBefore; |
| 593 StepsRunner.run([ | 619 StepsRunner.run([ |
| 594 // Set up File Manager. | 620 // Set up File Manager. |
| 595 function() { | 621 function() { |
| 596 var appState = {currentDirectoryPath: path}; | 622 setupAndWaitUntilReady(null, path, this.next); |
| 597 setupAndWaitUntilReady(appState, this.next); | |
| 598 }, | 623 }, |
| 599 // Delete the file. | 624 // Delete the file. |
| 600 function(inAppId, inFileListBefore) { | 625 function(inAppId, inFileListBefore) { |
| 601 appId = inAppId; | 626 appId = inAppId; |
| 602 fileListBefore = inFileListBefore; | 627 fileListBefore = inFileListBefore; |
| 603 chrome.test.assertTrue(isFilePresent(filename, fileListBefore)); | 628 chrome.test.assertTrue(isFilePresent(filename, fileListBefore)); |
| 604 callRemoteTestUtil( | 629 callRemoteTestUtil( |
| 605 'deleteFile', appId, [filename], this.next); | 630 'deleteFile', appId, [filename], this.next); |
| 606 }, | 631 }, |
| 607 // Reply to a dialog. | 632 // Reply to a dialog. |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 /** | 718 /** |
| 694 * Tests opening the "Recent" on the sidebar navigation by clicking the icon, | 719 * Tests opening the "Recent" on the sidebar navigation by clicking the icon, |
| 695 * and verifies the directory contents. We test if there are only files, since | 720 * and verifies the directory contents. We test if there are only files, since |
| 696 * directories are not allowed in "Recent". This test is only available for | 721 * directories are not allowed in "Recent". This test is only available for |
| 697 * Drive. | 722 * Drive. |
| 698 */ | 723 */ |
| 699 testcase.openSidebarRecent = function() { | 724 testcase.openSidebarRecent = function() { |
| 700 var appId; | 725 var appId; |
| 701 StepsRunner.run([ | 726 StepsRunner.run([ |
| 702 function() { | 727 function() { |
| 703 var appState = {currentDirectoryPath: RootPath.DRIVE}; | 728 setupAndWaitUntilReady(null, RootPath.DRIVE, this.next); |
| 704 setupAndWaitUntilReady(appState, this.next); | |
| 705 }, | 729 }, |
| 706 // Click the icon of the Recent volume. | 730 // Click the icon of the Recent volume. |
| 707 function(inAppId) { | 731 function(inAppId) { |
| 708 appId = inAppId; | 732 appId = inAppId; |
| 709 callRemoteTestUtil( | 733 callRemoteTestUtil( |
| 710 'selectVolume', appId, ['drive_recent'], this.next); | 734 'selectVolume', appId, ['drive_recent'], this.next); |
| 711 }, | 735 }, |
| 712 // Wait until the file list is updated. | 736 // Wait until the file list is updated. |
| 713 function(result) { | 737 function(result) { |
| 714 chrome.test.assertFalse(!result); | 738 chrome.test.assertFalse(!result); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 731 /** | 755 /** |
| 732 * Tests opening the "Offline" on the sidebar navigation by clicking the icon, | 756 * Tests opening the "Offline" on the sidebar navigation by clicking the icon, |
| 733 * and checks contenets of the file list. Only the entries "available offline" | 757 * and checks contenets of the file list. Only the entries "available offline" |
| 734 * should be shown. "Available offline" entires are hosted documents and the | 758 * should be shown. "Available offline" entires are hosted documents and the |
| 735 * entries cached by DriveCache. | 759 * entries cached by DriveCache. |
| 736 */ | 760 */ |
| 737 testcase.openSidebarOffline = function() { | 761 testcase.openSidebarOffline = function() { |
| 738 var appId; | 762 var appId; |
| 739 StepsRunner.run([ | 763 StepsRunner.run([ |
| 740 function() { | 764 function() { |
| 741 var appState = {currentDirectoryPath: RootPath.DRIVE}; | 765 setupAndWaitUntilReady(null, RootPath.DRIVE, this.next); |
| 742 setupAndWaitUntilReady(appState, this.next); | |
| 743 }, | 766 }, |
| 744 // Click the icon of the Offline volume. | 767 // Click the icon of the Offline volume. |
| 745 function(inAppId) { | 768 function(inAppId) { |
| 746 appId = inAppId; | 769 appId = inAppId; |
| 747 callRemoteTestUtil( | 770 callRemoteTestUtil( |
| 748 'selectVolume', appId, ['drive_offline'], this.next); | 771 'selectVolume', appId, ['drive_offline'], this.next); |
| 749 }, | 772 }, |
| 750 // Wait until the file list is updated. | 773 // Wait until the file list is updated. |
| 751 function(result) { | 774 function(result) { |
| 752 chrome.test.assertFalse(!result); | 775 chrome.test.assertFalse(!result); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 768 | 791 |
| 769 /** | 792 /** |
| 770 * Tests opening the "Shared with me" on the sidebar navigation by clicking the | 793 * Tests opening the "Shared with me" on the sidebar navigation by clicking the |
| 771 * icon, and checks contents of the file list. Only the entries labeled with | 794 * icon, and checks contents of the file list. Only the entries labeled with |
| 772 * "shared-with-me" should be shown. | 795 * "shared-with-me" should be shown. |
| 773 */ | 796 */ |
| 774 testcase.openSidebarSharedWithMe = function() { | 797 testcase.openSidebarSharedWithMe = function() { |
| 775 var appId; | 798 var appId; |
| 776 StepsRunner.run([ | 799 StepsRunner.run([ |
| 777 function() { | 800 function() { |
| 778 var appState = {currentDirectoryPath: RootPath.DRIVE}; | 801 setupAndWaitUntilReady(null, RootPath.DRIVE, this.next); |
| 779 setupAndWaitUntilReady(appState, this.next); | |
| 780 }, | 802 }, |
| 781 // Click the icon of the Shared With Me volume. | 803 // Click the icon of the Shared With Me volume. |
| 782 function(inAppId) { | 804 function(inAppId) { |
| 783 appId = inAppId; | 805 appId = inAppId; |
| 784 // Use the icon for a click target. | 806 // Use the icon for a click target. |
| 785 callRemoteTestUtil('selectVolume', | 807 callRemoteTestUtil('selectVolume', |
| 786 appId, | 808 appId, |
| 787 ['drive_shared_with_me'], this.next); | 809 ['drive_shared_with_me'], this.next); |
| 788 }, | 810 }, |
| 789 // Wait until the file list is updated. | 811 // Wait until the file list is updated. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 810 * Drive. | 832 * Drive. |
| 811 */ | 833 */ |
| 812 testcase.autocomplete = function() { | 834 testcase.autocomplete = function() { |
| 813 var EXPECTED_AUTOCOMPLETE_LIST = [ | 835 var EXPECTED_AUTOCOMPLETE_LIST = [ |
| 814 '\'hello\' - search Drive\n', | 836 '\'hello\' - search Drive\n', |
| 815 'hello.txt\n', | 837 'hello.txt\n', |
| 816 ]; | 838 ]; |
| 817 | 839 |
| 818 StepsRunner.run([ | 840 StepsRunner.run([ |
| 819 function() { | 841 function() { |
| 820 var appState = {currentDirectoryPath: RootPath.DRIVE}; | 842 setupAndWaitUntilReady(null, RootPath.DRIVE, this.next); |
| 821 setupAndWaitUntilReady(appState, this.next); | |
| 822 }, | 843 }, |
| 823 // Perform an auto complete test and wait until the list changes. | 844 // Perform an auto complete test and wait until the list changes. |
| 824 // TODO(mtomasz): Move the operation from test_util.js to tests_cases.js. | 845 // TODO(mtomasz): Move the operation from test_util.js to tests_cases.js. |
| 825 function(appId, list) { | 846 function(appId, list) { |
| 826 callRemoteTestUtil('performAutocompleteAndWait', | 847 callRemoteTestUtil('performAutocompleteAndWait', |
| 827 appId, | 848 appId, |
| 828 ['hello', EXPECTED_AUTOCOMPLETE_LIST.length], | 849 ['hello', EXPECTED_AUTOCOMPLETE_LIST.length], |
| 829 this.next); | 850 this.next); |
| 830 }, | 851 }, |
| 831 // Verify the list contents. | 852 // Verify the list contents. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 852 srcEntries, | 873 srcEntries, |
| 853 dstName, | 874 dstName, |
| 854 dstEntries) { | 875 dstEntries) { |
| 855 var srcContents = TestEntryInfo.getExpectedRows(srcEntries).sort(); | 876 var srcContents = TestEntryInfo.getExpectedRows(srcEntries).sort(); |
| 856 var dstContents = TestEntryInfo.getExpectedRows(dstEntries).sort(); | 877 var dstContents = TestEntryInfo.getExpectedRows(dstEntries).sort(); |
| 857 | 878 |
| 858 var appId; | 879 var appId; |
| 859 StepsRunner.run([ | 880 StepsRunner.run([ |
| 860 // Set up File Manager. | 881 // Set up File Manager. |
| 861 function() { | 882 function() { |
| 862 var appState = {currentDirectoryPath: RootPath.DOWNLOADS}; | 883 setupAndWaitUntilReady(null, RootPath.DOWNLOADS, this.next); |
| 863 setupAndWaitUntilReady(appState, this.next); | |
| 864 }, | 884 }, |
| 865 // Select the source volume. | 885 // Select the source volume. |
| 866 function(inAppId) { | 886 function(inAppId) { |
| 867 appId = inAppId; | 887 appId = inAppId; |
| 868 callRemoteTestUtil( | 888 callRemoteTestUtil( |
| 869 'selectVolume', appId, [srcName], this.next); | 889 'selectVolume', appId, [srcName], this.next); |
| 870 }, | 890 }, |
| 871 // Wait for the expected files to appear in the file list. | 891 // Wait for the expected files to appear in the file list. |
| 872 function(result) { | 892 function(result) { |
| 873 chrome.test.assertTrue(result); | 893 chrome.test.assertTrue(result); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 | 970 |
| 951 /** | 971 /** |
| 952 * Test sharing dialog for a file or directory on Drive | 972 * Test sharing dialog for a file or directory on Drive |
| 953 * @param {string} path Path for a file or a directory to be shared. | 973 * @param {string} path Path for a file or a directory to be shared. |
| 954 */ | 974 */ |
| 955 testcase.intermediate.share = function(path) { | 975 testcase.intermediate.share = function(path) { |
| 956 var appId; | 976 var appId; |
| 957 StepsRunner.run([ | 977 StepsRunner.run([ |
| 958 // Set up File Manager. | 978 // Set up File Manager. |
| 959 function() { | 979 function() { |
| 960 var appState = {currentDirectoryPath: RootPath.DRIVE}; | 980 setupAndWaitUntilReady(null, RootPath.DRIVE, this.next); |
| 961 setupAndWaitUntilReady(appState, this.next); | |
| 962 }, | 981 }, |
| 963 // Select the source file. | 982 // Select the source file. |
| 964 function(inAppId) { | 983 function(inAppId) { |
| 965 appId = inAppId; | 984 appId = inAppId; |
| 966 callRemoteTestUtil( | 985 callRemoteTestUtil( |
| 967 'selectFile', appId, [path], this.next); | 986 'selectFile', appId, [path], this.next); |
| 968 }, | 987 }, |
| 969 // Wait for the share button. | 988 // Wait for the share button. |
| 970 function(result) { | 989 function(result) { |
| 971 chrome.test.assertTrue(result); | 990 chrome.test.assertTrue(result); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1022 }, | 1041 }, |
| 1023 // Check for Javascript errros. | 1042 // Check for Javascript errros. |
| 1024 function() { | 1043 function() { |
| 1025 checkIfNoErrorsOccured(this.next); | 1044 checkIfNoErrorsOccured(this.next); |
| 1026 } | 1045 } |
| 1027 ]); | 1046 ]); |
| 1028 }; | 1047 }; |
| 1029 | 1048 |
| 1030 /** | 1049 /** |
| 1031 * Test utility for traverse tests. | 1050 * Test utility for traverse tests. |
| 1051 * @param {string} path Root path to be traversed. |
| 1032 */ | 1052 */ |
| 1033 testcase.intermediate.traverseDirectories = function(root) { | 1053 testcase.intermediate.traverseDirectories = function(path) { |
| 1034 var appId; | 1054 var appId; |
| 1035 StepsRunner.run([ | 1055 StepsRunner.run([ |
| 1036 // Set up File Manager. | 1056 // Set up File Manager. Do not add initial files. |
| 1037 function() { | 1057 function() { |
| 1038 var appState = {currentDirectoryPath: root}; | 1058 openNewWindow(null, path, this.next); |
| 1039 callRemoteTestUtil('openMainWindow', null, [appState], this.next); | |
| 1040 }, | 1059 }, |
| 1041 // Check the initial view. | 1060 // Check the initial view. |
| 1042 function(inAppId) { | 1061 function(inAppId) { |
| 1043 appId = inAppId; | 1062 appId = inAppId; |
| 1044 addEntries(['local', 'drive'], NESTED_ENTRY_SET, this.next); | 1063 addEntries(['local', 'drive'], NESTED_ENTRY_SET, this.next); |
| 1045 }, | 1064 }, |
| 1046 function(result) { | 1065 function(result) { |
| 1047 chrome.test.assertTrue(result); | 1066 chrome.test.assertTrue(result); |
| 1048 callRemoteTestUtil('waitForFiles', | 1067 callRemoteTestUtil('waitForFiles', |
| 1049 appId, | 1068 appId, |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1186 testcase.executeDefaultTaskOnDrive = function(root) { | 1205 testcase.executeDefaultTaskOnDrive = function(root) { |
| 1187 testcase.intermediate.executeDefaultTask(true); | 1206 testcase.intermediate.executeDefaultTask(true); |
| 1188 }; | 1207 }; |
| 1189 | 1208 |
| 1190 testcase.executeDefaultTaskOnDownloads = function(root) { | 1209 testcase.executeDefaultTaskOnDownloads = function(root) { |
| 1191 testcase.intermediate.executeDefaultTask(false); | 1210 testcase.intermediate.executeDefaultTask(false); |
| 1192 }; | 1211 }; |
| 1193 | 1212 |
| 1194 /** | 1213 /** |
| 1195 * Tests executing the default task when there is only one task. | 1214 * Tests executing the default task when there is only one task. |
| 1215 * @param {boolean} drive Whether to test Drive or Downloads. |
| 1196 */ | 1216 */ |
| 1197 testcase.intermediate.executeDefaultTask = function(drive) { | 1217 testcase.intermediate.executeDefaultTask = function(drive) { |
| 1198 var root = drive ? RootPath.DRIVE : RootPath.DOWNLOADS; | 1218 var path = drive ? RootPath.DRIVE : RootPath.DOWNLOADS; |
| 1199 var taskId = drive ? 'dummytaskid|drive|open-with' : 'dummytaskid|open-with' | 1219 var taskId = drive ? 'dummytaskid|drive|open-with' : 'dummytaskid|open-with' |
| 1200 var appId; | 1220 var appId; |
| 1201 StepsRunner.run([ | 1221 StepsRunner.run([ |
| 1202 // Set up File Manager. | 1222 // Set up File Manager. |
| 1203 function() { | 1223 function() { |
| 1204 var appState = { | 1224 setupAndWaitUntilReady(null, path, this.next); |
| 1205 currentDirectoryPath: root | |
| 1206 }; | |
| 1207 setupAndWaitUntilReady(appState, this.next); | |
| 1208 }, | 1225 }, |
| 1209 // Override tasks list with a dummy task. | 1226 // Override tasks list with a dummy task. |
| 1210 function(inAppId, inFileListBefore) { | 1227 function(inAppId, inFileListBefore) { |
| 1211 appId = inAppId; | 1228 appId = inAppId; |
| 1212 | 1229 |
| 1213 callRemoteTestUtil( | 1230 callRemoteTestUtil( |
| 1214 'overrideTasks', | 1231 'overrideTasks', |
| 1215 appId, | 1232 appId, |
| 1216 [[ | 1233 [[ |
| 1217 { | 1234 { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1265 function() { | 1282 function() { |
| 1266 chrome.test.sendMessage( | 1283 chrome.test.sendMessage( |
| 1267 JSON.stringify({name: 'getCwsWidgetContainerMockUrl'}), | 1284 JSON.stringify({name: 'getCwsWidgetContainerMockUrl'}), |
| 1268 this.next); | 1285 this.next); |
| 1269 }, | 1286 }, |
| 1270 // Override the container URL with the mock. | 1287 // Override the container URL with the mock. |
| 1271 function(json) { | 1288 function(json) { |
| 1272 var data = JSON.parse(json); | 1289 var data = JSON.parse(json); |
| 1273 | 1290 |
| 1274 var appState = { | 1291 var appState = { |
| 1275 currentDirectoryPath: RootPath.DRIVE, | |
| 1276 suggestAppsDialogState: { | 1292 suggestAppsDialogState: { |
| 1277 overrideCwsContainerUrlForTest: data.url, | 1293 overrideCwsContainerUrlForTest: data.url, |
| 1278 overrideCwsContainerOriginForTest: data.origin | 1294 overrideCwsContainerOriginForTest: data.origin |
| 1279 } | 1295 } |
| 1280 }; | 1296 }; |
| 1281 setupAndWaitUntilReady(appState, this.next); | 1297 setupAndWaitUntilReady(appState, RootPath.DRIVE, this.next); |
| 1282 }, | 1298 }, |
| 1283 function(inAppId, inFileListBefore) { | 1299 function(inAppId, inFileListBefore) { |
| 1284 appId = inAppId; | 1300 appId = inAppId; |
| 1285 | 1301 |
| 1286 callRemoteTestUtil( | 1302 callRemoteTestUtil( |
| 1287 'selectFile', appId, ['unsupported.foo'], this.next); | 1303 'selectFile', appId, ['unsupported.foo'], this.next); |
| 1288 }, | 1304 }, |
| 1289 // Double-click the file. | 1305 // Double-click the file. |
| 1290 function(result) { | 1306 function(result) { |
| 1291 chrome.test.assertTrue(result); | 1307 chrome.test.assertTrue(result); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1379 }; | 1395 }; |
| 1380 | 1396 |
| 1381 /** | 1397 /** |
| 1382 * Tests hiding the search box. | 1398 * Tests hiding the search box. |
| 1383 */ | 1399 */ |
| 1384 testcase.hideSearchBox = function() { | 1400 testcase.hideSearchBox = function() { |
| 1385 var appId; | 1401 var appId; |
| 1386 StepsRunner.run([ | 1402 StepsRunner.run([ |
| 1387 // Set up File Manager. | 1403 // Set up File Manager. |
| 1388 function() { | 1404 function() { |
| 1389 var appState = {currentDirectoryPath: RootPath.DOWNLOADS}; | 1405 setupAndWaitUntilReady(null, RootPath.DOWNLOADS, this.next); |
| 1390 setupAndWaitUntilReady(appState, this.next); | |
| 1391 }, | 1406 }, |
| 1392 // Resize the window. | 1407 // Resize the window. |
| 1393 function(inAppId, inFileListBefore) { | 1408 function(inAppId, inFileListBefore) { |
| 1394 appId = inAppId; | 1409 appId = inAppId; |
| 1395 callRemoteTestUtil('resizeWindow', appId, [100, 100], this.next); | 1410 callRemoteTestUtil('resizeWindow', appId, [100, 100], this.next); |
| 1396 }, | 1411 }, |
| 1397 // Wait for the style change. | 1412 // Wait for the style change. |
| 1398 function(result) { | 1413 function(result) { |
| 1399 chrome.test.assertTrue(result); | 1414 chrome.test.assertTrue(result); |
| 1400 callRemoteTestUtil('waitForStyles', | 1415 callRemoteTestUtil('waitForStyles', |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1420 var EXPECTED_FILES = TestEntryInfo.getExpectedRows([ | 1435 var EXPECTED_FILES = TestEntryInfo.getExpectedRows([ |
| 1421 ENTRIES.world, | 1436 ENTRIES.world, |
| 1422 ENTRIES.photos, | 1437 ENTRIES.photos, |
| 1423 ENTRIES.desktop, | 1438 ENTRIES.desktop, |
| 1424 ENTRIES.hello, | 1439 ENTRIES.hello, |
| 1425 ENTRIES.beautiful | 1440 ENTRIES.beautiful |
| 1426 ]); | 1441 ]); |
| 1427 StepsRunner.run([ | 1442 StepsRunner.run([ |
| 1428 // Set up File Manager. | 1443 // Set up File Manager. |
| 1429 function() { | 1444 function() { |
| 1430 var appState = {currentDirectoryPath: RootPath.DOWNLOADS}; | 1445 setupAndWaitUntilReady(null, RootPath.DOWNLOADS, this.next); |
| 1431 setupAndWaitUntilReady(appState, this.next); | |
| 1432 }, | 1446 }, |
| 1433 // Sort by name. | 1447 // Sort by name. |
| 1434 function(inAppId) { | 1448 function(inAppId) { |
| 1435 appId = inAppId; | 1449 appId = inAppId; |
| 1436 callRemoteTestUtil('fakeMouseClick', | 1450 callRemoteTestUtil('fakeMouseClick', |
| 1437 appId, | 1451 appId, |
| 1438 ['.table-header-cell:nth-of-type(1)'], | 1452 ['.table-header-cell:nth-of-type(1)'], |
| 1439 this.next); | 1453 this.next); |
| 1440 }, | 1454 }, |
| 1441 // Check the sorted style of the header. | 1455 // Check the sorted style of the header. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1461 }, | 1475 }, |
| 1462 // Check the sorted files. | 1476 // Check the sorted files. |
| 1463 function() { | 1477 function() { |
| 1464 callRemoteTestUtil('waitForFiles', | 1478 callRemoteTestUtil('waitForFiles', |
| 1465 appId, | 1479 appId, |
| 1466 [EXPECTED_FILES, {orderCheck: true}], | 1480 [EXPECTED_FILES, {orderCheck: true}], |
| 1467 this.next); | 1481 this.next); |
| 1468 }, | 1482 }, |
| 1469 // Open another window, where the sorted column should be restored. | 1483 // Open another window, where the sorted column should be restored. |
| 1470 function() { | 1484 function() { |
| 1471 var appState = {currentDirectoryPath: RootPath.DOWNLOADS}; | 1485 setupAndWaitUntilReady(null, RootPath.DOWNLOADS, this.next); |
| 1472 setupAndWaitUntilReady(appState, this.next); | |
| 1473 }, | 1486 }, |
| 1474 // Check the sorted style of the header. | 1487 // Check the sorted style of the header. |
| 1475 function(inAppId) { | 1488 function(inAppId) { |
| 1476 appId = inAppId; | 1489 appId = inAppId; |
| 1477 callRemoteTestUtil('waitForElement', | 1490 callRemoteTestUtil('waitForElement', |
| 1478 appId, | 1491 appId, |
| 1479 ['.table-header-sort-image-desc'], | 1492 ['.table-header-sort-image-desc'], |
| 1480 this.next); | 1493 this.next); |
| 1481 }, | 1494 }, |
| 1482 // Check the sorted files. | 1495 // Check the sorted files. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1494 }; | 1507 }; |
| 1495 | 1508 |
| 1496 /** | 1509 /** |
| 1497 * Tests restoring the current view (the file list or the thumbnail grid). | 1510 * Tests restoring the current view (the file list or the thumbnail grid). |
| 1498 */ | 1511 */ |
| 1499 testcase.restoreCurrentView = function() { | 1512 testcase.restoreCurrentView = function() { |
| 1500 var appId; | 1513 var appId; |
| 1501 StepsRunner.run([ | 1514 StepsRunner.run([ |
| 1502 // Set up File Manager. | 1515 // Set up File Manager. |
| 1503 function() { | 1516 function() { |
| 1504 var appState = {currentDirectoryPath: RootPath.DOWNLOADS}; | 1517 setupAndWaitUntilReady(null, RootPath.DOWNLOADS, this.next); |
| 1505 setupAndWaitUntilReady(appState, this.next); | |
| 1506 }, | 1518 }, |
| 1507 // Check the initial view. | 1519 // Check the initial view. |
| 1508 function(inAppId) { | 1520 function(inAppId) { |
| 1509 appId = inAppId; | 1521 appId = inAppId; |
| 1510 callRemoteTestUtil('waitForElement', | 1522 callRemoteTestUtil('waitForElement', |
| 1511 appId, | 1523 appId, |
| 1512 ['.thumbnail-grid[hidden]'], | 1524 ['.thumbnail-grid[hidden]'], |
| 1513 this.next); | 1525 this.next); |
| 1514 }, | 1526 }, |
| 1515 // Opens the gear menu. | 1527 // Opens the gear menu. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1529 // Check the new current view. | 1541 // Check the new current view. |
| 1530 function(result) { | 1542 function(result) { |
| 1531 chrome.test.assertTrue(result); | 1543 chrome.test.assertTrue(result); |
| 1532 callRemoteTestUtil('waitForElement', | 1544 callRemoteTestUtil('waitForElement', |
| 1533 appId, | 1545 appId, |
| 1534 ['.detail-table[hidden]'], | 1546 ['.detail-table[hidden]'], |
| 1535 this.next); | 1547 this.next); |
| 1536 }, | 1548 }, |
| 1537 // Open another window, where the current view is restored. | 1549 // Open another window, where the current view is restored. |
| 1538 function() { | 1550 function() { |
| 1539 var appState = {currentDirectoryPath: RootPath.DOWNLOADS}; | 1551 openNewWindow(null, RootPath.DOWNLOADS, this.next); |
| 1540 callRemoteTestUtil('openMainWindow', null, [appState], this.next); | |
| 1541 }, | 1552 }, |
| 1542 // Check the current view. | 1553 // Check the current view. |
| 1543 function(inAppId) { | 1554 function(inAppId) { |
| 1544 appId = inAppId; | 1555 appId = inAppId; |
| 1545 callRemoteTestUtil('waitForElement', | 1556 callRemoteTestUtil('waitForElement', |
| 1546 appId, | 1557 appId, |
| 1547 ['.detail-table[hidden]'], | 1558 ['.detail-table[hidden]'], |
| 1548 this.next); | 1559 this.next); |
| 1549 }, | 1560 }, |
| 1550 // Check the error. | 1561 // Check the error. |
| 1551 function() { | 1562 function() { |
| 1552 checkIfNoErrorsOccured(this.next); | 1563 checkIfNoErrorsOccured(this.next); |
| 1553 } | 1564 } |
| 1554 ]); | 1565 ]); |
| 1555 }; | 1566 }; |
| 1556 | 1567 |
| 1557 /** | 1568 /** |
| 1558 * Tests keyboard operations of the navigation list. | 1569 * Tests keyboard operations of the navigation list. |
| 1559 */ | 1570 */ |
| 1560 testcase.traverseNavigationList = function() { | 1571 testcase.traverseNavigationList = function() { |
| 1561 var appId; | 1572 var appId; |
| 1562 StepsRunner.run([ | 1573 StepsRunner.run([ |
| 1563 // Set up File Manager. | 1574 // Set up File Manager. |
| 1564 function() { | 1575 function() { |
| 1565 var appState = {currentDirectoryPath: RootPath.DRIVE}; | 1576 setupAndWaitUntilReady(null, RootPath.DRIVE, this.next); |
| 1566 setupAndWaitUntilReady(appState, this.next); | |
| 1567 }, | 1577 }, |
| 1568 // Wait until Google Drive is selected. | 1578 // Wait until Google Drive is selected. |
| 1569 function(inAppId) { | 1579 function(inAppId) { |
| 1570 appId = inAppId; | 1580 appId = inAppId; |
| 1571 callRemoteTestUtil( | 1581 callRemoteTestUtil( |
| 1572 'waitForElement', | 1582 'waitForElement', |
| 1573 appId, | 1583 appId, |
| 1574 ['#navigation-list > .root-item > ' + | 1584 ['#navigation-list > .root-item > ' + |
| 1575 '.volume-icon[volume-type-icon="drive"]'], | 1585 '.volume-icon[volume-type-icon="drive"]'], |
| 1576 this.next); | 1586 this.next); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1651 | 1661 |
| 1652 /** | 1662 /** |
| 1653 * Tests restoring geometry of the Files app. | 1663 * Tests restoring geometry of the Files app. |
| 1654 */ | 1664 */ |
| 1655 testcase.restoreGeometry = function() { | 1665 testcase.restoreGeometry = function() { |
| 1656 var appId; | 1666 var appId; |
| 1657 var appId2; | 1667 var appId2; |
| 1658 StepsRunner.run([ | 1668 StepsRunner.run([ |
| 1659 // Set up File Manager. | 1669 // Set up File Manager. |
| 1660 function() { | 1670 function() { |
| 1661 var appState = {currentDirectoryPath: RootPath.DOWNLOADS}; | 1671 setupAndWaitUntilReady(null, RootPath.DOWNLOADS, this.next); |
| 1662 setupAndWaitUntilReady(appState, this.next); | |
| 1663 }, | 1672 }, |
| 1664 // Resize the window to minimal dimensions. | 1673 // Resize the window to minimal dimensions. |
| 1665 function(inAppId) { | 1674 function(inAppId) { |
| 1666 appId = inAppId; | 1675 appId = inAppId; |
| 1667 callRemoteTestUtil( | 1676 callRemoteTestUtil( |
| 1668 'resizeWindow', appId, [640, 480], this.next); | 1677 'resizeWindow', appId, [640, 480], this.next); |
| 1669 }, | 1678 }, |
| 1670 // Check the current window's size. | 1679 // Check the current window's size. |
| 1671 function(inAppId) { | 1680 function(inAppId) { |
| 1672 callRemoteTestUtil('waitForWindowGeometry', | 1681 callRemoteTestUtil('waitForWindowGeometry', |
| 1673 appId, | 1682 appId, |
| 1674 [640, 480], | 1683 [640, 480], |
| 1675 this.next); | 1684 this.next); |
| 1676 }, | 1685 }, |
| 1677 // Enlarge the window by 10 pixels. | 1686 // Enlarge the window by 10 pixels. |
| 1678 function(result) { | 1687 function(result) { |
| 1679 callRemoteTestUtil( | 1688 callRemoteTestUtil( |
| 1680 'resizeWindow', appId, [650, 490], this.next); | 1689 'resizeWindow', appId, [650, 490], this.next); |
| 1681 }, | 1690 }, |
| 1682 // Check the current window's size. | 1691 // Check the current window's size. |
| 1683 function() { | 1692 function() { |
| 1684 callRemoteTestUtil('waitForWindowGeometry', | 1693 callRemoteTestUtil('waitForWindowGeometry', |
| 1685 appId, | 1694 appId, |
| 1686 [650, 490], | 1695 [650, 490], |
| 1687 this.next); | 1696 this.next); |
| 1688 }, | 1697 }, |
| 1689 // Open another window, where the current view is restored. | 1698 // Open another window, where the current view is restored. |
| 1690 function() { | 1699 function() { |
| 1691 var appState = {currentDirectoryPath: RootPath.DOWNLOADS}; | 1700 setupAndWaitUntilReady(null, RootPath.DOWNLOADS, this.next); |
| 1692 setupAndWaitUntilReady(appState, this.next); | |
| 1693 }, | 1701 }, |
| 1694 // Check the next window's size. | 1702 // Check the next window's size. |
| 1695 function(inAppId) { | 1703 function(inAppId) { |
| 1696 appId2 = inAppId; | 1704 appId2 = inAppId; |
| 1697 callRemoteTestUtil('waitForWindowGeometry', | 1705 callRemoteTestUtil('waitForWindowGeometry', |
| 1698 appId2, | 1706 appId2, |
| 1699 [650, 490], | 1707 [650, 490], |
| 1700 this.next); | 1708 this.next); |
| 1701 }, | 1709 }, |
| 1702 // Check for errors. | 1710 // Check for errors. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1719 testcase.intermediate.traverseDirectories.bind(null, RootPath.DRIVE); | 1727 testcase.intermediate.traverseDirectories.bind(null, RootPath.DRIVE); |
| 1720 | 1728 |
| 1721 /** | 1729 /** |
| 1722 * Tests the focus behavior of the search box. | 1730 * Tests the focus behavior of the search box. |
| 1723 */ | 1731 */ |
| 1724 testcase.searchBoxFocus = function() { | 1732 testcase.searchBoxFocus = function() { |
| 1725 var appId; | 1733 var appId; |
| 1726 StepsRunner.run([ | 1734 StepsRunner.run([ |
| 1727 // Set up File Manager. | 1735 // Set up File Manager. |
| 1728 function() { | 1736 function() { |
| 1729 var appState = {currentDirectoryPath: RootPath.DRIVE}; | 1737 setupAndWaitUntilReady(null, RootPath.DRIVE, this.next); |
| 1730 setupAndWaitUntilReady(appState, this.next); | |
| 1731 }, | 1738 }, |
| 1732 // Check that the file list has the focus on launch. | 1739 // Check that the file list has the focus on launch. |
| 1733 function(inAppId) { | 1740 function(inAppId) { |
| 1734 appId = inAppId; | 1741 appId = inAppId; |
| 1735 callRemoteTestUtil( | 1742 callRemoteTestUtil( |
| 1736 'waitForElement', appId, ['#file-list:focus'], this.next); | 1743 'waitForElement', appId, ['#file-list:focus'], this.next); |
| 1737 }, | 1744 }, |
| 1738 // Press the Ctrl-F key. | 1745 // Press the Ctrl-F key. |
| 1739 function(element) { | 1746 function(element) { |
| 1740 callRemoteTestUtil('fakeKeyDown', | 1747 callRemoteTestUtil('fakeKeyDown', |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1769 }; | 1776 }; |
| 1770 | 1777 |
| 1771 /** | 1778 /** |
| 1772 * Tests if a thumbnail for the selected item shows up in the preview panel. | 1779 * Tests if a thumbnail for the selected item shows up in the preview panel. |
| 1773 * This thumbnail is fetched via the image loader. | 1780 * This thumbnail is fetched via the image loader. |
| 1774 */ | 1781 */ |
| 1775 testcase.thumbnailsDownloads = function() { | 1782 testcase.thumbnailsDownloads = function() { |
| 1776 var appId; | 1783 var appId; |
| 1777 StepsRunner.run([ | 1784 StepsRunner.run([ |
| 1778 function() { | 1785 function() { |
| 1779 var appState = {currentDirectoryPath: RootPath.DOWNLOADS}; | 1786 setupAndWaitUntilReady(null, RootPath.DOWNLOADS, this.next); |
| 1780 setupAndWaitUntilReady(appState, this.next); | |
| 1781 }, | 1787 }, |
| 1782 // Select the image. | 1788 // Select the image. |
| 1783 function(inAppId) { | 1789 function(inAppId) { |
| 1784 appId = inAppId; | 1790 appId = inAppId; |
| 1785 callRemoteTestUtil('selectFile', | 1791 callRemoteTestUtil('selectFile', |
| 1786 appId, | 1792 appId, |
| 1787 ['My Desktop Background.png'], | 1793 ['My Desktop Background.png'], |
| 1788 this.next); | 1794 this.next); |
| 1789 }, | 1795 }, |
| 1790 // Wait until the thumbnail shows up. | 1796 // Wait until the thumbnail shows up. |
| 1791 function(result) { | 1797 function(result) { |
| 1792 chrome.test.assertTrue(result); | 1798 chrome.test.assertTrue(result); |
| 1793 callRemoteTestUtil('waitForElement', | 1799 callRemoteTestUtil('waitForElement', |
| 1794 appId, | 1800 appId, |
| 1795 ['.preview-thumbnails .img-container img'], | 1801 ['.preview-thumbnails .img-container img'], |
| 1796 this.next); | 1802 this.next); |
| 1797 }, | 1803 }, |
| 1798 // Verify the thumbnail. | 1804 // Verify the thumbnail. |
| 1799 function(element) { | 1805 function(element) { |
| 1800 chrome.test.assertTrue(element.attributes.src.indexOf( | 1806 chrome.test.assertTrue(element.attributes.src.indexOf( |
| 1801 'data:image/jpeg') === 0); | 1807 'data:image/jpeg') === 0); |
| 1802 checkIfNoErrorsOccured(this.next); | 1808 checkIfNoErrorsOccured(this.next); |
| 1803 } | 1809 } |
| 1804 ]); | 1810 ]); |
| 1805 }; | 1811 }; |
| OLD | NEW |