| 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/http/transport_security_state.h" | 5 #include "net/http/transport_security_state.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 HashValue hash; | 779 HashValue hash; |
| 780 if (!hash.FromString(type_and_base64)) | 780 if (!hash.FromString(type_and_base64)) |
| 781 return false; | 781 return false; |
| 782 | 782 |
| 783 out->push_back(hash); | 783 out->push_back(hash); |
| 784 return true; | 784 return true; |
| 785 } | 785 } |
| 786 | 786 |
| 787 TEST_F(TransportSecurityStateTest, PinValidationWithoutRejectedCerts) { | 787 TEST_F(TransportSecurityStateTest, PinValidationWithoutRejectedCerts) { |
| 788 // kGoodPath is blog.torproject.org. | 788 // kGoodPath is blog.torproject.org. |
| 789 static const char* kGoodPath[] = { | 789 static const char* const kGoodPath[] = { |
| 790 "sha1/m9lHYJYke9k0GtVZ+bXSQYE8nDI=", | 790 "sha1/m9lHYJYke9k0GtVZ+bXSQYE8nDI=", |
| 791 "sha1/o5OZxATDsgmwgcIfIWIneMJ0jkw=", | 791 "sha1/o5OZxATDsgmwgcIfIWIneMJ0jkw=", |
| 792 "sha1/wHqYaI2J+6sFZAwRfap9ZbjKzE4=", | 792 "sha1/wHqYaI2J+6sFZAwRfap9ZbjKzE4=", |
| 793 NULL, | 793 NULL, |
| 794 }; | 794 }; |
| 795 | 795 |
| 796 // kBadPath is plus.google.com via Trustcenter, which is utterly wrong for | 796 // kBadPath is plus.google.com via Trustcenter, which is utterly wrong for |
| 797 // torproject.org. | 797 // torproject.org. |
| 798 static const char* kBadPath[] = { | 798 static const char* const kBadPath[] = { |
| 799 "sha1/4BjDjn8v2lWeUFQnqSs0BgbIcrU=", | 799 "sha1/4BjDjn8v2lWeUFQnqSs0BgbIcrU=", |
| 800 "sha1/gzuEEAB/bkqdQS3EIjk2by7lW+k=", | 800 "sha1/gzuEEAB/bkqdQS3EIjk2by7lW+k=", |
| 801 "sha1/SOZo+SvSspXXR9gjIBBPM5iQn9Q=", | 801 "sha1/SOZo+SvSspXXR9gjIBBPM5iQn9Q=", |
| 802 NULL, | 802 NULL, |
| 803 }; | 803 }; |
| 804 | 804 |
| 805 HashValueVector good_hashes, bad_hashes; | 805 HashValueVector good_hashes, bad_hashes; |
| 806 | 806 |
| 807 for (size_t i = 0; kGoodPath[i]; i++) { | 807 for (size_t i = 0; kGoodPath[i]; i++) { |
| 808 EXPECT_TRUE(AddHash(kGoodPath[i], &good_hashes)); | 808 EXPECT_TRUE(AddHash(kGoodPath[i], &good_hashes)); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 921 // These hosts used to only be HSTS when SNI was available. | 921 // These hosts used to only be HSTS when SNI was available. |
| 922 EXPECT_TRUE(TransportSecurityState::IsGooglePinnedProperty( | 922 EXPECT_TRUE(TransportSecurityState::IsGooglePinnedProperty( |
| 923 "gmail.com")); | 923 "gmail.com")); |
| 924 EXPECT_TRUE(TransportSecurityState::IsGooglePinnedProperty( | 924 EXPECT_TRUE(TransportSecurityState::IsGooglePinnedProperty( |
| 925 "googlegroups.com")); | 925 "googlegroups.com")); |
| 926 EXPECT_TRUE(TransportSecurityState::IsGooglePinnedProperty( | 926 EXPECT_TRUE(TransportSecurityState::IsGooglePinnedProperty( |
| 927 "www.googlegroups.com")); | 927 "www.googlegroups.com")); |
| 928 } | 928 } |
| 929 | 929 |
| 930 } // namespace net | 930 } // namespace net |
| OLD | NEW |