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

Unified Diff: net/base/default_origin_bound_cert_store_unittest.cc

Issue 9617039: Change Origin bound certs -> Domain bound certs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: explanitory comment Created 8 years, 9 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: net/base/default_origin_bound_cert_store_unittest.cc
diff --git a/net/base/default_origin_bound_cert_store_unittest.cc b/net/base/default_origin_bound_cert_store_unittest.cc
index ec55716d08df1dc4214ea0f85463ff67d9fbeba2..16f9229f1d63b9073c8389148d7c8cea141a6873 100644
--- a/net/base/default_origin_bound_cert_store_unittest.cc
+++ b/net/base/default_origin_bound_cert_store_unittest.cc
@@ -58,12 +58,12 @@ bool MockPersistentStore::Load(
void MockPersistentStore::AddOriginBoundCert(
const DefaultOriginBoundCertStore::OriginBoundCert& cert) {
- origin_certs_[cert.origin()] = cert;
+ origin_certs_[cert.domain()] = cert;
}
void MockPersistentStore::DeleteOriginBoundCert(
const DefaultOriginBoundCertStore::OriginBoundCert& cert) {
- origin_certs_.erase(cert.origin());
+ origin_certs_.erase(cert.domain());
}
void MockPersistentStore::SetClearLocalStateOnExit(bool clear_local_state) {}
@@ -77,14 +77,14 @@ TEST(DefaultOriginBoundCertStoreTest, TestLoading) {
persistent_store->AddOriginBoundCert(
DefaultOriginBoundCertStore::OriginBoundCert(
- "https://encrypted.google.com/",
+ "google.com",
CLIENT_CERT_RSA_SIGN,
base::Time(),
base::Time(),
"a", "b"));
persistent_store->AddOriginBoundCert(
DefaultOriginBoundCertStore::OriginBoundCert(
- "https://www.verisign.com/",
+ "verisign.com",
CLIENT_CERT_ECDSA_SIGN,
base::Time(),
base::Time(),
@@ -94,14 +94,14 @@ TEST(DefaultOriginBoundCertStoreTest, TestLoading) {
DefaultOriginBoundCertStore store(persistent_store.get());
EXPECT_EQ(2, store.GetCertCount());
store.SetOriginBoundCert(
- "https://www.verisign.com/",
+ "verisign.com",
CLIENT_CERT_RSA_SIGN,
base::Time(),
base::Time(),
"e", "f");
EXPECT_EQ(2, store.GetCertCount());
store.SetOriginBoundCert(
- "https://www.twitter.com/",
+ "twitter.com",
CLIENT_CERT_RSA_SIGN,
base::Time(),
base::Time(),
@@ -116,7 +116,7 @@ TEST(DefaultOriginBoundCertStoreTest, TestSettingAndGetting) {
base::Time expiration_time;
std::string private_key, cert;
EXPECT_EQ(0, store.GetCertCount());
- EXPECT_FALSE(store.GetOriginBoundCert("https://www.verisign.com/",
+ EXPECT_FALSE(store.GetOriginBoundCert("verisign.com",
&type,
&creation_time,
&expiration_time,
@@ -125,12 +125,12 @@ TEST(DefaultOriginBoundCertStoreTest, TestSettingAndGetting) {
EXPECT_TRUE(private_key.empty());
EXPECT_TRUE(cert.empty());
store.SetOriginBoundCert(
- "https://www.verisign.com/",
+ "verisign.com",
CLIENT_CERT_RSA_SIGN,
base::Time::FromInternalValue(123),
base::Time::FromInternalValue(456),
"i", "j");
- EXPECT_TRUE(store.GetOriginBoundCert("https://www.verisign.com/",
+ EXPECT_TRUE(store.GetOriginBoundCert("verisign.com",
&type,
&creation_time,
&expiration_time,
@@ -153,20 +153,20 @@ TEST(DefaultOriginBoundCertStoreTest, TestDuplicateCerts) {
std::string private_key, cert;
EXPECT_EQ(0, store.GetCertCount());
store.SetOriginBoundCert(
- "https://www.verisign.com/",
+ "verisign.com",
CLIENT_CERT_RSA_SIGN,
base::Time::FromInternalValue(123),
base::Time::FromInternalValue(1234),
"a", "b");
store.SetOriginBoundCert(
- "https://www.verisign.com/",
+ "verisign.com",
CLIENT_CERT_ECDSA_SIGN,
base::Time::FromInternalValue(456),
base::Time::FromInternalValue(4567),
"c", "d");
EXPECT_EQ(1, store.GetCertCount());
- EXPECT_TRUE(store.GetOriginBoundCert("https://www.verisign.com/",
+ EXPECT_TRUE(store.GetOriginBoundCert("verisign.com",
&type,
&creation_time,
&expiration_time,
@@ -185,19 +185,19 @@ TEST(DefaultOriginBoundCertStoreTest, TestDeleteAll) {
EXPECT_EQ(0, store.GetCertCount());
store.SetOriginBoundCert(
- "https://www.verisign.com/",
+ "verisign.com",
CLIENT_CERT_RSA_SIGN,
base::Time(),
base::Time(),
"a", "b");
store.SetOriginBoundCert(
- "https://www.google.com/",
+ "google.com",
CLIENT_CERT_RSA_SIGN,
base::Time(),
base::Time(),
"c", "d");
store.SetOriginBoundCert(
- "https://www.harvard.com/",
+ "harvard.com",
CLIENT_CERT_RSA_SIGN,
base::Time(),
base::Time(),
@@ -218,36 +218,36 @@ TEST(DefaultOriginBoundCertStoreTest, TestDelete) {
std::string private_key, cert;
EXPECT_EQ(0, store.GetCertCount());
store.SetOriginBoundCert(
- "https://www.verisign.com/",
+ "verisign.com",
CLIENT_CERT_RSA_SIGN,
base::Time(),
base::Time(),
"a", "b");
store.SetOriginBoundCert(
- "https://www.google.com/",
+ "google.com",
CLIENT_CERT_ECDSA_SIGN,
base::Time(),
base::Time(),
"c", "d");
EXPECT_EQ(2, store.GetCertCount());
- store.DeleteOriginBoundCert("https://www.verisign.com/");
+ store.DeleteOriginBoundCert("verisign.com");
EXPECT_EQ(1, store.GetCertCount());
- EXPECT_FALSE(store.GetOriginBoundCert("https://www.verisign.com/",
+ EXPECT_FALSE(store.GetOriginBoundCert("verisign.com",
&type,
&creation_time,
&expiration_time,
&private_key,
&cert));
- EXPECT_TRUE(store.GetOriginBoundCert("https://www.google.com/",
+ EXPECT_TRUE(store.GetOriginBoundCert("google.com",
&type,
&creation_time,
&expiration_time,
&private_key,
&cert));
- store.DeleteOriginBoundCert("https://www.google.com/");
+ store.DeleteOriginBoundCert("google.com");
EXPECT_EQ(0, store.GetCertCount());
- EXPECT_FALSE(store.GetOriginBoundCert("https://www.google.com/",
+ EXPECT_FALSE(store.GetOriginBoundCert("google.com",
&type,
&creation_time,
&expiration_time,
@@ -261,25 +261,25 @@ TEST(DefaultOriginBoundCertStoreTest, TestGetAll) {
EXPECT_EQ(0, store.GetCertCount());
store.SetOriginBoundCert(
- "https://www.verisign.com/",
+ "verisign.com",
CLIENT_CERT_RSA_SIGN,
base::Time(),
base::Time(),
"a", "b");
store.SetOriginBoundCert(
- "https://www.google.com/",
+ "google.com",
CLIENT_CERT_ECDSA_SIGN,
base::Time(),
base::Time(),
"c", "d");
store.SetOriginBoundCert(
- "https://www.harvard.com/",
+ "harvard.com",
CLIENT_CERT_RSA_SIGN,
base::Time(),
base::Time(),
"e", "f");
store.SetOriginBoundCert(
- "https://www.mit.com/",
+ "mit.com",
CLIENT_CERT_RSA_SIGN,
base::Time(),
base::Time(),

Powered by Google App Engine
This is Rietveld 408576698