| 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 "net/ssl/server_bound_cert_service.h" | 5 #include "net/ssl/server_bound_cert_service.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 } | 98 } |
| 99 | 99 |
| 100 void | 100 void |
| 101 MockServerBoundCertStoreWithAsyncGet::CallGetServerBoundCertCallbackWithResult( | 101 MockServerBoundCertStoreWithAsyncGet::CallGetServerBoundCertCallbackWithResult( |
| 102 int err, | 102 int err, |
| 103 base::Time expiration_time, | 103 base::Time expiration_time, |
| 104 const std::string& private_key, | 104 const std::string& private_key, |
| 105 const std::string& cert) { | 105 const std::string& cert) { |
| 106 if (err == OK) | 106 if (err == OK) |
| 107 cert_count_ = 1; | 107 cert_count_ = 1; |
| 108 callback_.Run(err, server_identifier_, expiration_time, private_key, cert); | 108 base::MessageLoop::current()->PostTask(FROM_HERE, |
| 109 base::Bind(callback_, |
| 110 err, |
| 111 server_identifier_, |
| 112 expiration_time, |
| 113 private_key, |
| 114 cert)); |
| 109 } | 115 } |
| 110 | 116 |
| 111 TEST_F(ServerBoundCertServiceTest, GetDomainForHost) { | 117 TEST_F(ServerBoundCertServiceTest, GetDomainForHost) { |
| 112 EXPECT_EQ("google.com", | 118 EXPECT_EQ("google.com", |
| 113 ServerBoundCertService::GetDomainForHost("google.com")); | 119 ServerBoundCertService::GetDomainForHost("google.com")); |
| 114 EXPECT_EQ("google.com", | 120 EXPECT_EQ("google.com", |
| 115 ServerBoundCertService::GetDomainForHost("www.google.com")); | 121 ServerBoundCertService::GetDomainForHost("www.google.com")); |
| 116 EXPECT_EQ("foo.appspot.com", | 122 EXPECT_EQ("foo.appspot.com", |
| 117 ServerBoundCertService::GetDomainForHost("foo.appspot.com")); | 123 ServerBoundCertService::GetDomainForHost("foo.appspot.com")); |
| 118 EXPECT_EQ("bar.appspot.com", | 124 EXPECT_EQ("bar.appspot.com", |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 EXPECT_STREQ("ab", private_key_info.c_str()); | 578 EXPECT_STREQ("ab", private_key_info.c_str()); |
| 573 EXPECT_STREQ("cd", der_cert.c_str()); | 579 EXPECT_STREQ("cd", der_cert.c_str()); |
| 574 EXPECT_FALSE(request_handle.is_active()); | 580 EXPECT_FALSE(request_handle.is_active()); |
| 575 } | 581 } |
| 576 | 582 |
| 577 #endif // !defined(USE_OPENSSL) | 583 #endif // !defined(USE_OPENSSL) |
| 578 | 584 |
| 579 } // namespace | 585 } // namespace |
| 580 | 586 |
| 581 } // namespace net | 587 } // namespace net |
| OLD | NEW |