OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include <string> | 5 #include <string> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 } | 158 } |
159 | 159 |
160 } // namespace | 160 } // namespace |
161 | 161 |
162 extern const char kImportDefault[] = | 162 extern const char kImportDefault[] = |
163 "{\n" | 163 "{\n" |
164 "}\n"; | 164 "}\n"; |
165 typedef FirstRunMasterPrefsBrowserTestT<kImportDefault> | 165 typedef FirstRunMasterPrefsBrowserTestT<kImportDefault> |
166 FirstRunMasterPrefsImportDefault; | 166 FirstRunMasterPrefsImportDefault; |
167 // http://crbug.com/314221 | 167 // http://crbug.com/314221 |
168 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX) | 168 #if defined(GOOGLE_CHROME_BUILD) && (defined(OS_MACOSX) || defined(OS_LINUX)) |
169 #define MAYBE_ImportDefault DISABLED_ImportDefault | 169 #define MAYBE_ImportDefault DISABLED_ImportDefault |
170 #else | 170 #else |
171 #define MAYBE_ImportDefault ImportDefault | 171 #define MAYBE_ImportDefault ImportDefault |
172 #endif | 172 #endif |
173 IN_PROC_BROWSER_TEST_F(FirstRunMasterPrefsImportDefault, MAYBE_ImportDefault) { | 173 IN_PROC_BROWSER_TEST_F(FirstRunMasterPrefsImportDefault, MAYBE_ImportDefault) { |
174 int auto_import_state = first_run::auto_import_state(); | 174 int auto_import_state = first_run::auto_import_state(); |
175 EXPECT_EQ(MaskExpectedImportState(first_run::AUTO_IMPORT_CALLED | | 175 EXPECT_EQ(MaskExpectedImportState(first_run::AUTO_IMPORT_CALLED | |
176 first_run::AUTO_IMPORT_PROFILE_IMPORTED), | 176 first_run::AUTO_IMPORT_PROFILE_IMPORTED), |
177 auto_import_state); | 177 auto_import_state); |
178 } | 178 } |
179 | 179 |
180 // The bookmarks file doesn't actually need to exist for this integration test | 180 // The bookmarks file doesn't actually need to exist for this integration test |
181 // to trigger the interaction being tested. | 181 // to trigger the interaction being tested. |
182 extern const char kImportBookmarksFile[] = | 182 extern const char kImportBookmarksFile[] = |
183 "{\n" | 183 "{\n" |
184 " \"distribution\": {\n" | 184 " \"distribution\": {\n" |
185 " \"import_bookmarks_from_file\": \"/foo/doesntexists.wtv\"\n" | 185 " \"import_bookmarks_from_file\": \"/foo/doesntexists.wtv\"\n" |
186 " }\n" | 186 " }\n" |
187 "}\n"; | 187 "}\n"; |
188 typedef FirstRunMasterPrefsBrowserTestT<kImportBookmarksFile> | 188 typedef FirstRunMasterPrefsBrowserTestT<kImportBookmarksFile> |
189 FirstRunMasterPrefsImportBookmarksFile; | 189 FirstRunMasterPrefsImportBookmarksFile; |
190 // http://crbug.com/314221 | 190 // http://crbug.com/314221 |
191 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX) | 191 #if defined(GOOGLE_CHROME_BUILD) && (defined(OS_MACOSX) || defined(OS_LINUX)) |
192 #define MAYBE_ImportBookmarksFile DISABLED_ImportBookmarksFile | 192 #define MAYBE_ImportBookmarksFile DISABLED_ImportBookmarksFile |
193 #else | 193 #else |
194 #define MAYBE_ImportBookmarksFile ImportBookmarksFile | 194 #define MAYBE_ImportBookmarksFile ImportBookmarksFile |
195 #endif | 195 #endif |
196 IN_PROC_BROWSER_TEST_F(FirstRunMasterPrefsImportBookmarksFile, | 196 IN_PROC_BROWSER_TEST_F(FirstRunMasterPrefsImportBookmarksFile, |
197 MAYBE_ImportBookmarksFile) { | 197 MAYBE_ImportBookmarksFile) { |
198 int auto_import_state = first_run::auto_import_state(); | 198 int auto_import_state = first_run::auto_import_state(); |
199 EXPECT_EQ( | 199 EXPECT_EQ( |
200 MaskExpectedImportState(first_run::AUTO_IMPORT_CALLED | | 200 MaskExpectedImportState(first_run::AUTO_IMPORT_CALLED | |
201 first_run::AUTO_IMPORT_PROFILE_IMPORTED | | 201 first_run::AUTO_IMPORT_PROFILE_IMPORTED | |
202 first_run::AUTO_IMPORT_BOOKMARKS_FILE_IMPORTED), | 202 first_run::AUTO_IMPORT_BOOKMARKS_FILE_IMPORTED), |
203 auto_import_state); | 203 auto_import_state); |
204 } | 204 } |
205 | 205 |
206 // Test an import with all import options disabled. This is a regression test | 206 // Test an import with all import options disabled. This is a regression test |
207 // for http://crbug.com/169984 where this would cause the import process to | 207 // for http://crbug.com/169984 where this would cause the import process to |
208 // stay running, and the NTP to be loaded with no apps. | 208 // stay running, and the NTP to be loaded with no apps. |
209 extern const char kImportNothing[] = | 209 extern const char kImportNothing[] = |
210 "{\n" | 210 "{\n" |
211 " \"distribution\": {\n" | 211 " \"distribution\": {\n" |
212 " \"import_bookmarks\": false,\n" | 212 " \"import_bookmarks\": false,\n" |
213 " \"import_history\": false,\n" | 213 " \"import_history\": false,\n" |
214 " \"import_home_page\": false,\n" | 214 " \"import_home_page\": false,\n" |
215 " \"import_search_engine\": false\n" | 215 " \"import_search_engine\": false\n" |
216 " }\n" | 216 " }\n" |
217 "}\n"; | 217 "}\n"; |
218 typedef FirstRunMasterPrefsBrowserTestT<kImportNothing> | 218 typedef FirstRunMasterPrefsBrowserTestT<kImportNothing> |
219 FirstRunMasterPrefsImportNothing; | 219 FirstRunMasterPrefsImportNothing; |
220 // http://crbug.com/314221 | 220 // http://crbug.com/314221 |
221 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX) | 221 #if defined(GOOGLE_CHROME_BUILD) && (defined(OS_MACOSX) || defined(OS_LINUX)) |
222 #define MAYBE_ImportNothingAndShowNewTabPage \ | 222 #define MAYBE_ImportNothingAndShowNewTabPage \ |
223 DISABLED_ImportNothingAndShowNewTabPage | 223 DISABLED_ImportNothingAndShowNewTabPage |
224 #else | 224 #else |
225 #define MAYBE_ImportNothingAndShowNewTabPage ImportNothingAndShowNewTabPage | 225 #define MAYBE_ImportNothingAndShowNewTabPage ImportNothingAndShowNewTabPage |
226 #endif | 226 #endif |
227 IN_PROC_BROWSER_TEST_F(FirstRunMasterPrefsImportNothing, | 227 IN_PROC_BROWSER_TEST_F(FirstRunMasterPrefsImportNothing, |
228 MAYBE_ImportNothingAndShowNewTabPage) { | 228 MAYBE_ImportNothingAndShowNewTabPage) { |
229 EXPECT_EQ(first_run::AUTO_IMPORT_CALLED, first_run::auto_import_state()); | 229 EXPECT_EQ(first_run::AUTO_IMPORT_CALLED, first_run::auto_import_state()); |
230 ui_test_utils::NavigateToURLWithDisposition( | 230 ui_test_utils::NavigateToURLWithDisposition( |
231 browser(), GURL(chrome::kChromeUINewTabURL), CURRENT_TAB, | 231 browser(), GURL(chrome::kChromeUINewTabURL), CURRENT_TAB, |
(...skipping 18 matching lines...) Expand all Loading... |
250 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 250 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
251 FirstRunMasterPrefsBrowserTestT::SetUpCommandLine(command_line); | 251 FirstRunMasterPrefsBrowserTestT::SetUpCommandLine(command_line); |
252 command_line->AppendSwitchASCII( | 252 command_line->AppendSwitchASCII( |
253 switches::kForceFieldTrials, | 253 switches::kForceFieldTrials, |
254 std::string(chrome_prefs::internals::kSettingsEnforcementTrialName) + | 254 std::string(chrome_prefs::internals::kSettingsEnforcementTrialName) + |
255 "/" + GetParam() + "/"); | 255 "/" + GetParam() + "/"); |
256 } | 256 } |
257 }; | 257 }; |
258 | 258 |
259 // http://crbug.com/314221 | 259 // http://crbug.com/314221 |
260 #if defined(GOOGLE_CHROME_BUILD) && defined(OS_MACOSX) | 260 #if defined(GOOGLE_CHROME_BUILD) && (defined(OS_MACOSX) || defined(OS_LINUX)) |
261 #define MAYBE_TrackedPreferencesSurviveFirstRun \ | 261 #define MAYBE_TrackedPreferencesSurviveFirstRun \ |
262 DISABLED_TrackedPreferencesSurviveFirstRun | 262 DISABLED_TrackedPreferencesSurviveFirstRun |
263 #else | 263 #else |
264 #define MAYBE_TrackedPreferencesSurviveFirstRun \ | 264 #define MAYBE_TrackedPreferencesSurviveFirstRun \ |
265 TrackedPreferencesSurviveFirstRun | 265 TrackedPreferencesSurviveFirstRun |
266 #endif | 266 #endif |
267 IN_PROC_BROWSER_TEST_P(FirstRunMasterPrefsWithTrackedPreferences, | 267 IN_PROC_BROWSER_TEST_P(FirstRunMasterPrefsWithTrackedPreferences, |
268 MAYBE_TrackedPreferencesSurviveFirstRun) { | 268 MAYBE_TrackedPreferencesSurviveFirstRun) { |
269 const PrefService* user_prefs = browser()->profile()->GetPrefs(); | 269 const PrefService* user_prefs = browser()->profile()->GetPrefs(); |
270 EXPECT_EQ("example.com", user_prefs->GetString(prefs::kHomePage)); | 270 EXPECT_EQ("example.com", user_prefs->GetString(prefs::kHomePage)); |
(...skipping 14 matching lines...) Expand all Loading... |
285 INSTANTIATE_TEST_CASE_P( | 285 INSTANTIATE_TEST_CASE_P( |
286 FirstRunMasterPrefsWithTrackedPreferencesInstance, | 286 FirstRunMasterPrefsWithTrackedPreferencesInstance, |
287 FirstRunMasterPrefsWithTrackedPreferences, | 287 FirstRunMasterPrefsWithTrackedPreferences, |
288 testing::Values( | 288 testing::Values( |
289 chrome_prefs::internals::kSettingsEnforcementGroupNoEnforcement, | 289 chrome_prefs::internals::kSettingsEnforcementGroupNoEnforcement, |
290 chrome_prefs::internals::kSettingsEnforcementGroupEnforceOnload, | 290 chrome_prefs::internals::kSettingsEnforcementGroupEnforceOnload, |
291 chrome_prefs::internals::kSettingsEnforcementGroupEnforceAlways)); | 291 chrome_prefs::internals::kSettingsEnforcementGroupEnforceAlways)); |
292 | 292 |
293 | 293 |
294 #endif // !defined(OS_CHROMEOS) | 294 #endif // !defined(OS_CHROMEOS) |
OLD | NEW |