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

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

Issue 7828022: Add a method to the HostContentSettings map to return the |Value| of a content setting (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments addressed & Removed default auto select cert setting. 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 89ecacde2ee46f46b7d2108390167a66f9455fbe..cc39ea274e815d94e8724fc309d8565ca785eb8a 100644
--- a/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc
+++ b/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc
@@ -8,6 +8,7 @@
#include "base/auto_reset.h"
#include "base/command_line.h"
+#include "base/memory/scoped_ptr.h"
#include "chrome/browser/content_settings/content_settings_mock_observer.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/chrome_switches.h"
@@ -255,8 +256,8 @@ TEST_F(PolicyProviderTest, AutoSelectCertificateList) {
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(
+ EXPECT_EQ(NULL,
+ provider.GetContentSettingValue(
google_url,
google_url,
CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE,
@@ -265,23 +266,30 @@ TEST_F(PolicyProviderTest, AutoSelectCertificateList) {
// Set the content settings pattern list for origins to auto select
// certificates.
ListValue* value = new ListValue();
- value->Append(Value::CreateStringValue("[*.]google.com"));
+ value->Append(Value::CreateStringValue(
+ "[*.]google.com|{\"ISSUER\":{\"CN\":\"issuer name\"}}"));
prefs->SetManagedPref(prefs::kManagedAutoSelectCertificateForUrls,
value);
GURL youtube_url("https://www.youtube.com");
- EXPECT_EQ(CONTENT_SETTING_DEFAULT,
- provider.GetContentSetting(
+ EXPECT_EQ(NULL,
+ provider.GetContentSettingValue(
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()));
-
+ scoped_ptr<Value> cert_filter(provider.GetContentSettingValue(
+ google_url,
+ google_url,
+ CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE,
+ std::string()));
+
+ ASSERT_EQ(Value::TYPE_DICTIONARY, cert_filter->GetType());
+ DictionaryValue* dict_value =
+ static_cast<DictionaryValue*>(cert_filter.get());
+ std::string actual_common_name;
+ ASSERT_TRUE(dict_value->GetString("ISSUER.CN", &actual_common_name));
+ EXPECT_EQ("issuer name", actual_common_name);
provider.ShutdownOnUIThread();
}
+
} // namespace content_settings

Powered by Google App Engine
This is Rietveld 408576698