Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: net/socket/ssl_client_socket_pool_unittest.cc

Issue 2116983002: Change HostResolver::Resolve() to take an std::unique_ptr<Request>* rather than a RequestHandle* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/http_proxy_client_socket_pool.h" 5 #include "net/http/http_proxy_client_socket_pool.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 std::string iplist; 821 std::string iplist;
822 SpdySessionKey key; 822 SpdySessionKey key;
823 AddressList addresses; 823 AddressList addresses;
824 } test_hosts[] = { 824 } test_hosts[] = {
825 { "www.webkit.org", "192.0.2.33,192.168.0.1,192.168.0.5" }, 825 { "www.webkit.org", "192.0.2.33,192.168.0.1,192.168.0.5" },
826 { "code.google.com", "192.168.0.2,192.168.0.3,192.168.0.5" }, 826 { "code.google.com", "192.168.0.2,192.168.0.3,192.168.0.5" },
827 { "js.webkit.org", "192.168.0.4,192.168.0.1,192.0.2.33" }, 827 { "js.webkit.org", "192.168.0.4,192.168.0.1,192.0.2.33" },
828 }; 828 };
829 829
830 host_resolver_.set_synchronous_mode(true); 830 host_resolver_.set_synchronous_mode(true);
831 std::unique_ptr<HostResolver::Request> req[arraysize(test_hosts)];
831 for (size_t i = 0; i < arraysize(test_hosts); i++) { 832 for (size_t i = 0; i < arraysize(test_hosts); i++) {
832 host_resolver_.rules()->AddIPLiteralRule( 833 host_resolver_.rules()->AddIPLiteralRule(
833 test_hosts[i].name, test_hosts[i].iplist, std::string()); 834 test_hosts[i].name, test_hosts[i].iplist, std::string());
834 835
835 // This test requires that the HostResolver cache be populated. Normal 836 // This test requires that the HostResolver cache be populated. Normal
836 // code would have done this already, but we do it manually. 837 // code would have done this already, but we do it manually.
837 HostResolver::RequestInfo info(HostPortPair(test_hosts[i].name, kTestPort)); 838 HostResolver::RequestInfo info(HostPortPair(test_hosts[i].name, kTestPort));
838 host_resolver_.Resolve(info, 839 host_resolver_.Resolve(info, DEFAULT_PRIORITY, &test_hosts[i].addresses,
839 DEFAULT_PRIORITY, 840 CompletionCallback(), &req[i], BoundNetLog());
840 &test_hosts[i].addresses,
841 CompletionCallback(),
842 NULL,
843 BoundNetLog());
844 841
845 // Setup a SpdySessionKey 842 // Setup a SpdySessionKey
846 test_hosts[i].key = SpdySessionKey( 843 test_hosts[i].key = SpdySessionKey(
847 HostPortPair(test_hosts[i].name, kTestPort), ProxyServer::Direct(), 844 HostPortPair(test_hosts[i].name, kTestPort), ProxyServer::Direct(),
848 PRIVACY_MODE_DISABLED); 845 PRIVACY_MODE_DISABLED);
849 } 846 }
850 847
851 MockRead reads[] = { 848 MockRead reads[] = {
852 MockRead(ASYNC, ERR_IO_PENDING), 849 MockRead(ASYNC, ERR_IO_PENDING),
853 }; 850 };
(...skipping 26 matching lines...) Expand all
880 std::string name; 877 std::string name;
881 std::string iplist; 878 std::string iplist;
882 SpdySessionKey key; 879 SpdySessionKey key;
883 AddressList addresses; 880 AddressList addresses;
884 } test_hosts[] = { 881 } test_hosts[] = {
885 { "www.webkit.org", "192.0.2.33,192.168.0.1,192.168.0.5" }, 882 { "www.webkit.org", "192.0.2.33,192.168.0.1,192.168.0.5" },
886 { "js.webkit.com", "192.168.0.4,192.168.0.1,192.0.2.33" }, 883 { "js.webkit.com", "192.168.0.4,192.168.0.1,192.0.2.33" },
887 }; 884 };
888 885
889 TestCompletionCallback callback; 886 TestCompletionCallback callback;
887 std::unique_ptr<HostResolver::Request> req[arraysize(test_hosts)];
890 int rv; 888 int rv;
891 for (size_t i = 0; i < arraysize(test_hosts); i++) { 889 for (size_t i = 0; i < arraysize(test_hosts); i++) {
892 host_resolver_.rules()->AddIPLiteralRule( 890 host_resolver_.rules()->AddIPLiteralRule(
893 test_hosts[i].name, test_hosts[i].iplist, std::string()); 891 test_hosts[i].name, test_hosts[i].iplist, std::string());
894 892
895 // This test requires that the HostResolver cache be populated. Normal 893 // This test requires that the HostResolver cache be populated. Normal
896 // code would have done this already, but we do it manually. 894 // code would have done this already, but we do it manually.
897 HostResolver::RequestInfo info(HostPortPair(test_hosts[i].name, kTestPort)); 895 HostResolver::RequestInfo info(HostPortPair(test_hosts[i].name, kTestPort));
898 rv = host_resolver_.Resolve(info, 896 rv =
899 DEFAULT_PRIORITY, 897 host_resolver_.Resolve(info, DEFAULT_PRIORITY, &test_hosts[i].addresses,
900 &test_hosts[i].addresses, 898 callback.callback(), &req[i], BoundNetLog());
901 callback.callback(),
902 NULL,
903 BoundNetLog());
904 EXPECT_THAT(callback.GetResult(rv), IsOk()); 899 EXPECT_THAT(callback.GetResult(rv), IsOk());
905 900
906 // Setup a SpdySessionKey 901 // Setup a SpdySessionKey
907 test_hosts[i].key = SpdySessionKey( 902 test_hosts[i].key = SpdySessionKey(
908 HostPortPair(test_hosts[i].name, kTestPort), ProxyServer::Direct(), 903 HostPortPair(test_hosts[i].name, kTestPort), ProxyServer::Direct(),
909 PRIVACY_MODE_DISABLED); 904 PRIVACY_MODE_DISABLED);
910 } 905 }
911 906
912 MockRead reads[] = { 907 MockRead reads[] = {
913 MockRead(ASYNC, ERR_IO_PENDING), 908 MockRead(ASYNC, ERR_IO_PENDING),
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 ssl.channel_id_sent = true; 940 ssl.channel_id_sent = true;
946 ssl.SetNextProto(GetParam()); 941 ssl.SetNextProto(GetParam());
947 TestIPPoolingDisabled(&ssl); 942 TestIPPoolingDisabled(&ssl);
948 } 943 }
949 944
950 // It would be nice to also test the timeouts in SSLClientSocketPool. 945 // It would be nice to also test the timeouts in SSLClientSocketPool.
951 946
952 } // namespace 947 } // namespace
953 948
954 } // namespace net 949 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698