Chromium Code Reviews| Index: chrome/browser/browsing_data/browsing_data_remover_unittest.cc |
| diff --git a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc |
| index c4de8ee4cf92a2a225ffc7964d6c193b11753ff3..61cc2637a6cc2f0d3f96397b7eb6b5b3908350c7 100644 |
| --- a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc |
| +++ b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc |
| @@ -56,8 +56,8 @@ |
| #include "content/public/test/test_browser_thread_bundle.h" |
| #include "content/public/test/test_utils.h" |
| #include "net/cookies/cookie_store.h" |
| -#include "net/ssl/server_bound_cert_service.h" |
| -#include "net/ssl/server_bound_cert_store.h" |
| +#include "net/ssl/channel_id_service.h" |
| +#include "net/ssl/channel_id_store.h" |
| #include "net/ssl/ssl_client_cert_type.h" |
| #include "net/url_request/url_request_context.h" |
| #include "net/url_request/url_request_context_getter.h" |
| @@ -298,30 +298,30 @@ class RemoveSafeBrowsingCookieTester : public RemoveCookieTester { |
| }; |
| #endif |
| -class RemoveServerBoundCertTester : public net::SSLConfigService::Observer { |
| +class RemoveChannelIDTester : public net::SSLConfigService::Observer { |
| public: |
| - explicit RemoveServerBoundCertTester(TestingProfile* profile) |
| + explicit RemoveChannelIDTester(TestingProfile* profile) |
| : ssl_config_changed_count_(0) { |
| - server_bound_cert_service_ = profile->GetRequestContext()-> |
| - GetURLRequestContext()->server_bound_cert_service(); |
| + channel_id_service_ = profile->GetRequestContext()-> |
| + GetURLRequestContext()->channel_id_service(); |
| ssl_config_service_ = profile->GetSSLConfigService(); |
| ssl_config_service_->AddObserver(this); |
| } |
| - virtual ~RemoveServerBoundCertTester() { |
| + virtual ~RemoveChannelIDTester() { |
| ssl_config_service_->RemoveObserver(this); |
| } |
| - int ServerBoundCertCount() { |
| - return server_bound_cert_service_->cert_count(); |
| + int ChannelIDCount() { |
| + return channel_id_service_->cert_count(); |
| } |
| // Add a server bound cert for |server| with specific creation and expiry |
| // times. The cert and key data will be filled with dummy values. |
| - void AddServerBoundCertWithTimes(const std::string& server_identifier, |
| + void AddChannelIDWithTimes(const std::string& server_identifier, |
| base::Time creation_time, |
| base::Time expiration_time) { |
| - GetCertStore()->SetServerBoundCert(server_identifier, |
| + GetCertStore()->SetChannelID(server_identifier, |
| creation_time, |
| expiration_time, |
| "a", |
| @@ -330,20 +330,20 @@ class RemoveServerBoundCertTester : public net::SSLConfigService::Observer { |
| // Add a server bound cert for |server|, with the current time as the |
| // creation time. The cert and key data will be filled with dummy values. |
| - void AddServerBoundCert(const std::string& server_identifier) { |
| + void AddChannelID(const std::string& server_identifier) { |
| base::Time now = base::Time::Now(); |
| - AddServerBoundCertWithTimes(server_identifier, |
| + AddChannelIDWithTimes(server_identifier, |
| now, |
| now + base::TimeDelta::FromDays(1)); |
| } |
| - void GetCertList(net::ServerBoundCertStore::ServerBoundCertList* certs) { |
| - GetCertStore()->GetAllServerBoundCerts( |
| - base::Bind(&RemoveServerBoundCertTester::GetAllCertsCallback, certs)); |
| + void GetCertList(net::ChannelIDStore::ChannelIDList* certs) { |
|
wtc
2014/07/01 19:50:48
GetCertList => GetChannelIDList
certs => channel_
Ryan Hamilton
2014/07/21 19:12:04
Done.
|
| + GetCertStore()->GetAllChannelIDs( |
| + base::Bind(&RemoveChannelIDTester::GetAllCertsCallback, certs)); |
| } |
| - net::ServerBoundCertStore* GetCertStore() { |
| - return server_bound_cert_service_->GetCertStore(); |
| + net::ChannelIDStore* GetCertStore() { |
|
wtc
2014/07/01 19:50:48
GetCertStore => GetChannelIDStore
Ryan Hamilton
2014/07/21 19:12:04
Done.
|
| + return channel_id_service_->GetCertStore(); |
| } |
| int ssl_config_changed_count() const { |
| @@ -357,16 +357,16 @@ class RemoveServerBoundCertTester : public net::SSLConfigService::Observer { |
| private: |
| static void GetAllCertsCallback( |
|
wtc
2014/07/01 19:50:48
GetAllCertsCallback => GetAllChannelIDsCallback
Ryan Hamilton
2014/07/21 19:12:04
Done.
|
| - net::ServerBoundCertStore::ServerBoundCertList* dest, |
| - const net::ServerBoundCertStore::ServerBoundCertList& result) { |
| + net::ChannelIDStore::ChannelIDList* dest, |
| + const net::ChannelIDStore::ChannelIDList& result) { |
| *dest = result; |
| } |
| - net::ServerBoundCertService* server_bound_cert_service_; |
| + net::ChannelIDService* channel_id_service_; |
| scoped_refptr<net::SSLConfigService> ssl_config_service_; |
| int ssl_config_changed_count_; |
| - DISALLOW_COPY_AND_ASSIGN(RemoveServerBoundCertTester); |
| + DISALLOW_COPY_AND_ASSIGN(RemoveChannelIDTester); |
| }; |
| class RemoveHistoryTester { |
| @@ -885,41 +885,41 @@ TEST_F(BrowsingDataRemoverTest, RemoveSafeBrowsingCookieLastHour) { |
| } |
| #endif |
| -TEST_F(BrowsingDataRemoverTest, RemoveServerBoundCertForever) { |
| - RemoveServerBoundCertTester tester(GetProfile()); |
| +TEST_F(BrowsingDataRemoverTest, RemoveChannelIDForever) { |
| + RemoveChannelIDTester tester(GetProfile()); |
| - tester.AddServerBoundCert(kTestOrigin1); |
| + tester.AddChannelID(kTestOrigin1); |
| EXPECT_EQ(0, tester.ssl_config_changed_count()); |
| - EXPECT_EQ(1, tester.ServerBoundCertCount()); |
| + EXPECT_EQ(1, tester.ChannelIDCount()); |
| BlockUntilBrowsingDataRemoved(BrowsingDataRemover::EVERYTHING, |
| - BrowsingDataRemover::REMOVE_SERVER_BOUND_CERTS, false); |
| + BrowsingDataRemover::REMOVE_CHANNEL_IDS, false); |
| - EXPECT_EQ(BrowsingDataRemover::REMOVE_SERVER_BOUND_CERTS, GetRemovalMask()); |
| + EXPECT_EQ(BrowsingDataRemover::REMOVE_CHANNEL_IDS, GetRemovalMask()); |
| EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask()); |
| EXPECT_EQ(1, tester.ssl_config_changed_count()); |
| - EXPECT_EQ(0, tester.ServerBoundCertCount()); |
| + EXPECT_EQ(0, tester.ChannelIDCount()); |
| } |
| -TEST_F(BrowsingDataRemoverTest, RemoveServerBoundCertLastHour) { |
| - RemoveServerBoundCertTester tester(GetProfile()); |
| +TEST_F(BrowsingDataRemoverTest, RemoveChannelIDLastHour) { |
| + RemoveChannelIDTester tester(GetProfile()); |
| base::Time now = base::Time::Now(); |
| - tester.AddServerBoundCert(kTestOrigin1); |
| - tester.AddServerBoundCertWithTimes(kTestOrigin2, |
| + tester.AddChannelID(kTestOrigin1); |
| + tester.AddChannelIDWithTimes(kTestOrigin2, |
| now - base::TimeDelta::FromHours(2), |
| now); |
| EXPECT_EQ(0, tester.ssl_config_changed_count()); |
| - EXPECT_EQ(2, tester.ServerBoundCertCount()); |
| + EXPECT_EQ(2, tester.ChannelIDCount()); |
| BlockUntilBrowsingDataRemoved(BrowsingDataRemover::LAST_HOUR, |
| - BrowsingDataRemover::REMOVE_SERVER_BOUND_CERTS, false); |
| + BrowsingDataRemover::REMOVE_CHANNEL_IDS, false); |
| - EXPECT_EQ(BrowsingDataRemover::REMOVE_SERVER_BOUND_CERTS, GetRemovalMask()); |
| + EXPECT_EQ(BrowsingDataRemover::REMOVE_CHANNEL_IDS, GetRemovalMask()); |
| EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask()); |
| EXPECT_EQ(1, tester.ssl_config_changed_count()); |
| - ASSERT_EQ(1, tester.ServerBoundCertCount()); |
| - net::ServerBoundCertStore::ServerBoundCertList certs; |
| + ASSERT_EQ(1, tester.ChannelIDCount()); |
| + net::ChannelIDStore::ChannelIDList certs; |
| tester.GetCertList(&certs); |
| ASSERT_EQ(1U, certs.size()); |
| EXPECT_EQ(kTestOrigin2, certs.front().server_identifier()); |