Chromium Code Reviews| 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 // Browser test for basic Chrome OS file manager functionality: | 5 // Browser test for basic Chrome OS file manager functionality: |
| 6 // - The file list is updated when a file is added externally to the Downloads | 6 // - The file list is updated when a file is added externally to the Downloads |
| 7 // folder. | 7 // folder. |
| 8 // - Selecting a file and copy-pasting it with the keyboard copies the file. | 8 // - Selecting a file and copy-pasting it with the keyboard copies the file. |
| 9 // - Selecting a file and pressing delete deletes it. | 9 // - Selecting a file and pressing delete deletes it. |
| 10 | 10 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 59 const char* target_name; // Target file or directory name. | 59 const char* target_name; // Target file or directory name. |
| 60 const char* mime_type; | 60 const char* mime_type; |
| 61 SharedOption shared_option; | 61 SharedOption shared_option; |
| 62 const char* last_modified_time_as_string; | 62 const char* last_modified_time_as_string; |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 TestEntryInfo kTestEntrySetCommon[] = { | 65 TestEntryInfo kTestEntrySetCommon[] = { |
| 66 { FILE, "text.txt", "hello.txt", "text/plain", NONE, "4 Sep 1998 12:34:56" }, | 66 { FILE, "text.txt", "hello.txt", "text/plain", NONE, "4 Sep 1998 12:34:56" }, |
| 67 { FILE, "image.png", "My Desktop Background.png", "text/plain", NONE, | 67 { FILE, "image.png", "My Desktop Background.png", "text/plain", NONE, |
| 68 "18 Jan 2038 01:02:03" }, | 68 "18 Jan 2038 01:02:03" }, |
| 69 { FILE, "music.ogg", "Beautiful Song.ogg", "text/plain", NONE, | |
| 70 "12 Nov 2086 12:00:00" }, | |
| 69 { FILE, "video.ogv", kKeyboardTestFileName, "text/plain", NONE, | 71 { FILE, "video.ogv", kKeyboardTestFileName, "text/plain", NONE, |
| 70 "4 July 2012 10:35:00" }, | 72 "4 July 2012 10:35:00" }, |
| 71 { DIRECTORY, "", "photos", NULL, NONE, "1 Jan 1980 23:59:59" }, | 73 { DIRECTORY, "", "photos", NULL, NONE, "1 Jan 1980 23:59:59" }, |
| 72 { DIRECTORY, "", ".warez", NULL, NONE, "26 Oct 1985 13:39" } | 74 { DIRECTORY, "", ".warez", NULL, NONE, "26 Oct 1985 13:39" } |
| 73 }; | 75 }; |
| 74 | 76 |
| 75 TestEntryInfo kTestEntrySetDriveOnly[] = { | 77 TestEntryInfo kTestEntrySetDriveOnly[] = { |
| 76 { FILE, "", "Test Document", "application/vnd.google-apps.document", NONE, | 78 { FILE, "", "Test Document", "application/vnd.google-apps.document", NONE, |
| 77 "10 Apr 2013 16:20:00" }, | 79 "10 Apr 2013 16:20:00" }, |
| 78 { FILE, "", "Test Shared Document", "application/vnd.google-apps.document", | 80 { FILE, "", "Test Shared Document", "application/vnd.google-apps.document", |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 576 // Creates test files and directories. | 578 // Creates test files and directories. |
| 577 void CreateTestEntries(TestVolume* volume, const TestEntryInfo* entries, | 579 void CreateTestEntries(TestVolume* volume, const TestEntryInfo* entries, |
| 578 size_t num_entries); | 580 size_t num_entries); |
| 579 | 581 |
| 580 // Runs the file display test on the passed |volume|, shared by subclasses. | 582 // Runs the file display test on the passed |volume|, shared by subclasses. |
| 581 void DoTestFileDisplay(TestVolume* volume); | 583 void DoTestFileDisplay(TestVolume* volume); |
| 582 | 584 |
| 583 // Runs the gallery open test on the passed |volume|, shared by subclasses. | 585 // Runs the gallery open test on the passed |volume|, shared by subclasses. |
| 584 void DoTestGalleryOpen(TestVolume* volume); | 586 void DoTestGalleryOpen(TestVolume* volume); |
| 585 | 587 |
| 588 // Runs the audio open test on the passed |volume|, shared by subclasses. | |
| 589 void DoTestAudioOpen(TestVolume* volume); | |
| 590 | |
| 591 // Runs the video open test on the passed |volume|, shared by subclasses. | |
| 592 void DoTestVideoOpen(TestVolume* volume); | |
| 593 | |
| 586 // Runs the keyboard copy test on the passed |volume|, shared by subclasses. | 594 // Runs the keyboard copy test on the passed |volume|, shared by subclasses. |
| 587 void DoTestKeyboardCopy(TestVolume* volume); | 595 void DoTestKeyboardCopy(TestVolume* volume); |
| 588 | 596 |
| 589 // Runs the keyboard delete test on the passed |volume|, shared by subclasses. | 597 // Runs the keyboard delete test on the passed |volume|, shared by subclasses. |
| 590 void DoTestKeyboardDelete(TestVolume* volume); | 598 void DoTestKeyboardDelete(TestVolume* volume); |
| 591 }; | 599 }; |
| 592 | 600 |
| 593 void FileManagerBrowserTestBase::SetUpCommandLine(CommandLine* command_line) { | 601 void FileManagerBrowserTestBase::SetUpCommandLine(CommandLine* command_line) { |
| 594 bool in_guest_mode = GetParam(); | 602 bool in_guest_mode = GetParam(); |
| 595 if (in_guest_mode) { | 603 if (in_guest_mode) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 638 | 646 |
| 639 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 647 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 640 } | 648 } |
| 641 | 649 |
| 642 void FileManagerBrowserTestBase::DoTestGalleryOpen(TestVolume* volume) { | 650 void FileManagerBrowserTestBase::DoTestGalleryOpen(TestVolume* volume) { |
| 643 ResultCatcher catcher; | 651 ResultCatcher catcher; |
| 644 StartTest("galleryOpen" + volume->GetName()); | 652 StartTest("galleryOpen" + volume->GetName()); |
| 645 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 653 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 646 } | 654 } |
| 647 | 655 |
| 656 void FileManagerBrowserTestBase::DoTestAudioOpen(TestVolume* volume) { | |
| 657 ResultCatcher catcher; | |
| 658 StartTest("audioOpen" + volume->GetName()); | |
|
hashimoto
2013/05/28 07:54:12
Can't these method inlined in the test bodies?
If
mtomasz
2013/05/28 10:26:38
Sure, they can. I were this way for consistency. F
| |
| 659 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | |
| 660 } | |
| 661 | |
| 662 void FileManagerBrowserTestBase::DoTestVideoOpen(TestVolume* volume) { | |
| 663 ResultCatcher catcher; | |
| 664 StartTest("videoOpen" + volume->GetName()); | |
| 665 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | |
| 666 } | |
| 667 | |
| 648 void FileManagerBrowserTestBase::DoTestKeyboardCopy(TestVolume* volume) { | 668 void FileManagerBrowserTestBase::DoTestKeyboardCopy(TestVolume* volume) { |
| 649 base::FilePath copy_path = | 669 base::FilePath copy_path = |
| 650 volume->GetRootPath().AppendASCII(kKeyboardTestFileCopyName); | 670 volume->GetRootPath().AppendASCII(kKeyboardTestFileCopyName); |
| 651 ASSERT_FALSE(volume->PathExists(copy_path)); | 671 ASSERT_FALSE(volume->PathExists(copy_path)); |
| 652 | 672 |
| 653 ResultCatcher catcher; | 673 ResultCatcher catcher; |
| 654 ASSERT_NO_FATAL_FAILURE(StartTest("keyboardCopy" + volume->GetName())); | 674 ASSERT_NO_FATAL_FAILURE(StartTest("keyboardCopy" + volume->GetName())); |
| 655 | 675 |
| 656 const int64 kKeyboardTestFileSize = 59943; | 676 const int64 kKeyboardTestFileSize = 59943; |
| 657 | 677 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 773 } | 793 } |
| 774 | 794 |
| 775 IN_PROC_BROWSER_TEST_P(FileManagerBrowserLocalTest, TestGalleryOpen) { | 795 IN_PROC_BROWSER_TEST_P(FileManagerBrowserLocalTest, TestGalleryOpen) { |
| 776 DoTestGalleryOpen(&volume_); | 796 DoTestGalleryOpen(&volume_); |
| 777 } | 797 } |
| 778 | 798 |
| 779 IN_PROC_BROWSER_TEST_P(FileManagerBrowserDriveTest, TestGalleryOpen) { | 799 IN_PROC_BROWSER_TEST_P(FileManagerBrowserDriveTest, TestGalleryOpen) { |
| 780 DoTestGalleryOpen(&volume_); | 800 DoTestGalleryOpen(&volume_); |
| 781 } | 801 } |
| 782 | 802 |
| 803 IN_PROC_BROWSER_TEST_P(FileManagerBrowserLocalTest, TestAudioOpen) { | |
| 804 DoTestAudioOpen(&volume_); | |
| 805 } | |
| 806 | |
| 807 IN_PROC_BROWSER_TEST_P(FileManagerBrowserDriveTest, TestAudioOpen) { | |
| 808 DoTestAudioOpen(&volume_); | |
| 809 } | |
| 810 | |
| 811 IN_PROC_BROWSER_TEST_P(FileManagerBrowserLocalTest, TestVideoOpen) { | |
| 812 DoTestVideoOpen(&volume_); | |
| 813 } | |
| 814 | |
| 815 IN_PROC_BROWSER_TEST_P(FileManagerBrowserDriveTest, TestVideoOpen) { | |
| 816 DoTestVideoOpen(&volume_); | |
| 817 } | |
| 818 | |
| 783 IN_PROC_BROWSER_TEST_P(FileManagerBrowserDriveTest, TestKeyboardCopy) { | 819 IN_PROC_BROWSER_TEST_P(FileManagerBrowserDriveTest, TestKeyboardCopy) { |
| 784 DoTestKeyboardCopy(&volume_); | 820 DoTestKeyboardCopy(&volume_); |
| 785 } | 821 } |
| 786 | 822 |
| 787 IN_PROC_BROWSER_TEST_P(FileManagerBrowserDriveTest, TestKeyboardDelete) { | 823 IN_PROC_BROWSER_TEST_P(FileManagerBrowserDriveTest, TestKeyboardDelete) { |
| 788 DoTestKeyboardDelete(&volume_); | 824 DoTestKeyboardDelete(&volume_); |
| 789 } | 825 } |
| 790 | 826 |
| 791 IN_PROC_BROWSER_TEST_P(FileManagerBrowserDriveTest, TestOpenRecent) { | 827 IN_PROC_BROWSER_TEST_P(FileManagerBrowserDriveTest, TestOpenRecent) { |
| 792 ResultCatcher catcher; | 828 ResultCatcher catcher; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 862 } | 898 } |
| 863 | 899 |
| 864 IN_PROC_BROWSER_TEST_P(FileManagerBrowserTransferTest, | 900 IN_PROC_BROWSER_TEST_P(FileManagerBrowserTransferTest, |
| 865 TransferFromOfflineToDrive) { | 901 TransferFromOfflineToDrive) { |
| 866 ResultCatcher catcher; | 902 ResultCatcher catcher; |
| 867 ASSERT_NO_FATAL_FAILURE(StartTest("transferFromOfflineToDrive")); | 903 ASSERT_NO_FATAL_FAILURE(StartTest("transferFromOfflineToDrive")); |
| 868 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 904 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 869 } | 905 } |
| 870 | 906 |
| 871 } // namespace | 907 } // namespace |
| OLD | NEW |