| 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/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 10 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
| 11 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 13 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/extensions/component_loader.h" | 15 #include "chrome/browser/extensions/component_loader.h" |
| 15 #include "chrome/browser/first_run/first_run.h" | 16 #include "chrome/browser/first_run/first_run.h" |
| 16 #include "chrome/browser/importer/importer_list.h" | 17 #include "chrome/browser/importer/importer_list.h" |
| 17 #include "chrome/browser/prefs/chrome_pref_service_factory.h" | 18 #include "chrome/browser/prefs/chrome_pref_service_factory.h" |
| 18 #include "chrome/browser/profiles/profile_manager.h" | 19 #include "chrome/browser/profiles/profile_manager.h" |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 " \"homepage\": \"example.com\",\n" | 242 " \"homepage\": \"example.com\",\n" |
| 242 " \"homepage_is_newtabpage\": false\n" | 243 " \"homepage_is_newtabpage\": false\n" |
| 243 "}\n"; | 244 "}\n"; |
| 244 // A test fixture that will run in a first run scenario with master_preferences | 245 // A test fixture that will run in a first run scenario with master_preferences |
| 245 // set to kWithTrackedPrefs. Parameterizable on the SettingsEnforcement | 246 // set to kWithTrackedPrefs. Parameterizable on the SettingsEnforcement |
| 246 // experiment to be forced. | 247 // experiment to be forced. |
| 247 class FirstRunMasterPrefsWithTrackedPreferences | 248 class FirstRunMasterPrefsWithTrackedPreferences |
| 248 : public FirstRunMasterPrefsBrowserTestT<kWithTrackedPrefs>, | 249 : public FirstRunMasterPrefsBrowserTestT<kWithTrackedPrefs>, |
| 249 public testing::WithParamInterface<std::string> { | 250 public testing::WithParamInterface<std::string> { |
| 250 public: | 251 public: |
| 252 FirstRunMasterPrefsWithTrackedPreferences() {} |
| 253 |
| 254 protected: |
| 251 void SetUpCommandLine(base::CommandLine* command_line) override { | 255 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 252 FirstRunMasterPrefsBrowserTestT::SetUpCommandLine(command_line); | 256 FirstRunMasterPrefsBrowserTestT::SetUpCommandLine(command_line); |
| 253 command_line->AppendSwitchASCII( | 257 command_line->AppendSwitchASCII( |
| 254 switches::kForceFieldTrials, | 258 switches::kForceFieldTrials, |
| 255 std::string(chrome_prefs::internals::kSettingsEnforcementTrialName) + | 259 std::string(chrome_prefs::internals::kSettingsEnforcementTrialName) + |
| 256 "/" + GetParam() + "/"); | 260 "/" + GetParam() + "/"); |
| 257 } | 261 } |
| 262 |
| 263 void SetUpInProcessBrowserTestFixture() override { |
| 264 FirstRunMasterPrefsBrowserTestT::SetUpInProcessBrowserTestFixture(); |
| 265 |
| 266 // Bots are on a domain, turn off the domain check for settings hardening in |
| 267 // order to be able to test all SettingsEnforcement groups. |
| 268 chrome_prefs::DisableDomainCheckForTesting(); |
| 269 } |
| 270 |
| 271 private: |
| 272 DISALLOW_COPY_AND_ASSIGN(FirstRunMasterPrefsWithTrackedPreferences); |
| 258 }; | 273 }; |
| 259 | 274 |
| 260 // http://crbug.com/314221 | 275 // http://crbug.com/314221 |
| 261 #if defined(GOOGLE_CHROME_BUILD) && (defined(OS_MACOSX) || defined(OS_LINUX)) | 276 #if defined(GOOGLE_CHROME_BUILD) && (defined(OS_MACOSX) || defined(OS_LINUX)) |
| 262 #define MAYBE_TrackedPreferencesSurviveFirstRun \ | 277 #define MAYBE_TrackedPreferencesSurviveFirstRun \ |
| 263 DISABLED_TrackedPreferencesSurviveFirstRun | 278 DISABLED_TrackedPreferencesSurviveFirstRun |
| 264 #else | 279 #else |
| 265 #define MAYBE_TrackedPreferencesSurviveFirstRun \ | 280 #define MAYBE_TrackedPreferencesSurviveFirstRun \ |
| 266 TrackedPreferencesSurviveFirstRun | 281 TrackedPreferencesSurviveFirstRun |
| 267 #endif | 282 #endif |
| (...skipping 20 matching lines...) Expand all Loading... |
| 288 FirstRunMasterPrefsWithTrackedPreferences, | 303 FirstRunMasterPrefsWithTrackedPreferences, |
| 289 testing::Values( | 304 testing::Values( |
| 290 chrome_prefs::internals::kSettingsEnforcementGroupNoEnforcement, | 305 chrome_prefs::internals::kSettingsEnforcementGroupNoEnforcement, |
| 291 chrome_prefs::internals::kSettingsEnforcementGroupEnforceAlways, | 306 chrome_prefs::internals::kSettingsEnforcementGroupEnforceAlways, |
| 292 chrome_prefs::internals:: | 307 chrome_prefs::internals:: |
| 293 kSettingsEnforcementGroupEnforceAlwaysWithDSE, | 308 kSettingsEnforcementGroupEnforceAlwaysWithDSE, |
| 294 chrome_prefs::internals:: | 309 chrome_prefs::internals:: |
| 295 kSettingsEnforcementGroupEnforceAlwaysWithExtensionsAndDSE)); | 310 kSettingsEnforcementGroupEnforceAlwaysWithExtensionsAndDSE)); |
| 296 | 311 |
| 297 #endif // !defined(OS_CHROMEOS) | 312 #endif // !defined(OS_CHROMEOS) |
| OLD | NEW |