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/quic/quic_stream_factory.h" | 5 #include "net/quic/quic_stream_factory.h" |
6 | 6 |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
10 #include "net/base/test_data_directory.h" | 10 #include "net/base/test_data_directory.h" |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 } | 746 } |
747 | 747 |
748 TEST_P(QuicStreamFactoryTest, HttpsPoolingWithMatchingPins) { | 748 TEST_P(QuicStreamFactoryTest, HttpsPoolingWithMatchingPins) { |
749 Initialize(); | 749 Initialize(); |
750 MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; | 750 MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; |
751 SequencedSocketData socket_data(reads, arraysize(reads), nullptr, 0); | 751 SequencedSocketData socket_data(reads, arraysize(reads), nullptr, 0); |
752 socket_factory_.AddSocketDataProvider(&socket_data); | 752 socket_factory_.AddSocketDataProvider(&socket_data); |
753 | 753 |
754 HostPortPair server1("www.example.org", 443); | 754 HostPortPair server1("www.example.org", 443); |
755 HostPortPair server2("mail.example.org", 443); | 755 HostPortPair server2("mail.example.org", 443); |
756 uint8 primary_pin = 1; | 756 uint8_t primary_pin = 1; |
757 uint8 backup_pin = 2; | 757 uint8_t backup_pin = 2; |
758 test::AddPin(&transport_security_state_, "mail.example.org", primary_pin, | 758 test::AddPin(&transport_security_state_, "mail.example.org", primary_pin, |
759 backup_pin); | 759 backup_pin); |
760 | 760 |
761 ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); | 761 ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); |
762 verify_details.cert_verify_result.public_key_hashes.push_back( | 762 verify_details.cert_verify_result.public_key_hashes.push_back( |
763 test::GetTestHashValue(primary_pin)); | 763 test::GetTestHashValue(primary_pin)); |
764 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); | 764 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); |
765 | 765 |
766 host_resolver_.set_synchronous_mode(true); | 766 host_resolver_.set_synchronous_mode(true); |
767 host_resolver_.rules()->AddIPLiteralRule(server1.host(), "192.168.0.1", ""); | 767 host_resolver_.rules()->AddIPLiteralRule(server1.host(), "192.168.0.1", ""); |
(...skipping 26 matching lines...) Expand all Loading... |
794 Initialize(); | 794 Initialize(); |
795 | 795 |
796 MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; | 796 MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; |
797 SequencedSocketData socket_data1(reads, arraysize(reads), nullptr, 0); | 797 SequencedSocketData socket_data1(reads, arraysize(reads), nullptr, 0); |
798 SequencedSocketData socket_data2(reads, arraysize(reads), nullptr, 0); | 798 SequencedSocketData socket_data2(reads, arraysize(reads), nullptr, 0); |
799 socket_factory_.AddSocketDataProvider(&socket_data1); | 799 socket_factory_.AddSocketDataProvider(&socket_data1); |
800 socket_factory_.AddSocketDataProvider(&socket_data2); | 800 socket_factory_.AddSocketDataProvider(&socket_data2); |
801 | 801 |
802 HostPortPair server1("www.example.org", 443); | 802 HostPortPair server1("www.example.org", 443); |
803 HostPortPair server2("mail.example.org", 443); | 803 HostPortPair server2("mail.example.org", 443); |
804 uint8 primary_pin = 1; | 804 uint8_t primary_pin = 1; |
805 uint8 backup_pin = 2; | 805 uint8_t backup_pin = 2; |
806 test::AddPin(&transport_security_state_, "mail.example.org", primary_pin, | 806 test::AddPin(&transport_security_state_, "mail.example.org", primary_pin, |
807 backup_pin); | 807 backup_pin); |
808 | 808 |
809 ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); | 809 ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); |
810 verify_details.cert_verify_result.public_key_hashes.push_back( | 810 verify_details.cert_verify_result.public_key_hashes.push_back( |
811 test::GetTestHashValue(primary_pin)); | 811 test::GetTestHashValue(primary_pin)); |
812 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); | 812 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); |
813 | 813 |
814 host_resolver_.set_synchronous_mode(true); | 814 host_resolver_.set_synchronous_mode(true); |
815 host_resolver_.rules()->AddIPLiteralRule(server1.host(), "192.168.0.1", ""); | 815 host_resolver_.rules()->AddIPLiteralRule(server1.host(), "192.168.0.1", ""); |
(...skipping 26 matching lines...) Expand all Loading... |
842 TEST_P(QuicStreamFactoryTest, NoHttpsPoolingWithDifferentPins) { | 842 TEST_P(QuicStreamFactoryTest, NoHttpsPoolingWithDifferentPins) { |
843 Initialize(); | 843 Initialize(); |
844 MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; | 844 MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; |
845 SequencedSocketData socket_data1(reads, arraysize(reads), nullptr, 0); | 845 SequencedSocketData socket_data1(reads, arraysize(reads), nullptr, 0); |
846 SequencedSocketData socket_data2(reads, arraysize(reads), nullptr, 0); | 846 SequencedSocketData socket_data2(reads, arraysize(reads), nullptr, 0); |
847 socket_factory_.AddSocketDataProvider(&socket_data1); | 847 socket_factory_.AddSocketDataProvider(&socket_data1); |
848 socket_factory_.AddSocketDataProvider(&socket_data2); | 848 socket_factory_.AddSocketDataProvider(&socket_data2); |
849 | 849 |
850 HostPortPair server1("www.example.org", 443); | 850 HostPortPair server1("www.example.org", 443); |
851 HostPortPair server2("mail.example.org", 443); | 851 HostPortPair server2("mail.example.org", 443); |
852 uint8 primary_pin = 1; | 852 uint8_t primary_pin = 1; |
853 uint8 backup_pin = 2; | 853 uint8_t backup_pin = 2; |
854 uint8 bad_pin = 3; | 854 uint8_t bad_pin = 3; |
855 test::AddPin(&transport_security_state_, "mail.example.org", primary_pin, | 855 test::AddPin(&transport_security_state_, "mail.example.org", primary_pin, |
856 backup_pin); | 856 backup_pin); |
857 | 857 |
858 ProofVerifyDetailsChromium verify_details1 = DefaultProofVerifyDetails(); | 858 ProofVerifyDetailsChromium verify_details1 = DefaultProofVerifyDetails(); |
859 verify_details1.cert_verify_result.public_key_hashes.push_back( | 859 verify_details1.cert_verify_result.public_key_hashes.push_back( |
860 test::GetTestHashValue(bad_pin)); | 860 test::GetTestHashValue(bad_pin)); |
861 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details1); | 861 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details1); |
862 | 862 |
863 ProofVerifyDetailsChromium verify_details2 = DefaultProofVerifyDetails(); | 863 ProofVerifyDetailsChromium verify_details2 = DefaultProofVerifyDetails(); |
864 verify_details2.cert_verify_result.public_key_hashes.push_back( | 864 verify_details2.cert_verify_result.public_key_hashes.push_back( |
(...skipping 1714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2579 EXPECT_EQ(1u, observer.executed_count()); | 2579 EXPECT_EQ(1u, observer.executed_count()); |
2580 | 2580 |
2581 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); | 2581 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); |
2582 EXPECT_TRUE(stream.get()); | 2582 EXPECT_TRUE(stream.get()); |
2583 EXPECT_TRUE(socket_data.AllReadDataConsumed()); | 2583 EXPECT_TRUE(socket_data.AllReadDataConsumed()); |
2584 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); | 2584 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); |
2585 } | 2585 } |
2586 | 2586 |
2587 } // namespace test | 2587 } // namespace test |
2588 } // namespace net | 2588 } // namespace net |
OLD | NEW |