| 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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 | 321 |
| 322 var expectedFilesBefore = | 322 var expectedFilesBefore = |
| 323 TestEntryInfo.getExpectedRows(path == RootPath.DRIVE ? | 323 TestEntryInfo.getExpectedRows(path == RootPath.DRIVE ? |
| 324 BASIC_DRIVE_ENTRY_SET : BASIC_LOCAL_ENTRY_SET).sort(); | 324 BASIC_DRIVE_ENTRY_SET : BASIC_LOCAL_ENTRY_SET).sort(); |
| 325 | 325 |
| 326 var expectedFilesAfter = | 326 var expectedFilesAfter = |
| 327 expectedFilesBefore.concat([ENTRIES.newlyAdded.getExpectedRow()]).sort(); | 327 expectedFilesBefore.concat([ENTRIES.newlyAdded.getExpectedRow()]).sort(); |
| 328 | 328 |
| 329 StepsRunner.run([ | 329 StepsRunner.run([ |
| 330 function() { | 330 function() { |
| 331 var appState = {defaultPath: path}; | 331 var appState = {currentDirectoryPath: path}; |
| 332 setupAndWaitUntilReady(appState, this.next); | 332 setupAndWaitUntilReady(appState, this.next); |
| 333 }, | 333 }, |
| 334 // Notify that the list has been verified and a new file can be added | 334 // Notify that the list has been verified and a new file can be added |
| 335 // in file_manager_browsertest.cc. | 335 // in file_manager_browsertest.cc. |
| 336 function(inAppId, actualFilesBefore) { | 336 function(inAppId, actualFilesBefore) { |
| 337 appId = inAppId; | 337 appId = inAppId; |
| 338 chrome.test.assertEq(expectedFilesBefore, actualFilesBefore); | 338 chrome.test.assertEq(expectedFilesBefore, actualFilesBefore); |
| 339 addEntries(['local', 'drive'], [ENTRIES.newlyAdded], this.next); | 339 addEntries(['local', 'drive'], [ENTRIES.newlyAdded], this.next); |
| 340 }, | 340 }, |
| 341 function(result) { | 341 function(result) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 357 /** | 357 /** |
| 358 * Tests if the gallery shows up for the selected image and that the image | 358 * Tests if the gallery shows up for the selected image and that the image |
| 359 * gets displayed. | 359 * gets displayed. |
| 360 * | 360 * |
| 361 * @param {string} path Directory path to be tested. | 361 * @param {string} path Directory path to be tested. |
| 362 */ | 362 */ |
| 363 testcase.intermediate.galleryOpen = function(path) { | 363 testcase.intermediate.galleryOpen = function(path) { |
| 364 var appId; | 364 var appId; |
| 365 StepsRunner.run([ | 365 StepsRunner.run([ |
| 366 function() { | 366 function() { |
| 367 var appState = {defaultPath: path}; | 367 var appState = {currentDirectoryPath: path}; |
| 368 setupAndWaitUntilReady(appState, this.next); | 368 setupAndWaitUntilReady(appState, this.next); |
| 369 }, | 369 }, |
| 370 // Resize the window to desired dimensions to avoid flakyness. | 370 // Resize the window to desired dimensions to avoid flakyness. |
| 371 function(inAppId) { | 371 function(inAppId) { |
| 372 appId = inAppId; | 372 appId = inAppId; |
| 373 callRemoteTestUtil('resizeWindow', | 373 callRemoteTestUtil('resizeWindow', |
| 374 appId, | 374 appId, |
| 375 [320, 320], | 375 [320, 320], |
| 376 this.next); | 376 this.next); |
| 377 }, | 377 }, |
| (...skipping 38 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 | 416 * Tests if the audio player shows up for the selected image and that the audio |
| 417 * is loaded successfully. | 417 * is loaded successfully. |
| 418 * | 418 * |
| 419 * @param {string} path Directory path to be tested. | 419 * @param {string} path Directory path to be tested. |
| 420 */ | 420 */ |
| 421 testcase.intermediate.audioOpen = function(path) { | 421 testcase.intermediate.audioOpen = function(path) { |
| 422 var appId; | 422 var appId; |
| 423 var audioAppId; | 423 var audioAppId; |
| 424 StepsRunner.run([ | 424 StepsRunner.run([ |
| 425 function() { | 425 function() { |
| 426 var appState = {defaultPath: path}; | 426 var appState = {currentDirectoryPath: path}; |
| 427 setupAndWaitUntilReady(appState, this.next); | 427 setupAndWaitUntilReady(appState, this.next); |
| 428 }, | 428 }, |
| 429 // Select the song. | 429 // Select the song. |
| 430 function(inAppId) { | 430 function(inAppId) { |
| 431 appId = inAppId; | 431 appId = inAppId; |
| 432 callRemoteTestUtil( | 432 callRemoteTestUtil( |
| 433 'openFile', appId, ['Beautiful Song.ogg'], this.next); | 433 'openFile', appId, ['Beautiful Song.ogg'], this.next); |
| 434 }, | 434 }, |
| 435 // Wait for the audio player. | 435 // Wait for the audio player. |
| 436 function(result) { | 436 function(result) { |
| (...skipping 42 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 | 479 * Tests if the video player shows up for the selected movie and that it is |
| 480 * loaded successfully. | 480 * loaded successfully. |
| 481 * | 481 * |
| 482 * @param {string} path Directory path to be tested. | 482 * @param {string} path Directory path to be tested. |
| 483 */ | 483 */ |
| 484 testcase.intermediate.videoOpen = function(path) { | 484 testcase.intermediate.videoOpen = function(path) { |
| 485 var appId; | 485 var appId; |
| 486 var videoAppId; | 486 var videoAppId; |
| 487 StepsRunner.run([ | 487 StepsRunner.run([ |
| 488 function() { | 488 function() { |
| 489 var appState = {defaultPath: path}; | 489 var appState = {currentDirectoryPath: path}; |
| 490 setupAndWaitUntilReady(appState, this.next); | 490 setupAndWaitUntilReady(appState, this.next); |
| 491 }, | 491 }, |
| 492 function(inAppId) { | 492 function(inAppId) { |
| 493 appId = inAppId; | 493 appId = inAppId; |
| 494 // Select the song. | 494 // Select the song. |
| 495 callRemoteTestUtil( | 495 callRemoteTestUtil( |
| 496 'openFile', appId, ['world.ogv'], this.next); | 496 'openFile', appId, ['world.ogv'], this.next); |
| 497 }, | 497 }, |
| 498 function(result) { | 498 function(result) { |
| 499 chrome.test.assertTrue(result); | 499 chrome.test.assertTrue(result); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 var expectedFilesBefore = | 540 var expectedFilesBefore = |
| 541 TestEntryInfo.getExpectedRows(path == RootPath.DRIVE ? | 541 TestEntryInfo.getExpectedRows(path == RootPath.DRIVE ? |
| 542 BASIC_DRIVE_ENTRY_SET : BASIC_LOCAL_ENTRY_SET).sort(); | 542 BASIC_DRIVE_ENTRY_SET : BASIC_LOCAL_ENTRY_SET).sort(); |
| 543 var expectedFilesAfter = | 543 var expectedFilesAfter = |
| 544 expectedFilesBefore.concat([['world (1).ogv', '59 KB', 'OGG video']]); | 544 expectedFilesBefore.concat([['world (1).ogv', '59 KB', 'OGG video']]); |
| 545 | 545 |
| 546 var appId, fileListBefore; | 546 var appId, fileListBefore; |
| 547 StepsRunner.run([ | 547 StepsRunner.run([ |
| 548 // Set up File Manager. | 548 // Set up File Manager. |
| 549 function() { | 549 function() { |
| 550 var appState = {defaultPath: path}; | 550 var appState = {currentDirectoryPath: path}; |
| 551 setupAndWaitUntilReady(appState, this.next); | 551 setupAndWaitUntilReady(appState, this.next); |
| 552 }, | 552 }, |
| 553 // Copy the file. | 553 // Copy the file. |
| 554 function(inAppId, inFileListBefore) { | 554 function(inAppId, inFileListBefore) { |
| 555 appId = inAppId; | 555 appId = inAppId; |
| 556 fileListBefore = inFileListBefore; | 556 fileListBefore = inFileListBefore; |
| 557 chrome.test.assertEq(expectedFilesBefore, inFileListBefore); | 557 chrome.test.assertEq(expectedFilesBefore, inFileListBefore); |
| 558 callRemoteTestUtil('copyFile', appId, [filename], this.next); | 558 callRemoteTestUtil('copyFile', appId, [filename], this.next); |
| 559 }, | 559 }, |
| 560 // Wait for a file list change. | 560 // Wait for a file list change. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 586 } | 586 } |
| 587 return false; | 587 return false; |
| 588 }; | 588 }; |
| 589 | 589 |
| 590 var filename = 'world.ogv'; | 590 var filename = 'world.ogv'; |
| 591 var directoryName = 'photos'; | 591 var directoryName = 'photos'; |
| 592 var appId, fileListBefore; | 592 var appId, fileListBefore; |
| 593 StepsRunner.run([ | 593 StepsRunner.run([ |
| 594 // Set up File Manager. | 594 // Set up File Manager. |
| 595 function() { | 595 function() { |
| 596 var appState = {defaultPath: path}; | 596 var appState = {currentDirectoryPath: path}; |
| 597 setupAndWaitUntilReady(appState, this.next); | 597 setupAndWaitUntilReady(appState, this.next); |
| 598 }, | 598 }, |
| 599 // Delete the file. | 599 // Delete the file. |
| 600 function(inAppId, inFileListBefore) { | 600 function(inAppId, inFileListBefore) { |
| 601 appId = inAppId; | 601 appId = inAppId; |
| 602 fileListBefore = inFileListBefore; | 602 fileListBefore = inFileListBefore; |
| 603 chrome.test.assertTrue(isFilePresent(filename, fileListBefore)); | 603 chrome.test.assertTrue(isFilePresent(filename, fileListBefore)); |
| 604 callRemoteTestUtil( | 604 callRemoteTestUtil( |
| 605 'deleteFile', appId, [filename], this.next); | 605 'deleteFile', appId, [filename], this.next); |
| 606 }, | 606 }, |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 /** | 693 /** |
| 694 * Tests opening the "Recent" on the sidebar navigation by clicking the icon, | 694 * 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 | 695 * 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 | 696 * directories are not allowed in "Recent". This test is only available for |
| 697 * Drive. | 697 * Drive. |
| 698 */ | 698 */ |
| 699 testcase.openSidebarRecent = function() { | 699 testcase.openSidebarRecent = function() { |
| 700 var appId; | 700 var appId; |
| 701 StepsRunner.run([ | 701 StepsRunner.run([ |
| 702 function() { | 702 function() { |
| 703 var appState = {defaultPath: RootPath.DRIVE}; | 703 var appState = {currentDirectoryPath: RootPath.DRIVE}; |
| 704 setupAndWaitUntilReady(appState, this.next); | 704 setupAndWaitUntilReady(appState, this.next); |
| 705 }, | 705 }, |
| 706 // Click the icon of the Recent volume. | 706 // Click the icon of the Recent volume. |
| 707 function(inAppId) { | 707 function(inAppId) { |
| 708 appId = inAppId; | 708 appId = inAppId; |
| 709 callRemoteTestUtil( | 709 callRemoteTestUtil( |
| 710 'selectVolume', appId, ['drive_recent'], this.next); | 710 'selectVolume', appId, ['drive_recent'], this.next); |
| 711 }, | 711 }, |
| 712 // Wait until the file list is updated. | 712 // Wait until the file list is updated. |
| 713 function(result) { | 713 function(result) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 731 /** | 731 /** |
| 732 * Tests opening the "Offline" on the sidebar navigation by clicking the icon, | 732 * 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" | 733 * and checks contenets of the file list. Only the entries "available offline" |
| 734 * should be shown. "Available offline" entires are hosted documents and the | 734 * should be shown. "Available offline" entires are hosted documents and the |
| 735 * entries cached by DriveCache. | 735 * entries cached by DriveCache. |
| 736 */ | 736 */ |
| 737 testcase.openSidebarOffline = function() { | 737 testcase.openSidebarOffline = function() { |
| 738 var appId; | 738 var appId; |
| 739 StepsRunner.run([ | 739 StepsRunner.run([ |
| 740 function() { | 740 function() { |
| 741 var appState = {defaultPath: RootPath.DRIVE}; | 741 var appState = {currentDirectoryPath: RootPath.DRIVE}; |
| 742 setupAndWaitUntilReady(appState, this.next); | 742 setupAndWaitUntilReady(appState, this.next); |
| 743 }, | 743 }, |
| 744 // Click the icon of the Offline volume. | 744 // Click the icon of the Offline volume. |
| 745 function(inAppId) { | 745 function(inAppId) { |
| 746 appId = inAppId; | 746 appId = inAppId; |
| 747 callRemoteTestUtil( | 747 callRemoteTestUtil( |
| 748 'selectVolume', appId, ['drive_offline'], this.next); | 748 'selectVolume', appId, ['drive_offline'], this.next); |
| 749 }, | 749 }, |
| 750 // Wait until the file list is updated. | 750 // Wait until the file list is updated. |
| 751 function(result) { | 751 function(result) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 768 | 768 |
| 769 /** | 769 /** |
| 770 * Tests opening the "Shared with me" on the sidebar navigation by clicking the | 770 * 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 | 771 * icon, and checks contents of the file list. Only the entries labeled with |
| 772 * "shared-with-me" should be shown. | 772 * "shared-with-me" should be shown. |
| 773 */ | 773 */ |
| 774 testcase.openSidebarSharedWithMe = function() { | 774 testcase.openSidebarSharedWithMe = function() { |
| 775 var appId; | 775 var appId; |
| 776 StepsRunner.run([ | 776 StepsRunner.run([ |
| 777 function() { | 777 function() { |
| 778 var appState = {defaultPath: RootPath.DRIVE}; | 778 var appState = {currentDirectoryPath: RootPath.DRIVE}; |
| 779 setupAndWaitUntilReady(appState, this.next); | 779 setupAndWaitUntilReady(appState, this.next); |
| 780 }, | 780 }, |
| 781 // Click the icon of the Shared With Me volume. | 781 // Click the icon of the Shared With Me volume. |
| 782 function(inAppId) { | 782 function(inAppId) { |
| 783 appId = inAppId; | 783 appId = inAppId; |
| 784 // Use the icon for a click target. | 784 // Use the icon for a click target. |
| 785 callRemoteTestUtil('selectVolume', | 785 callRemoteTestUtil('selectVolume', |
| 786 appId, | 786 appId, |
| 787 ['drive_shared_with_me'], this.next); | 787 ['drive_shared_with_me'], this.next); |
| 788 }, | 788 }, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 810 * Drive. | 810 * Drive. |
| 811 */ | 811 */ |
| 812 testcase.autocomplete = function() { | 812 testcase.autocomplete = function() { |
| 813 var EXPECTED_AUTOCOMPLETE_LIST = [ | 813 var EXPECTED_AUTOCOMPLETE_LIST = [ |
| 814 '\'hello\' - search Drive\n', | 814 '\'hello\' - search Drive\n', |
| 815 'hello.txt\n', | 815 'hello.txt\n', |
| 816 ]; | 816 ]; |
| 817 | 817 |
| 818 StepsRunner.run([ | 818 StepsRunner.run([ |
| 819 function() { | 819 function() { |
| 820 var appState = {defaultPath: RootPath.DRIVE}; | 820 var appState = {currentDirectoryPath: RootPath.DRIVE}; |
| 821 setupAndWaitUntilReady(appState, this.next); | 821 setupAndWaitUntilReady(appState, this.next); |
| 822 }, | 822 }, |
| 823 // Perform an auto complete test and wait until the list changes. | 823 // 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. | 824 // TODO(mtomasz): Move the operation from test_util.js to tests_cases.js. |
| 825 function(appId, list) { | 825 function(appId, list) { |
| 826 callRemoteTestUtil('performAutocompleteAndWait', | 826 callRemoteTestUtil('performAutocompleteAndWait', |
| 827 appId, | 827 appId, |
| 828 ['hello', EXPECTED_AUTOCOMPLETE_LIST.length], | 828 ['hello', EXPECTED_AUTOCOMPLETE_LIST.length], |
| 829 this.next); | 829 this.next); |
| 830 }, | 830 }, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 852 srcEntries, | 852 srcEntries, |
| 853 dstName, | 853 dstName, |
| 854 dstEntries) { | 854 dstEntries) { |
| 855 var srcContents = TestEntryInfo.getExpectedRows(srcEntries).sort(); | 855 var srcContents = TestEntryInfo.getExpectedRows(srcEntries).sort(); |
| 856 var dstContents = TestEntryInfo.getExpectedRows(dstEntries).sort(); | 856 var dstContents = TestEntryInfo.getExpectedRows(dstEntries).sort(); |
| 857 | 857 |
| 858 var appId; | 858 var appId; |
| 859 StepsRunner.run([ | 859 StepsRunner.run([ |
| 860 // Set up File Manager. | 860 // Set up File Manager. |
| 861 function() { | 861 function() { |
| 862 var appState = {defaultPath: RootPath.DOWNLOADS}; | 862 var appState = {currentDirectoryPath: RootPath.DOWNLOADS}; |
| 863 setupAndWaitUntilReady(appState, this.next); | 863 setupAndWaitUntilReady(appState, this.next); |
| 864 }, | 864 }, |
| 865 // Select the source volume. | 865 // Select the source volume. |
| 866 function(inAppId) { | 866 function(inAppId) { |
| 867 appId = inAppId; | 867 appId = inAppId; |
| 868 callRemoteTestUtil( | 868 callRemoteTestUtil( |
| 869 'selectVolume', appId, [srcName], this.next); | 869 'selectVolume', appId, [srcName], this.next); |
| 870 }, | 870 }, |
| 871 // Wait for the expected files to appear in the file list. | 871 // Wait for the expected files to appear in the file list. |
| 872 function(result) { | 872 function(result) { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 | 950 |
| 951 /** | 951 /** |
| 952 * Test sharing dialog for a file or directory on Drive | 952 * Test sharing dialog for a file or directory on Drive |
| 953 * @param {string} path Path for a file or a directory to be shared. | 953 * @param {string} path Path for a file or a directory to be shared. |
| 954 */ | 954 */ |
| 955 testcase.intermediate.share = function(path) { | 955 testcase.intermediate.share = function(path) { |
| 956 var appId; | 956 var appId; |
| 957 StepsRunner.run([ | 957 StepsRunner.run([ |
| 958 // Set up File Manager. | 958 // Set up File Manager. |
| 959 function() { | 959 function() { |
| 960 var appState = {defaultPath: RootPath.DRIVE}; | 960 var appState = {currentDirectoryPath: RootPath.DRIVE}; |
| 961 setupAndWaitUntilReady(appState, this.next); | 961 setupAndWaitUntilReady(appState, this.next); |
| 962 }, | 962 }, |
| 963 // Select the source file. | 963 // Select the source file. |
| 964 function(inAppId) { | 964 function(inAppId) { |
| 965 appId = inAppId; | 965 appId = inAppId; |
| 966 callRemoteTestUtil( | 966 callRemoteTestUtil( |
| 967 'selectFile', appId, [path], this.next); | 967 'selectFile', appId, [path], this.next); |
| 968 }, | 968 }, |
| 969 // Wait for the share button. | 969 // Wait for the share button. |
| 970 function(result) { | 970 function(result) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1028 }; | 1028 }; |
| 1029 | 1029 |
| 1030 /** | 1030 /** |
| 1031 * Test utility for traverse tests. | 1031 * Test utility for traverse tests. |
| 1032 */ | 1032 */ |
| 1033 testcase.intermediate.traverseDirectories = function(root) { | 1033 testcase.intermediate.traverseDirectories = function(root) { |
| 1034 var appId; | 1034 var appId; |
| 1035 StepsRunner.run([ | 1035 StepsRunner.run([ |
| 1036 // Set up File Manager. | 1036 // Set up File Manager. |
| 1037 function() { | 1037 function() { |
| 1038 var appState = {defaultPath: root}; | 1038 var appState = {currentDirectoryPath: root}; |
| 1039 callRemoteTestUtil('openMainWindow', null, [appState], this.next); | 1039 callRemoteTestUtil('openMainWindow', null, [appState], this.next); |
| 1040 }, | 1040 }, |
| 1041 // Check the initial view. | 1041 // Check the initial view. |
| 1042 function(inAppId) { | 1042 function(inAppId) { |
| 1043 appId = inAppId; | 1043 appId = inAppId; |
| 1044 addEntries(['local', 'drive'], NESTED_ENTRY_SET, this.next); | 1044 addEntries(['local', 'drive'], NESTED_ENTRY_SET, this.next); |
| 1045 }, | 1045 }, |
| 1046 function(result) { | 1046 function(result) { |
| 1047 chrome.test.assertTrue(result); | 1047 chrome.test.assertTrue(result); |
| 1048 callRemoteTestUtil('waitForFiles', | 1048 callRemoteTestUtil('waitForFiles', |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1195 * Tests executing the default task when there is only one task. | 1195 * Tests executing the default task when there is only one task. |
| 1196 */ | 1196 */ |
| 1197 testcase.intermediate.executeDefaultTask = function(drive) { | 1197 testcase.intermediate.executeDefaultTask = function(drive) { |
| 1198 var root = drive ? RootPath.DRIVE : RootPath.DOWNLOADS; | 1198 var root = drive ? RootPath.DRIVE : RootPath.DOWNLOADS; |
| 1199 var taskId = drive ? 'dummytaskid|drive|open-with' : 'dummytaskid|open-with' | 1199 var taskId = drive ? 'dummytaskid|drive|open-with' : 'dummytaskid|open-with' |
| 1200 var appId; | 1200 var appId; |
| 1201 StepsRunner.run([ | 1201 StepsRunner.run([ |
| 1202 // Set up File Manager. | 1202 // Set up File Manager. |
| 1203 function() { | 1203 function() { |
| 1204 var appState = { | 1204 var appState = { |
| 1205 defaultPath: root | 1205 currentDirectoryPath: root |
| 1206 }; | 1206 }; |
| 1207 setupAndWaitUntilReady(appState, this.next); | 1207 setupAndWaitUntilReady(appState, this.next); |
| 1208 }, | 1208 }, |
| 1209 // Override tasks list with a dummy task. | 1209 // Override tasks list with a dummy task. |
| 1210 function(inAppId, inFileListBefore) { | 1210 function(inAppId, inFileListBefore) { |
| 1211 appId = inAppId; | 1211 appId = inAppId; |
| 1212 | 1212 |
| 1213 callRemoteTestUtil( | 1213 callRemoteTestUtil( |
| 1214 'overrideTasks', | 1214 'overrideTasks', |
| 1215 appId, | 1215 appId, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1265 function() { | 1265 function() { |
| 1266 chrome.test.sendMessage( | 1266 chrome.test.sendMessage( |
| 1267 JSON.stringify({name: 'getCwsWidgetContainerMockUrl'}), | 1267 JSON.stringify({name: 'getCwsWidgetContainerMockUrl'}), |
| 1268 this.next); | 1268 this.next); |
| 1269 }, | 1269 }, |
| 1270 // Override the container URL with the mock. | 1270 // Override the container URL with the mock. |
| 1271 function(json) { | 1271 function(json) { |
| 1272 var data = JSON.parse(json); | 1272 var data = JSON.parse(json); |
| 1273 | 1273 |
| 1274 var appState = { | 1274 var appState = { |
| 1275 defaultPath: RootPath.DRIVE, | 1275 currentDirectoryPath: RootPath.DRIVE, |
| 1276 suggestAppsDialogState: { | 1276 suggestAppsDialogState: { |
| 1277 overrideCwsContainerUrlForTest: data.url, | 1277 overrideCwsContainerUrlForTest: data.url, |
| 1278 overrideCwsContainerOriginForTest: data.origin | 1278 overrideCwsContainerOriginForTest: data.origin |
| 1279 } | 1279 } |
| 1280 }; | 1280 }; |
| 1281 setupAndWaitUntilReady(appState, this.next); | 1281 setupAndWaitUntilReady(appState, this.next); |
| 1282 }, | 1282 }, |
| 1283 function(inAppId, inFileListBefore) { | 1283 function(inAppId, inFileListBefore) { |
| 1284 appId = inAppId; | 1284 appId = inAppId; |
| 1285 | 1285 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1379 }; | 1379 }; |
| 1380 | 1380 |
| 1381 /** | 1381 /** |
| 1382 * Tests hiding the search box. | 1382 * Tests hiding the search box. |
| 1383 */ | 1383 */ |
| 1384 testcase.hideSearchBox = function() { | 1384 testcase.hideSearchBox = function() { |
| 1385 var appId; | 1385 var appId; |
| 1386 StepsRunner.run([ | 1386 StepsRunner.run([ |
| 1387 // Set up File Manager. | 1387 // Set up File Manager. |
| 1388 function() { | 1388 function() { |
| 1389 var appState = {defaultPath: RootPath.DOWNLOADS}; | 1389 var appState = {currentDirectoryPath: RootPath.DOWNLOADS}; |
| 1390 setupAndWaitUntilReady(appState, this.next); | 1390 setupAndWaitUntilReady(appState, this.next); |
| 1391 }, | 1391 }, |
| 1392 // Resize the window. | 1392 // Resize the window. |
| 1393 function(inAppId, inFileListBefore) { | 1393 function(inAppId, inFileListBefore) { |
| 1394 appId = inAppId; | 1394 appId = inAppId; |
| 1395 callRemoteTestUtil('resizeWindow', appId, [100, 100], this.next); | 1395 callRemoteTestUtil('resizeWindow', appId, [100, 100], this.next); |
| 1396 }, | 1396 }, |
| 1397 // Wait for the style change. | 1397 // Wait for the style change. |
| 1398 function(result) { | 1398 function(result) { |
| 1399 chrome.test.assertTrue(result); | 1399 chrome.test.assertTrue(result); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1420 var EXPECTED_FILES = TestEntryInfo.getExpectedRows([ | 1420 var EXPECTED_FILES = TestEntryInfo.getExpectedRows([ |
| 1421 ENTRIES.world, | 1421 ENTRIES.world, |
| 1422 ENTRIES.photos, | 1422 ENTRIES.photos, |
| 1423 ENTRIES.desktop, | 1423 ENTRIES.desktop, |
| 1424 ENTRIES.hello, | 1424 ENTRIES.hello, |
| 1425 ENTRIES.beautiful | 1425 ENTRIES.beautiful |
| 1426 ]); | 1426 ]); |
| 1427 StepsRunner.run([ | 1427 StepsRunner.run([ |
| 1428 // Set up File Manager. | 1428 // Set up File Manager. |
| 1429 function() { | 1429 function() { |
| 1430 var appState = {defaultPath: RootPath.DOWNLOADS}; | 1430 var appState = {currentDirectoryPath: RootPath.DOWNLOADS}; |
| 1431 setupAndWaitUntilReady(appState, this.next); | 1431 setupAndWaitUntilReady(appState, this.next); |
| 1432 }, | 1432 }, |
| 1433 // Sort by name. | 1433 // Sort by name. |
| 1434 function(inAppId) { | 1434 function(inAppId) { |
| 1435 appId = inAppId; | 1435 appId = inAppId; |
| 1436 callRemoteTestUtil('fakeMouseClick', | 1436 callRemoteTestUtil('fakeMouseClick', |
| 1437 appId, | 1437 appId, |
| 1438 ['.table-header-cell:nth-of-type(1)'], | 1438 ['.table-header-cell:nth-of-type(1)'], |
| 1439 this.next); | 1439 this.next); |
| 1440 }, | 1440 }, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1461 }, | 1461 }, |
| 1462 // Check the sorted files. | 1462 // Check the sorted files. |
| 1463 function() { | 1463 function() { |
| 1464 callRemoteTestUtil('waitForFiles', | 1464 callRemoteTestUtil('waitForFiles', |
| 1465 appId, | 1465 appId, |
| 1466 [EXPECTED_FILES, {orderCheck: true}], | 1466 [EXPECTED_FILES, {orderCheck: true}], |
| 1467 this.next); | 1467 this.next); |
| 1468 }, | 1468 }, |
| 1469 // Open another window, where the sorted column should be restored. | 1469 // Open another window, where the sorted column should be restored. |
| 1470 function() { | 1470 function() { |
| 1471 var appState = {defaultPath: RootPath.DOWNLOADS}; | 1471 var appState = {currentDirectoryPath: RootPath.DOWNLOADS}; |
| 1472 setupAndWaitUntilReady(appState, this.next); | 1472 setupAndWaitUntilReady(appState, this.next); |
| 1473 }, | 1473 }, |
| 1474 // Check the sorted style of the header. | 1474 // Check the sorted style of the header. |
| 1475 function(inAppId) { | 1475 function(inAppId) { |
| 1476 appId = inAppId; | 1476 appId = inAppId; |
| 1477 callRemoteTestUtil('waitForElement', | 1477 callRemoteTestUtil('waitForElement', |
| 1478 appId, | 1478 appId, |
| 1479 ['.table-header-sort-image-desc'], | 1479 ['.table-header-sort-image-desc'], |
| 1480 this.next); | 1480 this.next); |
| 1481 }, | 1481 }, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1494 }; | 1494 }; |
| 1495 | 1495 |
| 1496 /** | 1496 /** |
| 1497 * Tests restoring the current view (the file list or the thumbnail grid). | 1497 * Tests restoring the current view (the file list or the thumbnail grid). |
| 1498 */ | 1498 */ |
| 1499 testcase.restoreCurrentView = function() { | 1499 testcase.restoreCurrentView = function() { |
| 1500 var appId; | 1500 var appId; |
| 1501 StepsRunner.run([ | 1501 StepsRunner.run([ |
| 1502 // Set up File Manager. | 1502 // Set up File Manager. |
| 1503 function() { | 1503 function() { |
| 1504 var appState = {defaultPath: RootPath.DOWNLOADS}; | 1504 var appState = {currentDirectoryPath: RootPath.DOWNLOADS}; |
| 1505 setupAndWaitUntilReady(appState, this.next); | 1505 setupAndWaitUntilReady(appState, this.next); |
| 1506 }, | 1506 }, |
| 1507 // Check the initial view. | 1507 // Check the initial view. |
| 1508 function(inAppId) { | 1508 function(inAppId) { |
| 1509 appId = inAppId; | 1509 appId = inAppId; |
| 1510 callRemoteTestUtil('waitForElement', | 1510 callRemoteTestUtil('waitForElement', |
| 1511 appId, | 1511 appId, |
| 1512 ['.thumbnail-grid[hidden]'], | 1512 ['.thumbnail-grid[hidden]'], |
| 1513 this.next); | 1513 this.next); |
| 1514 }, | 1514 }, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1529 // Check the new current view. | 1529 // Check the new current view. |
| 1530 function(result) { | 1530 function(result) { |
| 1531 chrome.test.assertTrue(result); | 1531 chrome.test.assertTrue(result); |
| 1532 callRemoteTestUtil('waitForElement', | 1532 callRemoteTestUtil('waitForElement', |
| 1533 appId, | 1533 appId, |
| 1534 ['.detail-table[hidden]'], | 1534 ['.detail-table[hidden]'], |
| 1535 this.next); | 1535 this.next); |
| 1536 }, | 1536 }, |
| 1537 // Open another window, where the current view is restored. | 1537 // Open another window, where the current view is restored. |
| 1538 function() { | 1538 function() { |
| 1539 var appState = {defaultPath: RootPath.DOWNLOADS}; | 1539 var appState = {currentDirectoryPath: RootPath.DOWNLOADS}; |
| 1540 callRemoteTestUtil('openMainWindow', null, [appState], this.next); | 1540 callRemoteTestUtil('openMainWindow', null, [appState], this.next); |
| 1541 }, | 1541 }, |
| 1542 // Check the current view. | 1542 // Check the current view. |
| 1543 function(inAppId) { | 1543 function(inAppId) { |
| 1544 appId = inAppId; | 1544 appId = inAppId; |
| 1545 callRemoteTestUtil('waitForElement', | 1545 callRemoteTestUtil('waitForElement', |
| 1546 appId, | 1546 appId, |
| 1547 ['.detail-table[hidden]'], | 1547 ['.detail-table[hidden]'], |
| 1548 this.next); | 1548 this.next); |
| 1549 }, | 1549 }, |
| 1550 // Check the error. | 1550 // Check the error. |
| 1551 function() { | 1551 function() { |
| 1552 checkIfNoErrorsOccured(this.next); | 1552 checkIfNoErrorsOccured(this.next); |
| 1553 } | 1553 } |
| 1554 ]); | 1554 ]); |
| 1555 }; | 1555 }; |
| 1556 | 1556 |
| 1557 /** | 1557 /** |
| 1558 * Tests keyboard operations of the navigation list. | 1558 * Tests keyboard operations of the navigation list. |
| 1559 */ | 1559 */ |
| 1560 testcase.traverseNavigationList = function() { | 1560 testcase.traverseNavigationList = function() { |
| 1561 var appId; | 1561 var appId; |
| 1562 StepsRunner.run([ | 1562 StepsRunner.run([ |
| 1563 // Set up File Manager. | 1563 // Set up File Manager. |
| 1564 function() { | 1564 function() { |
| 1565 var appState = {defaultPath: RootPath.DRIVE}; | 1565 var appState = {currentDirectoryPath: RootPath.DRIVE}; |
| 1566 setupAndWaitUntilReady(appState, this.next); | 1566 setupAndWaitUntilReady(appState, this.next); |
| 1567 }, | 1567 }, |
| 1568 // Wait until Google Drive is selected. | 1568 // Wait until Google Drive is selected. |
| 1569 function(inAppId) { | 1569 function(inAppId) { |
| 1570 appId = inAppId; | 1570 appId = inAppId; |
| 1571 callRemoteTestUtil( | 1571 callRemoteTestUtil( |
| 1572 'waitForElement', | 1572 'waitForElement', |
| 1573 appId, | 1573 appId, |
| 1574 ['#navigation-list > .root-item > ' + | 1574 ['#navigation-list > .root-item > ' + |
| 1575 '.volume-icon[volume-type-icon="drive"]'], | 1575 '.volume-icon[volume-type-icon="drive"]'], |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1651 | 1651 |
| 1652 /** | 1652 /** |
| 1653 * Tests restoring geometry of the Files app. | 1653 * Tests restoring geometry of the Files app. |
| 1654 */ | 1654 */ |
| 1655 testcase.restoreGeometry = function() { | 1655 testcase.restoreGeometry = function() { |
| 1656 var appId; | 1656 var appId; |
| 1657 var appId2; | 1657 var appId2; |
| 1658 StepsRunner.run([ | 1658 StepsRunner.run([ |
| 1659 // Set up File Manager. | 1659 // Set up File Manager. |
| 1660 function() { | 1660 function() { |
| 1661 var appState = {defaultPath: RootPath.DOWNLOADS}; | 1661 var appState = {currentDirectoryPath: RootPath.DOWNLOADS}; |
| 1662 setupAndWaitUntilReady(appState, this.next); | 1662 setupAndWaitUntilReady(appState, this.next); |
| 1663 }, | 1663 }, |
| 1664 // Resize the window to minimal dimensions. | 1664 // Resize the window to minimal dimensions. |
| 1665 function(inAppId) { | 1665 function(inAppId) { |
| 1666 appId = inAppId; | 1666 appId = inAppId; |
| 1667 callRemoteTestUtil( | 1667 callRemoteTestUtil( |
| 1668 'resizeWindow', appId, [640, 480], this.next); | 1668 'resizeWindow', appId, [640, 480], this.next); |
| 1669 }, | 1669 }, |
| 1670 // Check the current window's size. | 1670 // Check the current window's size. |
| 1671 function(inAppId) { | 1671 function(inAppId) { |
| 1672 callRemoteTestUtil('waitForWindowGeometry', | 1672 callRemoteTestUtil('waitForWindowGeometry', |
| 1673 appId, | 1673 appId, |
| 1674 [640, 480], | 1674 [640, 480], |
| 1675 this.next); | 1675 this.next); |
| 1676 }, | 1676 }, |
| 1677 // Enlarge the window by 10 pixels. | 1677 // Enlarge the window by 10 pixels. |
| 1678 function(result) { | 1678 function(result) { |
| 1679 callRemoteTestUtil( | 1679 callRemoteTestUtil( |
| 1680 'resizeWindow', appId, [650, 490], this.next); | 1680 'resizeWindow', appId, [650, 490], this.next); |
| 1681 }, | 1681 }, |
| 1682 // Check the current window's size. | 1682 // Check the current window's size. |
| 1683 function() { | 1683 function() { |
| 1684 callRemoteTestUtil('waitForWindowGeometry', | 1684 callRemoteTestUtil('waitForWindowGeometry', |
| 1685 appId, | 1685 appId, |
| 1686 [650, 490], | 1686 [650, 490], |
| 1687 this.next); | 1687 this.next); |
| 1688 }, | 1688 }, |
| 1689 // Open another window, where the current view is restored. | 1689 // Open another window, where the current view is restored. |
| 1690 function() { | 1690 function() { |
| 1691 var appState = {defaultPath: RootPath.DOWNLOADS}; | 1691 var appState = {currentDirectoryPath: RootPath.DOWNLOADS}; |
| 1692 setupAndWaitUntilReady(appState, this.next); | 1692 setupAndWaitUntilReady(appState, this.next); |
| 1693 }, | 1693 }, |
| 1694 // Check the next window's size. | 1694 // Check the next window's size. |
| 1695 function(inAppId) { | 1695 function(inAppId) { |
| 1696 appId2 = inAppId; | 1696 appId2 = inAppId; |
| 1697 callRemoteTestUtil('waitForWindowGeometry', | 1697 callRemoteTestUtil('waitForWindowGeometry', |
| 1698 appId2, | 1698 appId2, |
| 1699 [650, 490], | 1699 [650, 490], |
| 1700 this.next); | 1700 this.next); |
| 1701 }, | 1701 }, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1719 testcase.intermediate.traverseDirectories.bind(null, RootPath.DRIVE); | 1719 testcase.intermediate.traverseDirectories.bind(null, RootPath.DRIVE); |
| 1720 | 1720 |
| 1721 /** | 1721 /** |
| 1722 * Tests the focus behavior of the search box. | 1722 * Tests the focus behavior of the search box. |
| 1723 */ | 1723 */ |
| 1724 testcase.searchBoxFocus = function() { | 1724 testcase.searchBoxFocus = function() { |
| 1725 var appId; | 1725 var appId; |
| 1726 StepsRunner.run([ | 1726 StepsRunner.run([ |
| 1727 // Set up File Manager. | 1727 // Set up File Manager. |
| 1728 function() { | 1728 function() { |
| 1729 var appState = {defaultPath: RootPath.DRIVE}; | 1729 var appState = {currentDirectoryPath: RootPath.DRIVE}; |
| 1730 setupAndWaitUntilReady(appState, this.next); | 1730 setupAndWaitUntilReady(appState, this.next); |
| 1731 }, | 1731 }, |
| 1732 // Check that the file list has the focus on launch. | 1732 // Check that the file list has the focus on launch. |
| 1733 function(inAppId) { | 1733 function(inAppId) { |
| 1734 appId = inAppId; | 1734 appId = inAppId; |
| 1735 callRemoteTestUtil( | 1735 callRemoteTestUtil( |
| 1736 'waitForElement', appId, ['#file-list:focus'], this.next); | 1736 'waitForElement', appId, ['#file-list:focus'], this.next); |
| 1737 }, | 1737 }, |
| 1738 // Press the Ctrl-F key. | 1738 // Press the Ctrl-F key. |
| 1739 function(element) { | 1739 function(element) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1769 }; | 1769 }; |
| 1770 | 1770 |
| 1771 /** | 1771 /** |
| 1772 * Tests if a thumbnail for the selected item shows up in the preview panel. | 1772 * Tests if a thumbnail for the selected item shows up in the preview panel. |
| 1773 * This thumbnail is fetched via the image loader. | 1773 * This thumbnail is fetched via the image loader. |
| 1774 */ | 1774 */ |
| 1775 testcase.thumbnailsDownloads = function() { | 1775 testcase.thumbnailsDownloads = function() { |
| 1776 var appId; | 1776 var appId; |
| 1777 StepsRunner.run([ | 1777 StepsRunner.run([ |
| 1778 function() { | 1778 function() { |
| 1779 var appState = {defaultPath: RootPath.DOWNLOADS}; | 1779 var appState = {currentDirectoryPath: RootPath.DOWNLOADS}; |
| 1780 setupAndWaitUntilReady(appState, this.next); | 1780 setupAndWaitUntilReady(appState, this.next); |
| 1781 }, | 1781 }, |
| 1782 // Select the image. | 1782 // Select the image. |
| 1783 function(inAppId) { | 1783 function(inAppId) { |
| 1784 appId = inAppId; | 1784 appId = inAppId; |
| 1785 callRemoteTestUtil('selectFile', | 1785 callRemoteTestUtil('selectFile', |
| 1786 appId, | 1786 appId, |
| 1787 ['My Desktop Background.png'], | 1787 ['My Desktop Background.png'], |
| 1788 this.next); | 1788 this.next); |
| 1789 }, | 1789 }, |
| 1790 // Wait until the thumbnail shows up. | 1790 // Wait until the thumbnail shows up. |
| 1791 function(result) { | 1791 function(result) { |
| 1792 chrome.test.assertTrue(result); | 1792 chrome.test.assertTrue(result); |
| 1793 callRemoteTestUtil('waitForElement', | 1793 callRemoteTestUtil('waitForElement', |
| 1794 appId, | 1794 appId, |
| 1795 ['.preview-thumbnails .img-container img'], | 1795 ['.preview-thumbnails .img-container img'], |
| 1796 this.next); | 1796 this.next); |
| 1797 }, | 1797 }, |
| 1798 // Verify the thumbnail. | 1798 // Verify the thumbnail. |
| 1799 function(element) { | 1799 function(element) { |
| 1800 chrome.test.assertTrue(element.attributes.src.indexOf( | 1800 chrome.test.assertTrue(element.attributes.src.indexOf( |
| 1801 'data:image/jpeg') === 0); | 1801 'data:image/jpeg') === 0); |
| 1802 checkIfNoErrorsOccured(this.next); | 1802 checkIfNoErrorsOccured(this.next); |
| 1803 } | 1803 } |
| 1804 ]); | 1804 ]); |
| 1805 }; | 1805 }; |
| OLD | NEW |