| 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 224c86bdfa7c48935d796f2945a5d9184d859f04..685f695f6d68f7797f1f2ff98bc7ade286181d5a 100644
|
| --- a/net/base/default_origin_bound_cert_store_unittest.cc
|
| +++ b/net/base/default_origin_bound_cert_store_unittest.cc
|
| @@ -76,33 +76,40 @@ TEST(DefaultOriginBoundCertStoreTest, TestLoading) {
|
|
|
| persistent_store->AddOriginBoundCert(
|
| DefaultOriginBoundCertStore::OriginBoundCert(
|
| - "https://encrypted.google.com/", "a", "b"));
|
| + "https://encrypted.google.com/", ORIGIN_BOUND_RSA_CERT, "a", "b"));
|
| persistent_store->AddOriginBoundCert(
|
| DefaultOriginBoundCertStore::OriginBoundCert(
|
| - "https://www.verisign.com/", "c", "d"));
|
| + "https://www.verisign.com/", ORIGIN_BOUND_EC_CERT, "c", "d"));
|
|
|
| // Make sure certs load properly.
|
| DefaultOriginBoundCertStore store(persistent_store.get());
|
| EXPECT_EQ(2, store.GetCertCount());
|
| - store.SetOriginBoundCert("https://www.verisign.com/", "e", "f");
|
| + store.SetOriginBoundCert(
|
| + "https://www.verisign.com/", ORIGIN_BOUND_RSA_CERT, "e", "f");
|
| EXPECT_EQ(2, store.GetCertCount());
|
| - store.SetOriginBoundCert("https://www.twitter.com/", "g", "h");
|
| + store.SetOriginBoundCert(
|
| + "https://www.twitter.com/", ORIGIN_BOUND_RSA_CERT, "g", "h");
|
| EXPECT_EQ(3, store.GetCertCount());
|
| }
|
|
|
| TEST(DefaultOriginBoundCertStoreTest, TestSettingAndGetting) {
|
| DefaultOriginBoundCertStore store(NULL);
|
| + OriginBoundCertType type;
|
| std::string private_key, cert;
|
| EXPECT_EQ(0, store.GetCertCount());
|
| EXPECT_FALSE(store.GetOriginBoundCert("https://www.verisign.com/",
|
| - &private_key,
|
| - &cert));
|
| + &type,
|
| + &private_key,
|
| + &cert));
|
| EXPECT_TRUE(private_key.empty());
|
| EXPECT_TRUE(cert.empty());
|
| - store.SetOriginBoundCert("https://www.verisign.com/", "i", "j");
|
| + store.SetOriginBoundCert(
|
| + "https://www.verisign.com/", ORIGIN_BOUND_RSA_CERT, "i", "j");
|
| EXPECT_TRUE(store.GetOriginBoundCert("https://www.verisign.com/",
|
| - &private_key,
|
| - &cert));
|
| + &type,
|
| + &private_key,
|
| + &cert));
|
| + EXPECT_EQ(ORIGIN_BOUND_RSA_CERT, type);
|
| EXPECT_EQ("i", private_key);
|
| EXPECT_EQ("j", cert);
|
| }
|
| @@ -111,15 +118,20 @@ TEST(DefaultOriginBoundCertStoreTest, TestDuplicateCerts) {
|
| scoped_refptr<MockPersistentStore> persistent_store(new MockPersistentStore);
|
| DefaultOriginBoundCertStore store(persistent_store.get());
|
|
|
| + OriginBoundCertType type;
|
| std::string private_key, cert;
|
| EXPECT_EQ(0, store.GetCertCount());
|
| - store.SetOriginBoundCert("https://www.verisign.com/", "a", "b");
|
| - store.SetOriginBoundCert("https://www.verisign.com/", "c", "d");
|
| + store.SetOriginBoundCert(
|
| + "https://www.verisign.com/", ORIGIN_BOUND_RSA_CERT, "a", "b");
|
| + store.SetOriginBoundCert(
|
| + "https://www.verisign.com/", ORIGIN_BOUND_EC_CERT, "c", "d");
|
|
|
| EXPECT_EQ(1, store.GetCertCount());
|
| EXPECT_TRUE(store.GetOriginBoundCert("https://www.verisign.com/",
|
| - &private_key,
|
| - &cert));
|
| + &type,
|
| + &private_key,
|
| + &cert));
|
| + EXPECT_EQ(ORIGIN_BOUND_EC_CERT, type);
|
| EXPECT_EQ("c", private_key);
|
| EXPECT_EQ("d", cert);
|
| }
|
| @@ -129,9 +141,12 @@ TEST(DefaultOriginBoundCertStoreTest, TestDeleteAll) {
|
| DefaultOriginBoundCertStore store(persistent_store.get());
|
|
|
| EXPECT_EQ(0, store.GetCertCount());
|
| - store.SetOriginBoundCert("https://www.verisign.com/", "a", "b");
|
| - store.SetOriginBoundCert("https://www.google.com/", "c", "d");
|
| - store.SetOriginBoundCert("https://www.harvard.com/", "e", "f");
|
| + store.SetOriginBoundCert(
|
| + "https://www.verisign.com/", ORIGIN_BOUND_RSA_CERT, "a", "b");
|
| + store.SetOriginBoundCert(
|
| + "https://www.google.com/", ORIGIN_BOUND_RSA_CERT, "c", "d");
|
| + store.SetOriginBoundCert(
|
| + "https://www.harvard.com/", ORIGIN_BOUND_RSA_CERT, "e", "f");
|
|
|
| EXPECT_EQ(3, store.GetCertCount());
|
| store.DeleteAll();
|
| @@ -142,25 +157,31 @@ TEST(DefaultOriginBoundCertStoreTest, TestDelete) {
|
| scoped_refptr<MockPersistentStore> persistent_store(new MockPersistentStore);
|
| DefaultOriginBoundCertStore store(persistent_store.get());
|
|
|
| + OriginBoundCertType type;
|
| std::string private_key, cert;
|
| EXPECT_EQ(0, store.GetCertCount());
|
| - store.SetOriginBoundCert("https://www.verisign.com/", "a", "b");
|
| - store.SetOriginBoundCert("https://www.google.com/", "c", "d");
|
| + store.SetOriginBoundCert(
|
| + "https://www.verisign.com/", ORIGIN_BOUND_RSA_CERT, "a", "b");
|
| + store.SetOriginBoundCert(
|
| + "https://www.google.com/", ORIGIN_BOUND_EC_CERT, "c", "d");
|
|
|
| EXPECT_EQ(2, store.GetCertCount());
|
| store.DeleteOriginBoundCert("https://www.verisign.com/");
|
| EXPECT_EQ(1, store.GetCertCount());
|
| EXPECT_FALSE(store.GetOriginBoundCert("https://www.verisign.com/",
|
| - &private_key,
|
| - &cert));
|
| - EXPECT_TRUE(store.GetOriginBoundCert("https://www.google.com/",
|
| + &type,
|
| &private_key,
|
| &cert));
|
| + EXPECT_TRUE(store.GetOriginBoundCert("https://www.google.com/",
|
| + &type,
|
| + &private_key,
|
| + &cert));
|
| store.DeleteOriginBoundCert("https://www.google.com/");
|
| EXPECT_EQ(0, store.GetCertCount());
|
| EXPECT_FALSE(store.GetOriginBoundCert("https://www.google.com/",
|
| - &private_key,
|
| - &cert));
|
| + &type,
|
| + &private_key,
|
| + &cert));
|
| }
|
|
|
| TEST(DefaultOriginBoundCertStoreTest, TestGetAll) {
|
| @@ -168,10 +189,14 @@ TEST(DefaultOriginBoundCertStoreTest, TestGetAll) {
|
| DefaultOriginBoundCertStore store(persistent_store.get());
|
|
|
| EXPECT_EQ(0, store.GetCertCount());
|
| - store.SetOriginBoundCert("https://www.verisign.com/", "a", "b");
|
| - store.SetOriginBoundCert("https://www.google.com/", "c", "d");
|
| - store.SetOriginBoundCert("https://www.harvard.com/", "e", "f");
|
| - store.SetOriginBoundCert("https://www.mit.com/", "g", "h");
|
| + store.SetOriginBoundCert(
|
| + "https://www.verisign.com/", ORIGIN_BOUND_RSA_CERT, "a", "b");
|
| + store.SetOriginBoundCert(
|
| + "https://www.google.com/", ORIGIN_BOUND_EC_CERT, "c", "d");
|
| + store.SetOriginBoundCert(
|
| + "https://www.harvard.com/", ORIGIN_BOUND_RSA_CERT, "e", "f");
|
| + store.SetOriginBoundCert(
|
| + "https://www.mit.com/", ORIGIN_BOUND_RSA_CERT, "g", "h");
|
|
|
| EXPECT_EQ(4, store.GetCertCount());
|
| std::vector<OriginBoundCertStore::OriginBoundCertInfo> certs;
|
|
|