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

Unified Diff: chrome/browser/content_settings/content_settings_policy_provider_unittest.cc

Issue 7537025: Add new Content settings type AUTO-SUBMIT-CERTIFICATE (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 years, 4 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/content_settings/content_settings_policy_provider_unittest.cc
diff --git a/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc b/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc
index 3e4ff2e5d2ed234ef2653dfc314f8d9aea879d2e..9a24e951c48c9db81beb2461fa294ef0b36d7407 100644
--- a/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc
+++ b/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/content_settings/content_settings_policy_provider.h"
+#include <string>
+
#include "base/auto_reset.h"
#include "base/command_line.h"
#include "chrome/browser/content_settings/content_settings_mock_observer.h"
@@ -127,6 +129,18 @@ TEST_F(PolicyDefaultProviderTest, ObserveManagedSettingsChange) {
provider.ShutdownOnUIThread();
}
+TEST_F(PolicyDefaultProviderTest, AutoSelectCertificate) {
+ TestingProfile profile;
+ TestingPrefService* prefs = profile.GetTestingPrefService();
+ PolicyDefaultProvider provider(prefs);
+
+ EXPECT_EQ(CONTENT_SETTING_ASK,
+ provider.ProvideDefaultSetting(
+ CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE));
+
+ provider.ShutdownOnUIThread();
+}
+
class PolicyProviderTest : public TestingBrowserProcessTest {
public:
PolicyProviderTest()
@@ -223,4 +237,40 @@ TEST_F(PolicyProviderTest, ResourceIdentifier) {
provider.ShutdownOnUIThread();
}
+TEST_F(PolicyProviderTest, AutoSelectCertificateList) {
+ TestingProfile profile;
+ TestingPrefService* prefs = profile.GetTestingPrefService();
+
+ PolicyProvider provider(prefs, NULL);
+ GURL google_url("https://mail.google.com");
+ // Tests the default setting for auto selecting certificates
+ EXPECT_EQ(CONTENT_SETTING_DEFAULT,
+ provider.GetContentSetting(
+ google_url,
+ google_url,
+ CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE,
+ std::string()));
+
+ // Set the content settings pattern list for origins to auto select
+ // certificates.
+ ListValue* value = new ListValue();
+ value->Append(Value::CreateStringValue("[*.]google.com"));
+ prefs->SetManagedPref(prefs::kManagedAutoSelectCertificateForUrls,
+ value);
+ GURL youtube_url("https://www.youtube.com");
+ EXPECT_EQ(CONTENT_SETTING_DEFAULT,
+ provider.GetContentSetting(
+ youtube_url,
+ youtube_url,
+ CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE,
+ std::string()));
+ EXPECT_EQ(CONTENT_SETTING_ALLOW,
+ provider.GetContentSetting(
+ google_url,
+ google_url,
+ CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE,
+ std::string()));
+
+ provider.ShutdownOnUIThread();
+}
} // namespace content_settings

Powered by Google App Engine
This is Rietveld 408576698