Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Side by Side Diff: chrome/browser/first_run/first_run_browsertest.cc

Issue 2705113005: Update AutoImport to import nothing by default (in absence of policy and master_prefs). (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 "{\n" 169 "{\n"
170 "}\n"; 170 "}\n";
171 typedef FirstRunMasterPrefsBrowserTestT<kImportDefault> 171 typedef FirstRunMasterPrefsBrowserTestT<kImportDefault>
172 FirstRunMasterPrefsImportDefault; 172 FirstRunMasterPrefsImportDefault;
173 // http://crbug.com/314221 173 // http://crbug.com/314221
174 #if defined(OS_MACOSX) || (defined(GOOGLE_CHROME_BUILD) && defined(OS_LINUX)) 174 #if defined(OS_MACOSX) || (defined(GOOGLE_CHROME_BUILD) && defined(OS_LINUX))
175 #define MAYBE_ImportDefault DISABLED_ImportDefault 175 #define MAYBE_ImportDefault DISABLED_ImportDefault
176 #else 176 #else
177 #define MAYBE_ImportDefault ImportDefault 177 #define MAYBE_ImportDefault ImportDefault
178 #endif 178 #endif
179 // No items are imported by default.
179 IN_PROC_BROWSER_TEST_F(FirstRunMasterPrefsImportDefault, MAYBE_ImportDefault) { 180 IN_PROC_BROWSER_TEST_F(FirstRunMasterPrefsImportDefault, MAYBE_ImportDefault) {
180 int auto_import_state = first_run::auto_import_state(); 181 int auto_import_state = first_run::auto_import_state();
182 EXPECT_EQ(MaskExpectedImportState(first_run::AUTO_IMPORT_CALLED),
183 auto_import_state);
184 }
185
186 extern const char kImportAll[] =
grt (UTC plus 2) 2017/02/23 14:05:48 why do these all have external linkage? why not ju
gab 2017/02/23 20:37:40 I forget, IIRC it was required for the template ma
187 "{\n"
188 " \"distribution\": {\n"
189 " \"import_bookmarks\": true,\n"
190 " \"import_history\": true,\n"
191 " \"import_home_page\": true,\n"
192 " \"import_search_engine\": true\n"
193 " }\n"
194 "}\n";
195 typedef FirstRunMasterPrefsBrowserTestT<kImportAll>
196 FirstRunMasterPrefsImportAll;
197 // http://crbug.com/314221
198 #if defined(OS_MACOSX) || (defined(GOOGLE_CHROME_BUILD) && defined(OS_LINUX))
199 #define MAYBE_ImportAll DISABLED_ImportAll
200 #else
201 #define MAYBE_ImportAll ImportAll
202 #endif
203 IN_PROC_BROWSER_TEST_F(FirstRunMasterPrefsImportAll, MAYBE_ImportAll) {
204 int auto_import_state = first_run::auto_import_state();
181 EXPECT_EQ(MaskExpectedImportState(first_run::AUTO_IMPORT_CALLED | 205 EXPECT_EQ(MaskExpectedImportState(first_run::AUTO_IMPORT_CALLED |
182 first_run::AUTO_IMPORT_PROFILE_IMPORTED), 206 first_run::AUTO_IMPORT_PROFILE_IMPORTED),
183 auto_import_state); 207 auto_import_state);
184 } 208 }
185 209
186 // The bookmarks file doesn't actually need to exist for this integration test 210 // The bookmarks file doesn't actually need to exist for this integration test
187 // to trigger the interaction being tested. 211 // to trigger the interaction being tested.
188 extern const char kImportBookmarksFile[] = 212 extern const char kImportBookmarksFile[] =
189 "{\n" 213 "{\n"
190 " \"distribution\": {\n" 214 " \"distribution\": {\n"
191 " \"import_bookmarks_from_file\": \"/foo/doesntexists.wtv\"\n" 215 " \"import_bookmarks_from_file\": \"/foo/doesntexists.wtv\"\n"
192 " }\n" 216 " }\n"
193 "}\n"; 217 "}\n";
194 typedef FirstRunMasterPrefsBrowserTestT<kImportBookmarksFile> 218 typedef FirstRunMasterPrefsBrowserTestT<kImportBookmarksFile>
195 FirstRunMasterPrefsImportBookmarksFile; 219 FirstRunMasterPrefsImportBookmarksFile;
196 // http://crbug.com/314221 220 // http://crbug.com/314221
197 #if (defined(GOOGLE_CHROME_BUILD) && defined(OS_LINUX)) || defined(OS_MACOSX) 221 #if (defined(GOOGLE_CHROME_BUILD) && defined(OS_LINUX)) || defined(OS_MACOSX)
198 #define MAYBE_ImportBookmarksFile DISABLED_ImportBookmarksFile 222 #define MAYBE_ImportBookmarksFile DISABLED_ImportBookmarksFile
199 #else 223 #else
200 #define MAYBE_ImportBookmarksFile ImportBookmarksFile 224 #define MAYBE_ImportBookmarksFile ImportBookmarksFile
201 #endif 225 #endif
202 IN_PROC_BROWSER_TEST_F(FirstRunMasterPrefsImportBookmarksFile, 226 IN_PROC_BROWSER_TEST_F(FirstRunMasterPrefsImportBookmarksFile,
203 MAYBE_ImportBookmarksFile) { 227 MAYBE_ImportBookmarksFile) {
204 int auto_import_state = first_run::auto_import_state(); 228 int auto_import_state = first_run::auto_import_state();
205 EXPECT_EQ( 229 EXPECT_EQ(
206 MaskExpectedImportState(first_run::AUTO_IMPORT_CALLED | 230 MaskExpectedImportState(first_run::AUTO_IMPORT_CALLED |
207 first_run::AUTO_IMPORT_PROFILE_IMPORTED |
208 first_run::AUTO_IMPORT_BOOKMARKS_FILE_IMPORTED), 231 first_run::AUTO_IMPORT_BOOKMARKS_FILE_IMPORTED),
209 auto_import_state); 232 auto_import_state);
210 } 233 }
211 234
212 // Test an import with all import options disabled. This is a regression test 235 // Test an import with all import options disabled. This is a regression test
213 // for http://crbug.com/169984 where this would cause the import process to 236 // for http://crbug.com/169984 where this would cause the import process to
214 // stay running, and the NTP to be loaded with no apps. 237 // stay running, and the NTP to be loaded with no apps.
215 extern const char kImportNothing[] = 238 extern const char kImportNothing[] =
216 "{\n" 239 "{\n"
217 " \"distribution\": {\n" 240 " \"distribution\": {\n"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 FirstRunMasterPrefsWithTrackedPreferences, 328 FirstRunMasterPrefsWithTrackedPreferences,
306 testing::Values( 329 testing::Values(
307 chrome_prefs::internals::kSettingsEnforcementGroupNoEnforcement, 330 chrome_prefs::internals::kSettingsEnforcementGroupNoEnforcement,
308 chrome_prefs::internals::kSettingsEnforcementGroupEnforceAlways, 331 chrome_prefs::internals::kSettingsEnforcementGroupEnforceAlways,
309 chrome_prefs::internals:: 332 chrome_prefs::internals::
310 kSettingsEnforcementGroupEnforceAlwaysWithDSE, 333 kSettingsEnforcementGroupEnforceAlwaysWithDSE,
311 chrome_prefs::internals:: 334 chrome_prefs::internals::
312 kSettingsEnforcementGroupEnforceAlwaysWithExtensionsAndDSE)); 335 kSettingsEnforcementGroupEnforceAlwaysWithExtensionsAndDSE));
313 336
314 #endif // !defined(OS_CHROMEOS) 337 #endif // !defined(OS_CHROMEOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698