| 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 | 313 |
| 314 var expectedFilesBefore = | 314 var expectedFilesBefore = |
| 315 TestEntryInfo.getExpectedRows(path == '/drive/root' ? | 315 TestEntryInfo.getExpectedRows(path == '/drive/root' ? |
| 316 BASIC_DRIVE_ENTRY_SET : BASIC_LOCAL_ENTRY_SET).sort(); | 316 BASIC_DRIVE_ENTRY_SET : BASIC_LOCAL_ENTRY_SET).sort(); |
| 317 | 317 |
| 318 var expectedFilesAfter = | 318 var expectedFilesAfter = |
| 319 expectedFilesBefore.concat([ENTRIES.newlyAdded.getExpectedRow()]).sort(); | 319 expectedFilesBefore.concat([ENTRIES.newlyAdded.getExpectedRow()]).sort(); |
| 320 | 320 |
| 321 StepsRunner.run([ | 321 StepsRunner.run([ |
| 322 function() { | 322 function() { |
| 323 var appState = {defaultPath: path}; | 323 var appState = {currentDirectoryPath: path}; |
| 324 setupAndWaitUntilReady(appState, this.next); | 324 setupAndWaitUntilReady(appState, this.next); |
| 325 }, | 325 }, |
| 326 // Notify that the list has been verified and a new file can be added | 326 // Notify that the list has been verified and a new file can be added |
| 327 // in file_manager_browsertest.cc. | 327 // in file_manager_browsertest.cc. |
| 328 function(inAppId, actualFilesBefore) { | 328 function(inAppId, actualFilesBefore) { |
| 329 appId = inAppId; | 329 appId = inAppId; |
| 330 chrome.test.assertEq(expectedFilesBefore, actualFilesBefore); | 330 chrome.test.assertEq(expectedFilesBefore, actualFilesBefore); |
| 331 addEntries(['local', 'drive'], [ENTRIES.newlyAdded], this.next); | 331 addEntries(['local', 'drive'], [ENTRIES.newlyAdded], this.next); |
| 332 }, | 332 }, |
| 333 function(result) { | 333 function(result) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 349 /** | 349 /** |
| 350 * Tests if the gallery shows up for the selected image and that the image | 350 * Tests if the gallery shows up for the selected image and that the image |
| 351 * gets displayed. | 351 * gets displayed. |
| 352 * | 352 * |
| 353 * @param {string} path Directory path to be tested. | 353 * @param {string} path Directory path to be tested. |
| 354 */ | 354 */ |
| 355 testcase.intermediate.galleryOpen = function(path) { | 355 testcase.intermediate.galleryOpen = function(path) { |
| 356 var appId; | 356 var appId; |
| 357 StepsRunner.run([ | 357 StepsRunner.run([ |
| 358 function() { | 358 function() { |
| 359 var appState = {defaultPath: path}; | 359 var appState = {currentDirectoryPath: path}; |
| 360 setupAndWaitUntilReady(appState, this.next); | 360 setupAndWaitUntilReady(appState, this.next); |
| 361 }, | 361 }, |
| 362 // Resize the window to desired dimensions to avoid flakyness. | 362 // Resize the window to desired dimensions to avoid flakyness. |
| 363 function(inAppId) { | 363 function(inAppId) { |
| 364 appId = inAppId; | 364 appId = inAppId; |
| 365 callRemoteTestUtil('resizeWindow', | 365 callRemoteTestUtil('resizeWindow', |
| 366 appId, | 366 appId, |
| 367 [320, 320], | 367 [320, 320], |
| 368 this.next); | 368 this.next); |
| 369 }, | 369 }, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 * Tests if the audio player shows up for the selected image and that the audio | 408 * Tests if the audio player shows up for the selected image and that the audio |
| 409 * is loaded successfully. | 409 * is loaded successfully. |
| 410 * | 410 * |
| 411 * @param {string} path Directory path to be tested. | 411 * @param {string} path Directory path to be tested. |
| 412 */ | 412 */ |
| 413 testcase.intermediate.audioOpen = function(path) { | 413 testcase.intermediate.audioOpen = function(path) { |
| 414 var appId; | 414 var appId; |
| 415 var audioAppId; | 415 var audioAppId; |
| 416 StepsRunner.run([ | 416 StepsRunner.run([ |
| 417 function() { | 417 function() { |
| 418 var appState = {defaultPath: path}; | 418 var appState = {currentDirectoryPath: path}; |
| 419 setupAndWaitUntilReady(appState, this.next); | 419 setupAndWaitUntilReady(appState, this.next); |
| 420 }, | 420 }, |
| 421 // Select the song. | 421 // Select the song. |
| 422 function(inAppId) { | 422 function(inAppId) { |
| 423 appId = inAppId; | 423 appId = inAppId; |
| 424 callRemoteTestUtil( | 424 callRemoteTestUtil( |
| 425 'openFile', appId, ['Beautiful Song.ogg'], this.next); | 425 'openFile', appId, ['Beautiful Song.ogg'], this.next); |
| 426 }, | 426 }, |
| 427 // Wait for the audio player. | 427 // Wait for the audio player. |
| 428 function(result) { | 428 function(result) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 * Tests if the video player shows up for the selected movie and that it is | 471 * Tests if the video player shows up for the selected movie and that it is |
| 472 * loaded successfully. | 472 * loaded successfully. |
| 473 * | 473 * |
| 474 * @param {string} path Directory path to be tested. | 474 * @param {string} path Directory path to be tested. |
| 475 */ | 475 */ |
| 476 testcase.intermediate.videoOpen = function(path) { | 476 testcase.intermediate.videoOpen = function(path) { |
| 477 var appId; | 477 var appId; |
| 478 var videoAppId; | 478 var videoAppId; |
| 479 StepsRunner.run([ | 479 StepsRunner.run([ |
| 480 function() { | 480 function() { |
| 481 var appState = {defaultPath: path}; | 481 var appState = {currentDirectoryPath: path}; |
| 482 setupAndWaitUntilReady(appState, this.next); | 482 setupAndWaitUntilReady(appState, this.next); |
| 483 }, | 483 }, |
| 484 function(inAppId) { | 484 function(inAppId) { |
| 485 appId = inAppId; | 485 appId = inAppId; |
| 486 // Select the song. | 486 // Select the song. |
| 487 callRemoteTestUtil( | 487 callRemoteTestUtil( |
| 488 'openFile', appId, ['world.ogv'], this.next); | 488 'openFile', appId, ['world.ogv'], this.next); |
| 489 }, | 489 }, |
| 490 function(result) { | 490 function(result) { |
| 491 chrome.test.assertTrue(result); | 491 chrome.test.assertTrue(result); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 var expectedFilesBefore = | 532 var expectedFilesBefore = |
| 533 TestEntryInfo.getExpectedRows(path == '/drive/root' ? | 533 TestEntryInfo.getExpectedRows(path == '/drive/root' ? |
| 534 BASIC_DRIVE_ENTRY_SET : BASIC_LOCAL_ENTRY_SET).sort(); | 534 BASIC_DRIVE_ENTRY_SET : BASIC_LOCAL_ENTRY_SET).sort(); |
| 535 var expectedFilesAfter = | 535 var expectedFilesAfter = |
| 536 expectedFilesBefore.concat([['world (1).ogv', '59 KB', 'OGG video']]); | 536 expectedFilesBefore.concat([['world (1).ogv', '59 KB', 'OGG video']]); |
| 537 | 537 |
| 538 var appId, fileListBefore; | 538 var appId, fileListBefore; |
| 539 StepsRunner.run([ | 539 StepsRunner.run([ |
| 540 // Set up File Manager. | 540 // Set up File Manager. |
| 541 function() { | 541 function() { |
| 542 var appState = {defaultPath: path}; | 542 var appState = {currentDirectoryPath: path}; |
| 543 setupAndWaitUntilReady(appState, this.next); | 543 setupAndWaitUntilReady(appState, this.next); |
| 544 }, | 544 }, |
| 545 // Copy the file. | 545 // Copy the file. |
| 546 function(inAppId, inFileListBefore) { | 546 function(inAppId, inFileListBefore) { |
| 547 appId = inAppId; | 547 appId = inAppId; |
| 548 fileListBefore = inFileListBefore; | 548 fileListBefore = inFileListBefore; |
| 549 chrome.test.assertEq(expectedFilesBefore, inFileListBefore); | 549 chrome.test.assertEq(expectedFilesBefore, inFileListBefore); |
| 550 callRemoteTestUtil('copyFile', appId, [filename], this.next); | 550 callRemoteTestUtil('copyFile', appId, [filename], this.next); |
| 551 }, | 551 }, |
| 552 // Wait for a file list change. | 552 // Wait for a file list change. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 578 } | 578 } |
| 579 return false; | 579 return false; |
| 580 }; | 580 }; |
| 581 | 581 |
| 582 var filename = 'world.ogv'; | 582 var filename = 'world.ogv'; |
| 583 var directoryName = 'photos'; | 583 var directoryName = 'photos'; |
| 584 var appId, fileListBefore; | 584 var appId, fileListBefore; |
| 585 StepsRunner.run([ | 585 StepsRunner.run([ |
| 586 // Set up File Manager. | 586 // Set up File Manager. |
| 587 function() { | 587 function() { |
| 588 var appState = {defaultPath: path}; | 588 var appState = {currentDirectoryPath: path}; |
| 589 setupAndWaitUntilReady(appState, this.next); | 589 setupAndWaitUntilReady(appState, this.next); |
| 590 }, | 590 }, |
| 591 // Delete the file. | 591 // Delete the file. |
| 592 function(inAppId, inFileListBefore) { | 592 function(inAppId, inFileListBefore) { |
| 593 appId = inAppId; | 593 appId = inAppId; |
| 594 fileListBefore = inFileListBefore; | 594 fileListBefore = inFileListBefore; |
| 595 chrome.test.assertTrue(isFilePresent(filename, fileListBefore)); | 595 chrome.test.assertTrue(isFilePresent(filename, fileListBefore)); |
| 596 callRemoteTestUtil( | 596 callRemoteTestUtil( |
| 597 'deleteFile', appId, [filename], this.next); | 597 'deleteFile', appId, [filename], this.next); |
| 598 }, | 598 }, |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 /** | 685 /** |
| 686 * Tests opening the "Recent" on the sidebar navigation by clicking the icon, | 686 * Tests opening the "Recent" on the sidebar navigation by clicking the icon, |
| 687 * and verifies the directory contents. We test if there are only files, since | 687 * and verifies the directory contents. We test if there are only files, since |
| 688 * directories are not allowed in "Recent". This test is only available for | 688 * directories are not allowed in "Recent". This test is only available for |
| 689 * Drive. | 689 * Drive. |
| 690 */ | 690 */ |
| 691 testcase.openSidebarRecent = function() { | 691 testcase.openSidebarRecent = function() { |
| 692 var appId; | 692 var appId; |
| 693 StepsRunner.run([ | 693 StepsRunner.run([ |
| 694 function() { | 694 function() { |
| 695 var appState = {defaultPath: '/drive/root'}; | 695 var appState = {currentDirectoryPath: '/drive/root'}; |
| 696 setupAndWaitUntilReady(appState, this.next); | 696 setupAndWaitUntilReady(appState, this.next); |
| 697 }, | 697 }, |
| 698 // Click the icon of the Recent volume. | 698 // Click the icon of the Recent volume. |
| 699 function(inAppId) { | 699 function(inAppId) { |
| 700 appId = inAppId; | 700 appId = inAppId; |
| 701 callRemoteTestUtil( | 701 callRemoteTestUtil( |
| 702 'selectVolume', appId, ['drive_recent'], this.next); | 702 'selectVolume', appId, ['drive_recent'], this.next); |
| 703 }, | 703 }, |
| 704 // Wait until the file list is updated. | 704 // Wait until the file list is updated. |
| 705 function(result) { | 705 function(result) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 723 /** | 723 /** |
| 724 * Tests opening the "Offline" on the sidebar navigation by clicking the icon, | 724 * Tests opening the "Offline" on the sidebar navigation by clicking the icon, |
| 725 * and checks contenets of the file list. Only the entries "available offline" | 725 * and checks contenets of the file list. Only the entries "available offline" |
| 726 * should be shown. "Available offline" entires are hosted documents and the | 726 * should be shown. "Available offline" entires are hosted documents and the |
| 727 * entries cached by DriveCache. | 727 * entries cached by DriveCache. |
| 728 */ | 728 */ |
| 729 testcase.openSidebarOffline = function() { | 729 testcase.openSidebarOffline = function() { |
| 730 var appId; | 730 var appId; |
| 731 StepsRunner.run([ | 731 StepsRunner.run([ |
| 732 function() { | 732 function() { |
| 733 var appState = {defaultPath: '/drive/root/'}; | 733 var appState = {currentDirectoryPath: '/drive/root/'}; |
| 734 setupAndWaitUntilReady(appState, this.next); | 734 setupAndWaitUntilReady(appState, this.next); |
| 735 }, | 735 }, |
| 736 // Click the icon of the Offline volume. | 736 // Click the icon of the Offline volume. |
| 737 function(inAppId) { | 737 function(inAppId) { |
| 738 appId = inAppId; | 738 appId = inAppId; |
| 739 callRemoteTestUtil( | 739 callRemoteTestUtil( |
| 740 'selectVolume', appId, ['drive_offline'], this.next); | 740 'selectVolume', appId, ['drive_offline'], this.next); |
| 741 }, | 741 }, |
| 742 // Wait until the file list is updated. | 742 // Wait until the file list is updated. |
| 743 function(result) { | 743 function(result) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 760 | 760 |
| 761 /** | 761 /** |
| 762 * Tests opening the "Shared with me" on the sidebar navigation by clicking the | 762 * Tests opening the "Shared with me" on the sidebar navigation by clicking the |
| 763 * icon, and checks contents of the file list. Only the entries labeled with | 763 * icon, and checks contents of the file list. Only the entries labeled with |
| 764 * "shared-with-me" should be shown. | 764 * "shared-with-me" should be shown. |
| 765 */ | 765 */ |
| 766 testcase.openSidebarSharedWithMe = function() { | 766 testcase.openSidebarSharedWithMe = function() { |
| 767 var appId; | 767 var appId; |
| 768 StepsRunner.run([ | 768 StepsRunner.run([ |
| 769 function() { | 769 function() { |
| 770 var appState = {defaultPath: '/drive/root/'}; | 770 var appState = {currentDirectoryPath: '/drive/root/'}; |
| 771 setupAndWaitUntilReady(appState, this.next); | 771 setupAndWaitUntilReady(appState, this.next); |
| 772 }, | 772 }, |
| 773 // Click the icon of the Shared With Me volume. | 773 // Click the icon of the Shared With Me volume. |
| 774 function(inAppId) { | 774 function(inAppId) { |
| 775 appId = inAppId; | 775 appId = inAppId; |
| 776 // Use the icon for a click target. | 776 // Use the icon for a click target. |
| 777 callRemoteTestUtil('selectVolume', | 777 callRemoteTestUtil('selectVolume', |
| 778 appId, | 778 appId, |
| 779 ['drive_shared_with_me'], this.next); | 779 ['drive_shared_with_me'], this.next); |
| 780 }, | 780 }, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 802 * Drive. | 802 * Drive. |
| 803 */ | 803 */ |
| 804 testcase.autocomplete = function() { | 804 testcase.autocomplete = function() { |
| 805 var EXPECTED_AUTOCOMPLETE_LIST = [ | 805 var EXPECTED_AUTOCOMPLETE_LIST = [ |
| 806 '\'hello\' - search Drive\n', | 806 '\'hello\' - search Drive\n', |
| 807 'hello.txt\n', | 807 'hello.txt\n', |
| 808 ]; | 808 ]; |
| 809 | 809 |
| 810 StepsRunner.run([ | 810 StepsRunner.run([ |
| 811 function() { | 811 function() { |
| 812 var appState = {defaultPath: '/drive/root'}; | 812 var appState = {currentDirectoryPath: '/drive/root'}; |
| 813 setupAndWaitUntilReady(appState, this.next); | 813 setupAndWaitUntilReady(appState, this.next); |
| 814 }, | 814 }, |
| 815 // Perform an auto complete test and wait until the list changes. | 815 // Perform an auto complete test and wait until the list changes. |
| 816 // TODO(mtomasz): Move the operation from test_util.js to tests_cases.js. | 816 // TODO(mtomasz): Move the operation from test_util.js to tests_cases.js. |
| 817 function(appId, list) { | 817 function(appId, list) { |
| 818 callRemoteTestUtil('performAutocompleteAndWait', | 818 callRemoteTestUtil('performAutocompleteAndWait', |
| 819 appId, | 819 appId, |
| 820 ['hello', EXPECTED_AUTOCOMPLETE_LIST.length], | 820 ['hello', EXPECTED_AUTOCOMPLETE_LIST.length], |
| 821 this.next); | 821 this.next); |
| 822 }, | 822 }, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 844 srcEntries, | 844 srcEntries, |
| 845 dstName, | 845 dstName, |
| 846 dstEntries) { | 846 dstEntries) { |
| 847 var srcContents = TestEntryInfo.getExpectedRows(srcEntries).sort(); | 847 var srcContents = TestEntryInfo.getExpectedRows(srcEntries).sort(); |
| 848 var dstContents = TestEntryInfo.getExpectedRows(dstEntries).sort(); | 848 var dstContents = TestEntryInfo.getExpectedRows(dstEntries).sort(); |
| 849 | 849 |
| 850 var appId; | 850 var appId; |
| 851 StepsRunner.run([ | 851 StepsRunner.run([ |
| 852 // Set up File Manager. | 852 // Set up File Manager. |
| 853 function() { | 853 function() { |
| 854 var appState = {defaultPath: '/Downloads'}; | 854 var appState = {currentDirectoryPath: '/Downloads'}; |
| 855 setupAndWaitUntilReady(appState, this.next); | 855 setupAndWaitUntilReady(appState, this.next); |
| 856 }, | 856 }, |
| 857 // Select the source volume. | 857 // Select the source volume. |
| 858 function(inAppId) { | 858 function(inAppId) { |
| 859 appId = inAppId; | 859 appId = inAppId; |
| 860 callRemoteTestUtil( | 860 callRemoteTestUtil( |
| 861 'selectVolume', appId, [srcName], this.next); | 861 'selectVolume', appId, [srcName], this.next); |
| 862 }, | 862 }, |
| 863 // Wait for the expected files to appear in the file list. | 863 // Wait for the expected files to appear in the file list. |
| 864 function(result) { | 864 function(result) { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 | 942 |
| 943 /** | 943 /** |
| 944 * Test sharing dialog for a file or directory on Drive | 944 * Test sharing dialog for a file or directory on Drive |
| 945 * @param {string} path Path for a file or a directory to be shared. | 945 * @param {string} path Path for a file or a directory to be shared. |
| 946 */ | 946 */ |
| 947 testcase.intermediate.share = function(path) { | 947 testcase.intermediate.share = function(path) { |
| 948 var appId; | 948 var appId; |
| 949 StepsRunner.run([ | 949 StepsRunner.run([ |
| 950 // Set up File Manager. | 950 // Set up File Manager. |
| 951 function() { | 951 function() { |
| 952 var appState = {defaultPath: '/drive/root/'}; | 952 var appState = {currentDirectoryPath: '/drive/root/'}; |
| 953 setupAndWaitUntilReady(appState, this.next); | 953 setupAndWaitUntilReady(appState, this.next); |
| 954 }, | 954 }, |
| 955 // Select the source file. | 955 // Select the source file. |
| 956 function(inAppId) { | 956 function(inAppId) { |
| 957 appId = inAppId; | 957 appId = inAppId; |
| 958 callRemoteTestUtil( | 958 callRemoteTestUtil( |
| 959 'selectFile', appId, [path], this.next); | 959 'selectFile', appId, [path], this.next); |
| 960 }, | 960 }, |
| 961 // Wait for the share button. | 961 // Wait for the share button. |
| 962 function(result) { | 962 function(result) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1020 }; | 1020 }; |
| 1021 | 1021 |
| 1022 /** | 1022 /** |
| 1023 * Test utility for traverse tests. | 1023 * Test utility for traverse tests. |
| 1024 */ | 1024 */ |
| 1025 testcase.intermediate.traverseDirectories = function(root) { | 1025 testcase.intermediate.traverseDirectories = function(root) { |
| 1026 var appId; | 1026 var appId; |
| 1027 StepsRunner.run([ | 1027 StepsRunner.run([ |
| 1028 // Set up File Manager. | 1028 // Set up File Manager. |
| 1029 function() { | 1029 function() { |
| 1030 var appState = {defaultPath: root}; | 1030 var appState = {currentDirectoryPath: root}; |
| 1031 callRemoteTestUtil('openMainWindow', null, [appState], this.next); | 1031 callRemoteTestUtil('openMainWindow', null, [appState], this.next); |
| 1032 }, | 1032 }, |
| 1033 // Check the initial view. | 1033 // Check the initial view. |
| 1034 function(inAppId) { | 1034 function(inAppId) { |
| 1035 appId = inAppId; | 1035 appId = inAppId; |
| 1036 addEntries(['local', 'drive'], NESTED_ENTRY_SET, this.next); | 1036 addEntries(['local', 'drive'], NESTED_ENTRY_SET, this.next); |
| 1037 }, | 1037 }, |
| 1038 function(result) { | 1038 function(result) { |
| 1039 chrome.test.assertTrue(result); | 1039 chrome.test.assertTrue(result); |
| 1040 callRemoteTestUtil('waitForFiles', | 1040 callRemoteTestUtil('waitForFiles', |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1187 * Tests executing the default task when there is only one task. | 1187 * Tests executing the default task when there is only one task. |
| 1188 */ | 1188 */ |
| 1189 testcase.intermediate.executeDefaultTask = function(drive) { | 1189 testcase.intermediate.executeDefaultTask = function(drive) { |
| 1190 var root = drive ? '/drive/root' : '/Downloads'; | 1190 var root = drive ? '/drive/root' : '/Downloads'; |
| 1191 var taskId = drive ? 'dummytaskid|drive|open-with' : 'dummytaskid|open-with' | 1191 var taskId = drive ? 'dummytaskid|drive|open-with' : 'dummytaskid|open-with' |
| 1192 var appId; | 1192 var appId; |
| 1193 StepsRunner.run([ | 1193 StepsRunner.run([ |
| 1194 // Set up File Manager. | 1194 // Set up File Manager. |
| 1195 function() { | 1195 function() { |
| 1196 var appState = { | 1196 var appState = { |
| 1197 defaultPath: root | 1197 currentDirectoryPath: root |
| 1198 }; | 1198 }; |
| 1199 setupAndWaitUntilReady(appState, this.next); | 1199 setupAndWaitUntilReady(appState, this.next); |
| 1200 }, | 1200 }, |
| 1201 // Override tasks list with a dummy task. | 1201 // Override tasks list with a dummy task. |
| 1202 function(inAppId, inFileListBefore) { | 1202 function(inAppId, inFileListBefore) { |
| 1203 appId = inAppId; | 1203 appId = inAppId; |
| 1204 | 1204 |
| 1205 callRemoteTestUtil( | 1205 callRemoteTestUtil( |
| 1206 'overrideTasks', | 1206 'overrideTasks', |
| 1207 appId, | 1207 appId, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1257 function() { | 1257 function() { |
| 1258 chrome.test.sendMessage( | 1258 chrome.test.sendMessage( |
| 1259 JSON.stringify({name: 'getCwsWidgetContainerMockUrl'}), | 1259 JSON.stringify({name: 'getCwsWidgetContainerMockUrl'}), |
| 1260 this.next); | 1260 this.next); |
| 1261 }, | 1261 }, |
| 1262 // Override the container URL with the mock. | 1262 // Override the container URL with the mock. |
| 1263 function(json) { | 1263 function(json) { |
| 1264 var data = JSON.parse(json); | 1264 var data = JSON.parse(json); |
| 1265 | 1265 |
| 1266 var appState = { | 1266 var appState = { |
| 1267 defaultPath: '/drive/root', | 1267 currentDirectoryPath: '/drive/root', |
| 1268 suggestAppsDialogState: { | 1268 suggestAppsDialogState: { |
| 1269 overrideCwsContainerUrlForTest: data.url, | 1269 overrideCwsContainerUrlForTest: data.url, |
| 1270 overrideCwsContainerOriginForTest: data.origin | 1270 overrideCwsContainerOriginForTest: data.origin |
| 1271 } | 1271 } |
| 1272 }; | 1272 }; |
| 1273 setupAndWaitUntilReady(appState, this.next); | 1273 setupAndWaitUntilReady(appState, this.next); |
| 1274 }, | 1274 }, |
| 1275 function(inAppId, inFileListBefore) { | 1275 function(inAppId, inFileListBefore) { |
| 1276 appId = inAppId; | 1276 appId = inAppId; |
| 1277 | 1277 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1371 }; | 1371 }; |
| 1372 | 1372 |
| 1373 /** | 1373 /** |
| 1374 * Tests hiding the search box. | 1374 * Tests hiding the search box. |
| 1375 */ | 1375 */ |
| 1376 testcase.hideSearchBox = function() { | 1376 testcase.hideSearchBox = function() { |
| 1377 var appId; | 1377 var appId; |
| 1378 StepsRunner.run([ | 1378 StepsRunner.run([ |
| 1379 // Set up File Manager. | 1379 // Set up File Manager. |
| 1380 function() { | 1380 function() { |
| 1381 var appState = {defaultPath: '/Downloads'}; | 1381 var appState = {currentDirectoryPath: '/Downloads'}; |
| 1382 setupAndWaitUntilReady(appState, this.next); | 1382 setupAndWaitUntilReady(appState, this.next); |
| 1383 }, | 1383 }, |
| 1384 // Resize the window. | 1384 // Resize the window. |
| 1385 function(inAppId, inFileListBefore) { | 1385 function(inAppId, inFileListBefore) { |
| 1386 appId = inAppId; | 1386 appId = inAppId; |
| 1387 callRemoteTestUtil('resizeWindow', appId, [100, 100], this.next); | 1387 callRemoteTestUtil('resizeWindow', appId, [100, 100], this.next); |
| 1388 }, | 1388 }, |
| 1389 // Wait for the style change. | 1389 // Wait for the style change. |
| 1390 function(result) { | 1390 function(result) { |
| 1391 chrome.test.assertTrue(result); | 1391 chrome.test.assertTrue(result); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1412 var EXPECTED_FILES = TestEntryInfo.getExpectedRows([ | 1412 var EXPECTED_FILES = TestEntryInfo.getExpectedRows([ |
| 1413 ENTRIES.world, | 1413 ENTRIES.world, |
| 1414 ENTRIES.photos, | 1414 ENTRIES.photos, |
| 1415 ENTRIES.desktop, | 1415 ENTRIES.desktop, |
| 1416 ENTRIES.hello, | 1416 ENTRIES.hello, |
| 1417 ENTRIES.beautiful | 1417 ENTRIES.beautiful |
| 1418 ]); | 1418 ]); |
| 1419 StepsRunner.run([ | 1419 StepsRunner.run([ |
| 1420 // Set up File Manager. | 1420 // Set up File Manager. |
| 1421 function() { | 1421 function() { |
| 1422 var appState = {defaultPath: '/Downloads'}; | 1422 var appState = {currentDirectoryPath: '/Downloads'}; |
| 1423 setupAndWaitUntilReady(appState, this.next); | 1423 setupAndWaitUntilReady(appState, this.next); |
| 1424 }, | 1424 }, |
| 1425 // Sort by name. | 1425 // Sort by name. |
| 1426 function(inAppId) { | 1426 function(inAppId) { |
| 1427 appId = inAppId; | 1427 appId = inAppId; |
| 1428 callRemoteTestUtil('fakeMouseClick', | 1428 callRemoteTestUtil('fakeMouseClick', |
| 1429 appId, | 1429 appId, |
| 1430 ['.table-header-cell:nth-of-type(1)'], | 1430 ['.table-header-cell:nth-of-type(1)'], |
| 1431 this.next); | 1431 this.next); |
| 1432 }, | 1432 }, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1453 }, | 1453 }, |
| 1454 // Check the sorted files. | 1454 // Check the sorted files. |
| 1455 function() { | 1455 function() { |
| 1456 callRemoteTestUtil('waitForFiles', | 1456 callRemoteTestUtil('waitForFiles', |
| 1457 appId, | 1457 appId, |
| 1458 [EXPECTED_FILES, {orderCheck: true}], | 1458 [EXPECTED_FILES, {orderCheck: true}], |
| 1459 this.next); | 1459 this.next); |
| 1460 }, | 1460 }, |
| 1461 // Open another window, where the sorted column should be restored. | 1461 // Open another window, where the sorted column should be restored. |
| 1462 function() { | 1462 function() { |
| 1463 var appState = {defaultPath: '/Downloads'}; | 1463 var appState = {currentDirectoryPath: '/Downloads'}; |
| 1464 setupAndWaitUntilReady(appState, this.next); | 1464 setupAndWaitUntilReady(appState, this.next); |
| 1465 }, | 1465 }, |
| 1466 // Check the sorted style of the header. | 1466 // Check the sorted style of the header. |
| 1467 function(inAppId) { | 1467 function(inAppId) { |
| 1468 appId = inAppId; | 1468 appId = inAppId; |
| 1469 callRemoteTestUtil('waitForElement', | 1469 callRemoteTestUtil('waitForElement', |
| 1470 appId, | 1470 appId, |
| 1471 ['.table-header-sort-image-desc'], | 1471 ['.table-header-sort-image-desc'], |
| 1472 this.next); | 1472 this.next); |
| 1473 }, | 1473 }, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1486 }; | 1486 }; |
| 1487 | 1487 |
| 1488 /** | 1488 /** |
| 1489 * Tests restoring the current view (the file list or the thumbnail grid). | 1489 * Tests restoring the current view (the file list or the thumbnail grid). |
| 1490 */ | 1490 */ |
| 1491 testcase.restoreCurrentView = function() { | 1491 testcase.restoreCurrentView = function() { |
| 1492 var appId; | 1492 var appId; |
| 1493 StepsRunner.run([ | 1493 StepsRunner.run([ |
| 1494 // Set up File Manager. | 1494 // Set up File Manager. |
| 1495 function() { | 1495 function() { |
| 1496 var appState = {defaultPath: '/Downloads'}; | 1496 var appState = {currentDirectoryPath: '/Downloads'}; |
| 1497 setupAndWaitUntilReady(appState, this.next); | 1497 setupAndWaitUntilReady(appState, this.next); |
| 1498 }, | 1498 }, |
| 1499 // Check the initial view. | 1499 // Check the initial view. |
| 1500 function(inAppId) { | 1500 function(inAppId) { |
| 1501 appId = inAppId; | 1501 appId = inAppId; |
| 1502 callRemoteTestUtil('waitForElement', | 1502 callRemoteTestUtil('waitForElement', |
| 1503 appId, | 1503 appId, |
| 1504 ['.thumbnail-grid[hidden]'], | 1504 ['.thumbnail-grid[hidden]'], |
| 1505 this.next); | 1505 this.next); |
| 1506 }, | 1506 }, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1521 // Check the new current view. | 1521 // Check the new current view. |
| 1522 function(result) { | 1522 function(result) { |
| 1523 chrome.test.assertTrue(result); | 1523 chrome.test.assertTrue(result); |
| 1524 callRemoteTestUtil('waitForElement', | 1524 callRemoteTestUtil('waitForElement', |
| 1525 appId, | 1525 appId, |
| 1526 ['.detail-table[hidden]'], | 1526 ['.detail-table[hidden]'], |
| 1527 this.next); | 1527 this.next); |
| 1528 }, | 1528 }, |
| 1529 // Open another window, where the current view is restored. | 1529 // Open another window, where the current view is restored. |
| 1530 function() { | 1530 function() { |
| 1531 var appState = {defaultPath: '/Downloads'}; | 1531 var appState = {currentDirectoryPath: '/Downloads'}; |
| 1532 callRemoteTestUtil('openMainWindow', null, [appState], this.next); | 1532 callRemoteTestUtil('openMainWindow', null, [appState], this.next); |
| 1533 }, | 1533 }, |
| 1534 // Check the current view. | 1534 // Check the current view. |
| 1535 function(inAppId) { | 1535 function(inAppId) { |
| 1536 appId = inAppId; | 1536 appId = inAppId; |
| 1537 callRemoteTestUtil('waitForElement', | 1537 callRemoteTestUtil('waitForElement', |
| 1538 appId, | 1538 appId, |
| 1539 ['.detail-table[hidden]'], | 1539 ['.detail-table[hidden]'], |
| 1540 this.next); | 1540 this.next); |
| 1541 }, | 1541 }, |
| 1542 // Check the error. | 1542 // Check the error. |
| 1543 function() { | 1543 function() { |
| 1544 checkIfNoErrorsOccured(this.next); | 1544 checkIfNoErrorsOccured(this.next); |
| 1545 } | 1545 } |
| 1546 ]); | 1546 ]); |
| 1547 }; | 1547 }; |
| 1548 | 1548 |
| 1549 /** | 1549 /** |
| 1550 * Tests keyboard operations of the navigation list. | 1550 * Tests keyboard operations of the navigation list. |
| 1551 */ | 1551 */ |
| 1552 testcase.traverseNavigationList = function() { | 1552 testcase.traverseNavigationList = function() { |
| 1553 var appId; | 1553 var appId; |
| 1554 StepsRunner.run([ | 1554 StepsRunner.run([ |
| 1555 // Set up File Manager. | 1555 // Set up File Manager. |
| 1556 function() { | 1556 function() { |
| 1557 var appState = {defaultPath: '/drive/root'}; | 1557 var appState = {currentDirectoryPath: '/drive/root'}; |
| 1558 setupAndWaitUntilReady(appState, this.next); | 1558 setupAndWaitUntilReady(appState, this.next); |
| 1559 }, | 1559 }, |
| 1560 // Wait until Google Drive is selected. | 1560 // Wait until Google Drive is selected. |
| 1561 function(inAppId) { | 1561 function(inAppId) { |
| 1562 appId = inAppId; | 1562 appId = inAppId; |
| 1563 callRemoteTestUtil( | 1563 callRemoteTestUtil( |
| 1564 'waitForElement', | 1564 'waitForElement', |
| 1565 appId, | 1565 appId, |
| 1566 ['#navigation-list > .root-item > ' + | 1566 ['#navigation-list > .root-item > ' + |
| 1567 '.volume-icon[volume-type-icon="drive"]'], | 1567 '.volume-icon[volume-type-icon="drive"]'], |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1643 | 1643 |
| 1644 /** | 1644 /** |
| 1645 * Tests restoring geometry of the Files app. | 1645 * Tests restoring geometry of the Files app. |
| 1646 */ | 1646 */ |
| 1647 testcase.restoreGeometry = function() { | 1647 testcase.restoreGeometry = function() { |
| 1648 var appId; | 1648 var appId; |
| 1649 var appId2; | 1649 var appId2; |
| 1650 StepsRunner.run([ | 1650 StepsRunner.run([ |
| 1651 // Set up File Manager. | 1651 // Set up File Manager. |
| 1652 function() { | 1652 function() { |
| 1653 var appState = {defaultPath: '/Downloads'}; | 1653 var appState = {currentDirectoryPath: '/Downloads'}; |
| 1654 setupAndWaitUntilReady(appState, this.next); | 1654 setupAndWaitUntilReady(appState, this.next); |
| 1655 }, | 1655 }, |
| 1656 // Resize the window to minimal dimensions. | 1656 // Resize the window to minimal dimensions. |
| 1657 function(inAppId) { | 1657 function(inAppId) { |
| 1658 appId = inAppId; | 1658 appId = inAppId; |
| 1659 callRemoteTestUtil( | 1659 callRemoteTestUtil( |
| 1660 'resizeWindow', appId, [640, 480], this.next); | 1660 'resizeWindow', appId, [640, 480], this.next); |
| 1661 }, | 1661 }, |
| 1662 // Check the current window's size. | 1662 // Check the current window's size. |
| 1663 function(inAppId) { | 1663 function(inAppId) { |
| 1664 callRemoteTestUtil('waitForWindowGeometry', | 1664 callRemoteTestUtil('waitForWindowGeometry', |
| 1665 appId, | 1665 appId, |
| 1666 [640, 480], | 1666 [640, 480], |
| 1667 this.next); | 1667 this.next); |
| 1668 }, | 1668 }, |
| 1669 // Enlarge the window by 10 pixels. | 1669 // Enlarge the window by 10 pixels. |
| 1670 function(result) { | 1670 function(result) { |
| 1671 callRemoteTestUtil( | 1671 callRemoteTestUtil( |
| 1672 'resizeWindow', appId, [650, 490], this.next); | 1672 'resizeWindow', appId, [650, 490], this.next); |
| 1673 }, | 1673 }, |
| 1674 // Check the current window's size. | 1674 // Check the current window's size. |
| 1675 function() { | 1675 function() { |
| 1676 callRemoteTestUtil('waitForWindowGeometry', | 1676 callRemoteTestUtil('waitForWindowGeometry', |
| 1677 appId, | 1677 appId, |
| 1678 [650, 490], | 1678 [650, 490], |
| 1679 this.next); | 1679 this.next); |
| 1680 }, | 1680 }, |
| 1681 // Open another window, where the current view is restored. | 1681 // Open another window, where the current view is restored. |
| 1682 function() { | 1682 function() { |
| 1683 var appState = {defaultPath: '/Downloads'}; | 1683 var appState = {currentDirectoryPath: '/Downloads'}; |
| 1684 setupAndWaitUntilReady(appState, this.next); | 1684 setupAndWaitUntilReady(appState, this.next); |
| 1685 }, | 1685 }, |
| 1686 // Check the next window's size. | 1686 // Check the next window's size. |
| 1687 function(inAppId) { | 1687 function(inAppId) { |
| 1688 appId2 = inAppId; | 1688 appId2 = inAppId; |
| 1689 callRemoteTestUtil('waitForWindowGeometry', | 1689 callRemoteTestUtil('waitForWindowGeometry', |
| 1690 appId2, | 1690 appId2, |
| 1691 [650, 490], | 1691 [650, 490], |
| 1692 this.next); | 1692 this.next); |
| 1693 }, | 1693 }, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1711 testcase.intermediate.traverseDirectories.bind(null, '/drive/root'); | 1711 testcase.intermediate.traverseDirectories.bind(null, '/drive/root'); |
| 1712 | 1712 |
| 1713 /** | 1713 /** |
| 1714 * Tests the focus behavior of the search box. | 1714 * Tests the focus behavior of the search box. |
| 1715 */ | 1715 */ |
| 1716 testcase.searchBoxFocus = function() { | 1716 testcase.searchBoxFocus = function() { |
| 1717 var appId; | 1717 var appId; |
| 1718 StepsRunner.run([ | 1718 StepsRunner.run([ |
| 1719 // Set up File Manager. | 1719 // Set up File Manager. |
| 1720 function() { | 1720 function() { |
| 1721 var appState = {defaultPath: '/drive/root'}; | 1721 var appState = {currentDirectoryPath: '/drive/root'}; |
| 1722 setupAndWaitUntilReady(appState, this.next); | 1722 setupAndWaitUntilReady(appState, this.next); |
| 1723 }, | 1723 }, |
| 1724 // Check that the file list has the focus on launch. | 1724 // Check that the file list has the focus on launch. |
| 1725 function(inAppId) { | 1725 function(inAppId) { |
| 1726 appId = inAppId; | 1726 appId = inAppId; |
| 1727 callRemoteTestUtil( | 1727 callRemoteTestUtil( |
| 1728 'waitForElement', appId, ['#file-list:focus'], this.next); | 1728 'waitForElement', appId, ['#file-list:focus'], this.next); |
| 1729 }, | 1729 }, |
| 1730 // Press the Ctrl-F key. | 1730 // Press the Ctrl-F key. |
| 1731 function(element) { | 1731 function(element) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1761 }; | 1761 }; |
| 1762 | 1762 |
| 1763 /** | 1763 /** |
| 1764 * Tests if a thumbnail for the selected item shows up in the preview panel. | 1764 * Tests if a thumbnail for the selected item shows up in the preview panel. |
| 1765 * This thumbnail is fetched via the image loader. | 1765 * This thumbnail is fetched via the image loader. |
| 1766 */ | 1766 */ |
| 1767 testcase.thumbnailsDownloads = function() { | 1767 testcase.thumbnailsDownloads = function() { |
| 1768 var appId; | 1768 var appId; |
| 1769 StepsRunner.run([ | 1769 StepsRunner.run([ |
| 1770 function() { | 1770 function() { |
| 1771 var appState = {defaultPath: '/Downloads'}; | 1771 var appState = {currentDirectoryPath: '/Downloads'}; |
| 1772 setupAndWaitUntilReady(appState, this.next); | 1772 setupAndWaitUntilReady(appState, this.next); |
| 1773 }, | 1773 }, |
| 1774 // Select the image. | 1774 // Select the image. |
| 1775 function(inAppId) { | 1775 function(inAppId) { |
| 1776 appId = inAppId; | 1776 appId = inAppId; |
| 1777 callRemoteTestUtil('selectFile', | 1777 callRemoteTestUtil('selectFile', |
| 1778 appId, | 1778 appId, |
| 1779 ['My Desktop Background.png'], | 1779 ['My Desktop Background.png'], |
| 1780 this.next); | 1780 this.next); |
| 1781 }, | 1781 }, |
| 1782 // Wait until the thumbnail shows up. | 1782 // Wait until the thumbnail shows up. |
| 1783 function(result) { | 1783 function(result) { |
| 1784 chrome.test.assertTrue(result); | 1784 chrome.test.assertTrue(result); |
| 1785 callRemoteTestUtil('waitForElement', | 1785 callRemoteTestUtil('waitForElement', |
| 1786 appId, | 1786 appId, |
| 1787 ['.preview-thumbnails .img-container img'], | 1787 ['.preview-thumbnails .img-container img'], |
| 1788 this.next); | 1788 this.next); |
| 1789 }, | 1789 }, |
| 1790 // Verify the thumbnail. | 1790 // Verify the thumbnail. |
| 1791 function(element) { | 1791 function(element) { |
| 1792 chrome.test.assertTrue(element.attributes.src.indexOf( | 1792 chrome.test.assertTrue(element.attributes.src.indexOf( |
| 1793 'data:image/jpeg') === 0); | 1793 'data:image/jpeg') === 0); |
| 1794 checkIfNoErrorsOccured(this.next); | 1794 checkIfNoErrorsOccured(this.next); |
| 1795 } | 1795 } |
| 1796 ]); | 1796 ]); |
| 1797 }; | 1797 }; |
| OLD | NEW |