OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/browsing_data_server_bound_cert_helper.h" | 5 #include "chrome/browser/browsing_data_server_bound_cert_helper.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
10 #include "chrome/test/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 virtual void SetUp() { | 21 virtual void SetUp() { |
22 ui_thread_.reset(new content::TestBrowserThread(BrowserThread::UI, | 22 ui_thread_.reset(new content::TestBrowserThread(BrowserThread::UI, |
23 &message_loop_)); | 23 &message_loop_)); |
24 io_thread_.reset(new content::TestBrowserThread(BrowserThread::IO, | 24 io_thread_.reset(new content::TestBrowserThread(BrowserThread::IO, |
25 &message_loop_)); | 25 &message_loop_)); |
26 testing_profile_.reset(new TestingProfile()); | 26 testing_profile_.reset(new TestingProfile()); |
27 testing_profile_->CreateRequestContext(); | 27 testing_profile_->CreateRequestContext(); |
28 } | 28 } |
29 | 29 |
30 void CreateCertsForTest() { | 30 void CreateCertsForTest() { |
31 scoped_refptr<net::URLRequestContext> context = | 31 net::URLRequestContext* context = |
32 testing_profile_->GetRequestContext()->GetURLRequestContext(); | 32 testing_profile_->GetRequestContext()->GetURLRequestContext(); |
33 net::ServerBoundCertStore* cert_store = | 33 net::ServerBoundCertStore* cert_store = |
34 context->server_bound_cert_service()->GetCertStore(); | 34 context->server_bound_cert_service()->GetCertStore(); |
35 cert_store->SetServerBoundCert("https://www.google.com:443", | 35 cert_store->SetServerBoundCert("https://www.google.com:443", |
36 net::CLIENT_CERT_RSA_SIGN, | 36 net::CLIENT_CERT_RSA_SIGN, |
37 base::Time(), base::Time(), | 37 base::Time(), base::Time(), |
38 "key", "cert"); | 38 "key", "cert"); |
39 cert_store->SetServerBoundCert("https://www.youtube.com:443", | 39 cert_store->SetServerBoundCert("https://www.youtube.com:443", |
40 net::CLIENT_CERT_RSA_SIGN, | 40 net::CLIENT_CERT_RSA_SIGN, |
41 base::Time(), base::Time(), | 41 base::Time(), base::Time(), |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 new CannedBrowsingDataServerBoundCertHelper()); | 150 new CannedBrowsingDataServerBoundCertHelper()); |
151 | 151 |
152 ASSERT_TRUE(helper->empty()); | 152 ASSERT_TRUE(helper->empty()); |
153 helper->AddServerBoundCert(net::ServerBoundCertStore::ServerBoundCert( | 153 helper->AddServerBoundCert(net::ServerBoundCertStore::ServerBoundCert( |
154 origin, net::CLIENT_CERT_RSA_SIGN, base::Time(), base::Time(), "key", | 154 origin, net::CLIENT_CERT_RSA_SIGN, base::Time(), base::Time(), "key", |
155 "cert")); | 155 "cert")); |
156 ASSERT_FALSE(helper->empty()); | 156 ASSERT_FALSE(helper->empty()); |
157 helper->Reset(); | 157 helper->Reset(); |
158 ASSERT_TRUE(helper->empty()); | 158 ASSERT_TRUE(helper->empty()); |
159 } | 159 } |
OLD | NEW |