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

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

Issue 1606943007: Implement Windows GPO support for "dlpref" in component updater. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: whitespace comments only Created 4 years, 11 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/google_update_settings.cc ('k') | components/component_updater/configurator_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/util/google_update_settings_unittest.cc
diff --git a/chrome/installer/util/google_update_settings_unittest.cc b/chrome/installer/util/google_update_settings_unittest.cc
index 6d411b62db6bd1e70e6c1ad1aab80b246843e5da..3b4cb2d25189628f16fd64c1cb41c89de2814e53 100644
--- a/chrome/installer/util/google_update_settings_unittest.cc
+++ b/chrome/installer/util/google_update_settings_unittest.cc
@@ -990,6 +990,58 @@ TEST_F(GoogleUpdateSettingsTest, ExperimentsLabelHelperUser) {
#endif // defined(GOOGLE_CHROME_BUILD)
+TEST_F(GoogleUpdateSettingsTest, GetDownloadPreference) {
+ RegKey policy_key;
+
+ if (policy_key.Open(HKEY_LOCAL_MACHINE, GoogleUpdateSettings::kPoliciesKey,
+ KEY_SET_VALUE) == ERROR_SUCCESS) {
+ policy_key.DeleteValue(
+ GoogleUpdateSettings::kDownloadPreferencePolicyValue);
+ }
+ policy_key.Close();
+
+ // When no policy is present expect to return an empty string.
+ EXPECT_TRUE(GoogleUpdateSettings::GetDownloadPreference().empty());
+
+ // Expect "cacheable" when the correct policy is present.
+ EXPECT_EQ(ERROR_SUCCESS, policy_key.Create(HKEY_LOCAL_MACHINE,
+ GoogleUpdateSettings::kPoliciesKey,
+ KEY_SET_VALUE));
+ EXPECT_EQ(
+ ERROR_SUCCESS,
+ policy_key.WriteValue(
+ GoogleUpdateSettings::kDownloadPreferencePolicyValue, L"cacheable"));
+ EXPECT_STREQ(L"cacheable",
+ GoogleUpdateSettings::GetDownloadPreference().c_str());
+
+ EXPECT_EQ(ERROR_SUCCESS,
+ policy_key.WriteValue(
+ GoogleUpdateSettings::kDownloadPreferencePolicyValue,
+ base::string16(32, L'a').c_str()));
+ EXPECT_STREQ(base::string16(32, L'a').c_str(),
+ GoogleUpdateSettings::GetDownloadPreference().c_str());
+
+ // Expect an empty string when an unsupported policy is set.
+ // It contains spaces.
+ EXPECT_EQ(ERROR_SUCCESS,
+ policy_key.WriteValue(
+ GoogleUpdateSettings::kDownloadPreferencePolicyValue, L"a b"));
+ EXPECT_TRUE(GoogleUpdateSettings::GetDownloadPreference().empty());
+
+ // It contains non alpha-numeric characters.
+ EXPECT_EQ(ERROR_SUCCESS,
+ policy_key.WriteValue(
+ GoogleUpdateSettings::kDownloadPreferencePolicyValue, L"<a>"));
+ EXPECT_TRUE(GoogleUpdateSettings::GetDownloadPreference().empty());
+
+ // It is too long.
+ EXPECT_EQ(ERROR_SUCCESS,
+ policy_key.WriteValue(
+ GoogleUpdateSettings::kDownloadPreferencePolicyValue,
+ base::string16(33, L'a').c_str()));
+ EXPECT_TRUE(GoogleUpdateSettings::GetDownloadPreference().empty());
+}
+
// Test GoogleUpdateSettings::GetUninstallCommandLine at system- or user-level,
// according to the param.
class GetUninstallCommandLine : public GoogleUpdateSettingsTest,
« no previous file with comments | « chrome/installer/util/google_update_settings.cc ('k') | components/component_updater/configurator_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698