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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 // This invokes BrowserMain, and does the import, so must be done last. | 95 // This invokes BrowserMain, and does the import, so must be done last. |
96 InProcessBrowserTest::SetUp(); | 96 InProcessBrowserTest::SetUp(); |
97 } | 97 } |
98 | 98 |
99 void TearDown() override { | 99 void TearDown() override { |
100 EXPECT_TRUE(base::DeleteFile(prefs_file_, false)); | 100 EXPECT_TRUE(base::DeleteFile(prefs_file_, false)); |
101 InProcessBrowserTest::TearDown(); | 101 InProcessBrowserTest::TearDown(); |
102 } | 102 } |
103 | 103 |
104 void SetUpCommandLine(CommandLine* command_line) override { | 104 void SetUpCommandLine(base::CommandLine* command_line) override { |
105 InProcessBrowserTest::SetUpCommandLine(command_line); | 105 InProcessBrowserTest::SetUpCommandLine(command_line); |
106 command_line->AppendSwitch(switches::kForceFirstRun); | 106 command_line->AppendSwitch(switches::kForceFirstRun); |
107 EXPECT_EQ(first_run::AUTO_IMPORT_NONE, first_run::auto_import_state()); | 107 EXPECT_EQ(first_run::AUTO_IMPORT_NONE, first_run::auto_import_state()); |
108 | 108 |
109 extensions::ComponentLoader::EnableBackgroundExtensionsForTesting(); | 109 extensions::ComponentLoader::EnableBackgroundExtensionsForTesting(); |
110 } | 110 } |
111 | 111 |
112 void SetMasterPreferencesForTest(const char text[]) { | 112 void SetMasterPreferencesForTest(const char text[]) { |
113 text_.reset(new std::string(text)); | 113 text_.reset(new std::string(text)); |
114 } | 114 } |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 " \"homepage\": \"example.com\",\n" | 240 " \"homepage\": \"example.com\",\n" |
241 " \"homepage_is_newtabpage\": false\n" | 241 " \"homepage_is_newtabpage\": false\n" |
242 "}\n"; | 242 "}\n"; |
243 // A test fixture that will run in a first run scenario with master_preferences | 243 // A test fixture that will run in a first run scenario with master_preferences |
244 // set to kWithTrackedPrefs. Parameterizable on the SettingsEnforcement | 244 // set to kWithTrackedPrefs. Parameterizable on the SettingsEnforcement |
245 // experiment to be forced. | 245 // experiment to be forced. |
246 class FirstRunMasterPrefsWithTrackedPreferences | 246 class FirstRunMasterPrefsWithTrackedPreferences |
247 : public FirstRunMasterPrefsBrowserTestT<kWithTrackedPrefs>, | 247 : public FirstRunMasterPrefsBrowserTestT<kWithTrackedPrefs>, |
248 public testing::WithParamInterface<std::string> { | 248 public testing::WithParamInterface<std::string> { |
249 public: | 249 public: |
250 void SetUpCommandLine(CommandLine* command_line) override { | 250 void SetUpCommandLine(base::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) || defined(OS_LINUX)) | 260 #if defined(GOOGLE_CHROME_BUILD) && (defined(OS_MACOSX) || defined(OS_LINUX)) |
(...skipping 26 matching lines...) Expand all Loading... |
287 FirstRunMasterPrefsWithTrackedPreferences, | 287 FirstRunMasterPrefsWithTrackedPreferences, |
288 testing::Values( | 288 testing::Values( |
289 chrome_prefs::internals::kSettingsEnforcementGroupNoEnforcement, | 289 chrome_prefs::internals::kSettingsEnforcementGroupNoEnforcement, |
290 chrome_prefs::internals::kSettingsEnforcementGroupEnforceAlways, | 290 chrome_prefs::internals::kSettingsEnforcementGroupEnforceAlways, |
291 chrome_prefs::internals:: | 291 chrome_prefs::internals:: |
292 kSettingsEnforcementGroupEnforceAlwaysWithDSE, | 292 kSettingsEnforcementGroupEnforceAlwaysWithDSE, |
293 chrome_prefs::internals:: | 293 chrome_prefs::internals:: |
294 kSettingsEnforcementGroupEnforceAlwaysWithExtensionsAndDSE)); | 294 kSettingsEnforcementGroupEnforceAlwaysWithExtensionsAndDSE)); |
295 | 295 |
296 #endif // !defined(OS_CHROMEOS) | 296 #endif // !defined(OS_CHROMEOS) |
OLD | NEW |