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

Unified Diff: chrome/installer/util/master_preferences_unittest.cc

Issue 2714853002: Remove kDistroDict from Preferences. (Closed)
Patch Set: kRlzPingDelay -> kRlzPingDelaySeconds 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
« no previous file with comments | « chrome/installer/util/master_preferences_constants.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/util/master_preferences_unittest.cc
diff --git a/chrome/installer/util/master_preferences_unittest.cc b/chrome/installer/util/master_preferences_unittest.cc
index 019ac57cdf4f1b2806a73a53d8bd1905624305a5..e91b8b9a896cf805e6c2dd560a96827ba6dc7e38 100644
--- a/chrome/installer/util/master_preferences_unittest.cc
+++ b/chrome/installer/util/master_preferences_unittest.cc
@@ -19,6 +19,7 @@
#include "chrome/common/pref_names.h"
#include "chrome/installer/util/master_preferences_constants.h"
#include "chrome/installer/util/util_constants.h"
+#include "rlz/features/features.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
@@ -89,8 +90,7 @@ TEST_F(MasterPreferencesTest, ParseDistroParams) {
" \"make_chrome_default_for_user\": true,\n"
" \"system_level\": true,\n"
" \"verbose_logging\": true,\n"
- " \"require_eula\": true,\n"
- " \"ping_delay\": 40\n"
+ " \"require_eula\": true\n"
" },\n"
" \"blah\": {\n"
" \"import_history\": false\n"
@@ -131,11 +131,6 @@ TEST_F(MasterPreferencesTest, ParseDistroParams) {
installer::master_preferences::kDistroImportBookmarksFromFilePref,
&str_value));
EXPECT_STREQ("c:\\foo", str_value.c_str());
-
- int ping_delay = 90;
- EXPECT_TRUE(prefs.GetInt(installer::master_preferences::kDistroPingDelay,
- &ping_delay));
- EXPECT_EQ(ping_delay, 40);
}
TEST_F(MasterPreferencesTest, ParseMissingDistroParams) {
@@ -186,11 +181,6 @@ TEST_F(MasterPreferencesTest, ParseMissingDistroParams) {
EXPECT_FALSE(prefs.GetString(
installer::master_preferences::kDistroImportBookmarksFromFilePref,
&str_value));
-
- int ping_delay = 90;
- EXPECT_FALSE(prefs.GetInt(
- installer::master_preferences::kDistroPingDelay, &ping_delay));
- EXPECT_EQ(ping_delay, 90);
}
TEST_F(MasterPreferencesTest, FirstRunTabs) {
@@ -323,34 +313,39 @@ TEST_F(MasterPreferencesTest, TestDefaultInstallConfig) {
installer::MasterPreferences pref_chrome(chrome_install);
}
-TEST_F(MasterPreferencesTest, EnforceLegacyCreateAllShortcutsFalse) {
- static const char kCreateAllShortcutsFalsePrefs[] =
+TEST_F(MasterPreferencesTest, EnforceLegacyPreferences) {
+ static const char kLegacyPrefs[] =
"{"
" \"distribution\": {"
- " \"create_all_shortcuts\": false"
+ " \"create_all_shortcuts\": false,\n"
+ " \"ping_delay\": 40\n"
" }"
"}";
- installer::MasterPreferences prefs(kCreateAllShortcutsFalsePrefs);
-
- bool do_not_create_desktop_shortcut = false;
- bool do_not_create_quick_launch_shortcut = false;
- bool do_not_create_taskbar_shortcut = false;
- prefs.GetBool(
- installer::master_preferences::kDoNotCreateDesktopShortcut,
- &do_not_create_desktop_shortcut);
- prefs.GetBool(
- installer::master_preferences::kDoNotCreateQuickLaunchShortcut,
- &do_not_create_quick_launch_shortcut);
- prefs.GetBool(
- installer::master_preferences::kDoNotCreateTaskbarShortcut,
- &do_not_create_taskbar_shortcut);
- // create_all_shortcuts is a legacy preference that should only enforce
- // do_not_create_desktop_shortcut and do_not_create_quick_launch_shortcut
- // when set to false.
- EXPECT_TRUE(do_not_create_desktop_shortcut);
- EXPECT_TRUE(do_not_create_quick_launch_shortcut);
- EXPECT_FALSE(do_not_create_taskbar_shortcut);
+ installer::MasterPreferences prefs(kLegacyPrefs);
+
+ bool do_not_create_desktop_shortcut = false;
+ bool do_not_create_quick_launch_shortcut = false;
+ bool do_not_create_taskbar_shortcut = false;
+ prefs.GetBool(installer::master_preferences::kDoNotCreateDesktopShortcut,
+ &do_not_create_desktop_shortcut);
+ prefs.GetBool(installer::master_preferences::kDoNotCreateQuickLaunchShortcut,
+ &do_not_create_quick_launch_shortcut);
+ prefs.GetBool(installer::master_preferences::kDoNotCreateTaskbarShortcut,
+ &do_not_create_taskbar_shortcut);
+ // create_all_shortcuts is a legacy preference that should only enforce
+ // do_not_create_desktop_shortcut and do_not_create_quick_launch_shortcut
+ // when set to false.
+ EXPECT_TRUE(do_not_create_desktop_shortcut);
+ EXPECT_TRUE(do_not_create_quick_launch_shortcut);
+ EXPECT_FALSE(do_not_create_taskbar_shortcut);
+
+#if BUILDFLAG(ENABLE_RLZ)
+ int rlz_ping_delay = 0;
+ EXPECT_TRUE(prefs.master_dictionary().GetInteger(prefs::kRlzPingDelaySeconds,
+ &rlz_ping_delay));
+ EXPECT_EQ(40, rlz_ping_delay);
+#endif // BUILDFLAG(ENABLE_RLZ)
}
TEST_F(MasterPreferencesTest, DontEnforceLegacyCreateAllShortcutsTrue) {
« no previous file with comments | « chrome/installer/util/master_preferences_constants.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698