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

Unified Diff: chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_model_unittest.cc

Issue 2727063006: Settings reset prompt: add startup logic (Closed)
Patch Set: Nits 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_model_unittest.cc
diff --git a/chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_model_unittest.cc b/chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_model_unittest.cc
index d8c2006e72c249f3957f6f7201060ed9b9cb89af..05f1b5cf5f7ad4195afd36b2e393a768785d809f 100644
--- a/chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_model_unittest.cc
+++ b/chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_model_unittest.cc
@@ -30,6 +30,7 @@
#include "components/search_engines/template_url_data.h"
#include "components/search_engines/template_url_service.h"
#include "components/search_engines/template_url_service_client.h"
+#include "components/sync_preferences/testing_pref_service_syncable.h"
#include "content/public/browser/browser_context.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -96,7 +97,22 @@ class SettingsResetPromptModelTest
void SetUp() override {
extensions::ExtensionServiceTestBase::SetUp();
- InitializeEmptyExtensionService();
+
+ // By not specifying a pref_file filepath, we get a
+ // sync_preferences::TestingPrefServiceSyncable, which in turn provides us
+ // with a convient way of registring preferences.
+ ExtensionServiceInitParams init_params = CreateDefaultInitParams();
+ init_params.pref_file.clear();
+ InitializeExtensionService(init_params);
+
+#if !defined(OS_WIN)
+ // In production code, the settings reset prompt profile preferences are
+ // registered on Windows only. We explicitly register the prefs on
+ // non-Windows systems so that we can continue testing the model on more
+ // than just Windows.
+ SettingsResetPromptPrefsManager::RegisterProfilePrefs(
+ testing_pref_service()->registry());
+#endif // !defined(OS_WIN)
profile_->CreateWebDataService();
TemplateURLServiceFactory::GetInstance()->SetTestingFactory(

Powered by Google App Engine
This is Rietveld 408576698