summaryrefslogtreecommitdiffstats
path: root/chrome_frame/test/policy_settings_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome_frame/test/policy_settings_unittest.cc')
-rw-r--r--chrome_frame/test/policy_settings_unittest.cc35
1 files changed, 35 insertions, 0 deletions
diff --git a/chrome_frame/test/policy_settings_unittest.cc b/chrome_frame/test/policy_settings_unittest.cc
index 52a3c55..55a0b32 100644
--- a/chrome_frame/test/policy_settings_unittest.cc
+++ b/chrome_frame/test/policy_settings_unittest.cc
@@ -25,6 +25,7 @@ void DeleteChromeFramePolicyEntries(HKEY root) {
key.DeleteKey(ASCIIToWide(policy::key::kRenderInChromeFrameList).c_str());
key.DeleteKey(ASCIIToWide(policy::key::kRenderInHostList).c_str());
key.DeleteKey(ASCIIToWide(policy::key::kChromeFrameContentTypes).c_str());
+ key.DeleteKey(ASCIIToWide(policy::key::kApplicationLocaleValue).c_str());
}
}
@@ -118,6 +119,17 @@ bool SetCFContentTypes(HKEY policy_root, const wchar_t* content_types[],
return true;
}
+bool SetChromeApplicationLocale(HKEY policy_root, const wchar_t* locale) {
+ RegKey policy_key;
+ if (!InitializePolicyKey(policy_root, &policy_key))
+ return false;
+
+ std::wstring application_locale_value(
+ ASCIIToWide(policy::key::kApplicationLocaleValue));
+ EXPECT_TRUE(policy_key.WriteValue(application_locale_value.c_str(), locale));
+ return true;
+}
+
} // end namespace
TEST(PolicySettings, RendererForUrl) {
@@ -215,3 +227,26 @@ TEST(PolicySettings, RendererForContentType) {
}
}
+TEST(PolicySettings, ApplicationLocale) {
+ TempRegKeyOverride::DeleteAllTempKeys();
+
+ scoped_ptr<TempRegKeyOverride> hklm_pol(
+ new TempRegKeyOverride(HKEY_LOCAL_MACHINE, L"hklm_pol"));
+ scoped_ptr<TempRegKeyOverride> hkcu_pol(
+ new TempRegKeyOverride(HKEY_CURRENT_USER, L"hkcu_pol"));
+
+ scoped_ptr<PolicySettings> settings(new PolicySettings());
+ EXPECT_TRUE(settings->ApplicationLocale().empty());
+
+ static const wchar_t kTestApplicationLocale[] = L"fr-CA";
+
+ HKEY root[] = { HKEY_LOCAL_MACHINE, HKEY_CURRENT_USER };
+ for (int i = 0; i < arraysize(root); ++i) {
+ SetChromeApplicationLocale(root[i], kTestApplicationLocale);
+ settings.reset(new PolicySettings());
+ EXPECT_EQ(std::wstring(kTestApplicationLocale),
+ settings->ApplicationLocale());
+
+ DeleteChromeFramePolicyEntries(root[i]);
+ }
+}