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 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
939 } | 939 } |
940 | 940 |
941 // Loads all users to the current session and sets up necessary fields. | 941 // Loads all users to the current session and sets up necessary fields. |
942 // This is used for preparing all accounts in PRE_ test setup, and for testing | 942 // This is used for preparing all accounts in PRE_ test setup, and for testing |
943 // actual login behavior. | 943 // actual login behavior. |
944 void AddAllUsers() { | 944 void AddAllUsers() { |
945 for (size_t i = 0; i < arraysize(kTestAccounts); ++i) | 945 for (size_t i = 0; i < arraysize(kTestAccounts); ++i) |
946 AddUser(kTestAccounts[i], i >= SECONDARY_ACCOUNT_INDEX_START); | 946 AddUser(kTestAccounts[i], i >= SECONDARY_ACCOUNT_INDEX_START); |
947 } | 947 } |
948 | 948 |
949 // Add as many as users | |
950 void AddExtraUsersForStressTesting() { | |
951 ash::Shell* const shell = ash::Shell::GetInstance(); | |
952 const size_t maxLogin = | |
953 shell->session_state_delegate()->GetMaximumNumberOfLoggedInUsers(); | |
954 | |
955 for (int i = 0; i + arraysize(kTestAccounts) < maxLogin; ++i) { | |
956 const std::string email = base::StringPrintf("user%d@invalid.domain", i); | |
957 const std::string hash = base::StringPrintf("hashuser%d", i); | |
958 const std::string name = base::StringPrintf("Additional User %d", i); | |
959 const TestAccountInfo info = {email.c_str(), hash.c_str(), name.c_str()}; | |
960 AddUser(info, true); | |
961 } | |
962 } | |
963 | |
964 // Returns primary profile (if it is already created.) | 949 // Returns primary profile (if it is already created.) |
965 virtual Profile* profile() OVERRIDE { | 950 virtual Profile* profile() OVERRIDE { |
966 Profile* const profile = chromeos::ProfileHelper::GetProfileByUserIdHash( | 951 Profile* const profile = chromeos::ProfileHelper::GetProfileByUserIdHash( |
967 kTestAccounts[PRIMARY_ACCOUNT_INDEX].hash); | 952 kTestAccounts[PRIMARY_ACCOUNT_INDEX].hash); |
968 return profile ? profile : FileManagerBrowserTestBase::profile(); | 953 return profile ? profile : FileManagerBrowserTestBase::profile(); |
969 } | 954 } |
970 | 955 |
971 // Sets the test case name (used as a function name in test_cases.js to call.) | 956 // Sets the test case name (used as a function name in test_cases.js to call.) |
972 void set_test_case_name(const std::string& name) { test_case_name_ = name; } | 957 void set_test_case_name(const std::string& name) { test_case_name_ = name; } |
973 | 958 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 PRE_VisitDesktopMenu) { | 1040 PRE_VisitDesktopMenu) { |
1056 AddAllUsers(); | 1041 AddAllUsers(); |
1057 } | 1042 } |
1058 | 1043 |
1059 IN_PROC_BROWSER_TEST_F(MultiProfileFileManagerBrowserTest, VisitDesktopMenu) { | 1044 IN_PROC_BROWSER_TEST_F(MultiProfileFileManagerBrowserTest, VisitDesktopMenu) { |
1060 // Test for the menu item for visiting other profile's desktop. | 1045 // Test for the menu item for visiting other profile's desktop. |
1061 set_test_case_name("multiProfileVisitDesktopMenu"); | 1046 set_test_case_name("multiProfileVisitDesktopMenu"); |
1062 StartTest(); | 1047 StartTest(); |
1063 } | 1048 } |
1064 | 1049 |
1065 // TODO(kinaba): investigate the flakiness. | |
1066 IN_PROC_BROWSER_TEST_F(MultiProfileFileManagerBrowserTest, | |
1067 DISABLED_PRE_MaxUser) { | |
1068 AddAllUsers(); | |
1069 AddExtraUsersForStressTesting(); | |
1070 } | |
1071 | |
1072 IN_PROC_BROWSER_TEST_F(MultiProfileFileManagerBrowserTest, | |
1073 DISABLED_MaxUser) { | |
1074 // Run the same test as VisitDesktopMenu with maximum number of users logged | |
1075 // in and checks that nothing goes wrong. Here, the primary user (alice) logs | |
1076 // in first, then the "extra" users follow, and then lastly the other users | |
1077 // (bob and charlie) are added in the test. Thus the existing test verifies | |
1078 // that the feature is effectively working with lastly logged in users. | |
1079 AddExtraUsersForStressTesting(); | |
1080 | |
1081 set_test_case_name("multiProfileVisitDesktopMenu"); | |
1082 StartTest(); | |
1083 } | |
1084 | |
1085 template<GuestMode M> | 1050 template<GuestMode M> |
1086 class GalleryBrowserTestBase : public FileManagerBrowserTestBase { | 1051 class GalleryBrowserTestBase : public FileManagerBrowserTestBase { |
1087 public: | 1052 public: |
1088 virtual GuestMode GetGuestModeParam() const OVERRIDE { return M; } | 1053 virtual GuestMode GetGuestModeParam() const OVERRIDE { return M; } |
1089 virtual const char* GetTestCaseNameParam() const OVERRIDE { | 1054 virtual const char* GetTestCaseNameParam() const OVERRIDE { |
1090 return test_case_name_.c_str(); | 1055 return test_case_name_.c_str(); |
1091 } | 1056 } |
1092 | 1057 |
1093 protected: | 1058 protected: |
1094 virtual std::string OnMessage(const std::string& name, | 1059 virtual std::string OnMessage(const std::string& name, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1140 } | 1105 } |
1141 | 1106 |
1142 IN_PROC_BROWSER_TEST_F(GalleryBrowserTest, OpenSingleImageOnDrive) { | 1107 IN_PROC_BROWSER_TEST_F(GalleryBrowserTest, OpenSingleImageOnDrive) { |
1143 AddScript("gallery/open_image_files.js"); | 1108 AddScript("gallery/open_image_files.js"); |
1144 set_test_case_name("openSingleImageOnDrive"); | 1109 set_test_case_name("openSingleImageOnDrive"); |
1145 StartTest(); | 1110 StartTest(); |
1146 } | 1111 } |
1147 | 1112 |
1148 } // namespace | 1113 } // namespace |
1149 } // namespace file_manager | 1114 } // namespace file_manager |
OLD | NEW |