Chromium Code Reviews| Index: chrome/browser/browsing_data/browsing_data_channel_id_helper_unittest.cc |
| diff --git a/chrome/browser/browsing_data/browsing_data_server_bound_cert_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_channel_id_helper_unittest.cc |
| similarity index 52% |
| rename from chrome/browser/browsing_data/browsing_data_server_bound_cert_helper_unittest.cc |
| rename to chrome/browser/browsing_data/browsing_data_channel_id_helper_unittest.cc |
| index a95405e3627d7ca169c23356eec679961fb07a09..6aa8ba4bc3b5accd8daf93dea869ae8f265f6418 100644 |
| --- a/chrome/browser/browsing_data/browsing_data_server_bound_cert_helper_unittest.cc |
| +++ b/chrome/browser/browsing_data/browsing_data_channel_id_helper_unittest.cc |
| @@ -2,25 +2,25 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include "chrome/browser/browsing_data/browsing_data_server_bound_cert_helper.h" |
| +#include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h" |
| #include "base/bind.h" |
| #include "base/run_loop.h" |
| #include "chrome/test/base/testing_profile.h" |
| #include "content/public/browser/browser_thread.h" |
| #include "content/public/test/test_browser_thread_bundle.h" |
| -#include "net/ssl/server_bound_cert_service.h" |
| +#include "net/ssl/channel_id_service.h" |
| #include "net/url_request/url_request_context.h" |
| #include "net/url_request/url_request_context_getter.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| using content::BrowserThread; |
| -class BrowsingDataServerBoundCertHelperTest |
| +class BrowsingDataChannelIDHelperTest |
| : public testing::Test, |
| public net::SSLConfigService::Observer { |
| public: |
| - BrowsingDataServerBoundCertHelperTest() : ssl_config_changed_count_(0) { |
| + BrowsingDataChannelIDHelperTest() : ssl_config_changed_count_(0) { |
| } |
| virtual void SetUp() OVERRIDE { |
| @@ -36,20 +36,20 @@ class BrowsingDataServerBoundCertHelperTest |
| void CreateCertsForTest() { |
|
wtc
2014/07/01 19:50:48
CreateCertsForTest => CreateChannelIDsForTest
Ryan Hamilton
2014/07/21 19:12:03
Done.
|
| net::URLRequestContext* context = |
| testing_profile_->GetRequestContext()->GetURLRequestContext(); |
| - net::ServerBoundCertStore* cert_store = |
| - context->server_bound_cert_service()->GetCertStore(); |
| - cert_store->SetServerBoundCert("https://www.google.com:443", |
| + net::ChannelIDStore* cert_store = |
|
wtc
2014/07/01 19:50:48
cert_store => channel_id_store
Ryan Hamilton
2014/07/21 19:12:03
Done.
|
| + context->channel_id_service()->GetCertStore(); |
| + cert_store->SetChannelID("https://www.google.com:443", |
| base::Time(), base::Time(), |
| "key", "cert"); |
| - cert_store->SetServerBoundCert("https://www.youtube.com:443", |
| + cert_store->SetChannelID("https://www.youtube.com:443", |
| base::Time(), base::Time(), |
| "key", "cert"); |
|
wtc
2014/07/01 19:50:48
Fix the indentation of these two SetChannelID call
Ryan Hamilton
2014/07/21 19:12:03
Done.
|
| } |
| void FetchCallback( |
| - const net::ServerBoundCertStore::ServerBoundCertList& certs) { |
| + const net::ChannelIDStore::ChannelIDList& certs) { |
|
wtc
2014/07/01 19:50:48
certs => channel_ids
Ryan Hamilton
2014/07/21 19:12:03
Done.
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| - server_bound_cert_list_ = certs; |
| + channel_id_list_ = certs; |
| } |
| // net::SSLConfigService::Observer implementation: |
| @@ -61,82 +61,82 @@ class BrowsingDataServerBoundCertHelperTest |
| content::TestBrowserThreadBundle thread_bundle_; |
| scoped_ptr<TestingProfile> testing_profile_; |
| - net::ServerBoundCertStore::ServerBoundCertList server_bound_cert_list_; |
| + net::ChannelIDStore::ChannelIDList channel_id_list_; |
| int ssl_config_changed_count_; |
| }; |
| -TEST_F(BrowsingDataServerBoundCertHelperTest, FetchData) { |
| +TEST_F(BrowsingDataChannelIDHelperTest, FetchData) { |
| CreateCertsForTest(); |
| - scoped_refptr<BrowsingDataServerBoundCertHelper> helper( |
| - BrowsingDataServerBoundCertHelper::Create(testing_profile_.get())); |
| + scoped_refptr<BrowsingDataChannelIDHelper> helper( |
| + BrowsingDataChannelIDHelper::Create(testing_profile_.get())); |
| helper->StartFetching( |
| - base::Bind(&BrowsingDataServerBoundCertHelperTest::FetchCallback, |
| + base::Bind(&BrowsingDataChannelIDHelperTest::FetchCallback, |
| base::Unretained(this))); |
| - // Blocks until BrowsingDataServerBoundCertHelperTest::FetchCallback is |
| + // Blocks until BrowsingDataChannelIDHelperTest::FetchCallback is |
| // notified. |
| base::RunLoop().RunUntilIdle(); |
| - ASSERT_EQ(2UL, server_bound_cert_list_.size()); |
| - net::ServerBoundCertStore::ServerBoundCertList::const_iterator it = |
| - server_bound_cert_list_.begin(); |
| + ASSERT_EQ(2UL, channel_id_list_.size()); |
| + net::ChannelIDStore::ChannelIDList::const_iterator it = |
| + channel_id_list_.begin(); |
| - // Correct because fetching server_bound_cert_list_ will get them out in the |
| + // Correct because fetching channel_id_list_ will get them out in the |
| // same order CreateCertsForTest put them in. |
| - ASSERT_TRUE(it != server_bound_cert_list_.end()); |
| + ASSERT_TRUE(it != channel_id_list_.end()); |
| EXPECT_EQ("https://www.google.com:443", it->server_identifier()); |
| - ASSERT_TRUE(++it != server_bound_cert_list_.end()); |
| + ASSERT_TRUE(++it != channel_id_list_.end()); |
| EXPECT_EQ("https://www.youtube.com:443", it->server_identifier()); |
| - ASSERT_TRUE(++it == server_bound_cert_list_.end()); |
| + ASSERT_TRUE(++it == channel_id_list_.end()); |
| EXPECT_EQ(0, ssl_config_changed_count_); |
| } |
| -TEST_F(BrowsingDataServerBoundCertHelperTest, DeleteCert) { |
| +TEST_F(BrowsingDataChannelIDHelperTest, DeleteCert) { |
|
wtc
2014/07/01 19:50:47
DeleteCert => DeleteChannelID
Ryan Hamilton
2014/07/21 19:12:03
Done.
|
| CreateCertsForTest(); |
| - scoped_refptr<BrowsingDataServerBoundCertHelper> helper( |
| - BrowsingDataServerBoundCertHelper::Create(testing_profile_.get())); |
| + scoped_refptr<BrowsingDataChannelIDHelper> helper( |
| + BrowsingDataChannelIDHelper::Create(testing_profile_.get())); |
| - helper->DeleteServerBoundCert("https://www.google.com:443"); |
| + helper->DeleteChannelID("https://www.google.com:443"); |
| helper->StartFetching( |
| - base::Bind(&BrowsingDataServerBoundCertHelperTest::FetchCallback, |
| + base::Bind(&BrowsingDataChannelIDHelperTest::FetchCallback, |
| base::Unretained(this))); |
| base::RunLoop().RunUntilIdle(); |
| EXPECT_EQ(1, ssl_config_changed_count_); |
| - ASSERT_EQ(1UL, server_bound_cert_list_.size()); |
| - net::ServerBoundCertStore::ServerBoundCertList::const_iterator it = |
| - server_bound_cert_list_.begin(); |
| + ASSERT_EQ(1UL, channel_id_list_.size()); |
| + net::ChannelIDStore::ChannelIDList::const_iterator it = |
| + channel_id_list_.begin(); |
| - ASSERT_TRUE(it != server_bound_cert_list_.end()); |
| + ASSERT_TRUE(it != channel_id_list_.end()); |
| EXPECT_EQ("https://www.youtube.com:443", it->server_identifier()); |
| - ASSERT_TRUE(++it == server_bound_cert_list_.end()); |
| + ASSERT_TRUE(++it == channel_id_list_.end()); |
| - helper->DeleteServerBoundCert("https://www.youtube.com:443"); |
| + helper->DeleteChannelID("https://www.youtube.com:443"); |
| helper->StartFetching( |
| - base::Bind(&BrowsingDataServerBoundCertHelperTest::FetchCallback, |
| + base::Bind(&BrowsingDataChannelIDHelperTest::FetchCallback, |
| base::Unretained(this))); |
| base::RunLoop().RunUntilIdle(); |
| EXPECT_EQ(2, ssl_config_changed_count_); |
| - ASSERT_EQ(0UL, server_bound_cert_list_.size()); |
| + ASSERT_EQ(0UL, channel_id_list_.size()); |
| } |
| -TEST_F(BrowsingDataServerBoundCertHelperTest, CannedEmpty) { |
| +TEST_F(BrowsingDataChannelIDHelperTest, CannedEmpty) { |
| std::string origin = "https://www.google.com"; |
| - scoped_refptr<CannedBrowsingDataServerBoundCertHelper> helper( |
| - new CannedBrowsingDataServerBoundCertHelper()); |
| + scoped_refptr<CannedBrowsingDataChannelIDHelper> helper( |
| + new CannedBrowsingDataChannelIDHelper()); |
| ASSERT_TRUE(helper->empty()); |
| - helper->AddServerBoundCert(net::ServerBoundCertStore::ServerBoundCert( |
| + helper->AddChannelID(net::ChannelIDStore::ChannelID( |
| origin, base::Time(), base::Time(), "key", "cert")); |
| ASSERT_FALSE(helper->empty()); |
| helper->Reset(); |