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

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: http_stream_factory_impl_job_controller_unittest RequestHandle* to unique_ptr Created 4 years, 4 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 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 std::string iplist; 813 std::string iplist;
814 SpdySessionKey key; 814 SpdySessionKey key;
815 AddressList addresses; 815 AddressList addresses;
816 } test_hosts[] = { 816 } test_hosts[] = {
817 { "www.webkit.org", "192.0.2.33,192.168.0.1,192.168.0.5" }, 817 { "www.webkit.org", "192.0.2.33,192.168.0.1,192.168.0.5" },
818 { "code.google.com", "192.168.0.2,192.168.0.3,192.168.0.5" }, 818 { "code.google.com", "192.168.0.2,192.168.0.3,192.168.0.5" },
819 { "js.webkit.org", "192.168.0.4,192.168.0.1,192.0.2.33" }, 819 { "js.webkit.org", "192.168.0.4,192.168.0.1,192.0.2.33" },
820 }; 820 };
821 821
822 host_resolver_.set_synchronous_mode(true); 822 host_resolver_.set_synchronous_mode(true);
823 std::unique_ptr<HostResolver::Request> req[arraysize(test_hosts)];
823 for (size_t i = 0; i < arraysize(test_hosts); i++) { 824 for (size_t i = 0; i < arraysize(test_hosts); i++) {
824 host_resolver_.rules()->AddIPLiteralRule( 825 host_resolver_.rules()->AddIPLiteralRule(
825 test_hosts[i].name, test_hosts[i].iplist, std::string()); 826 test_hosts[i].name, test_hosts[i].iplist, std::string());
826 827
827 // This test requires that the HostResolver cache be populated. Normal 828 // This test requires that the HostResolver cache be populated. Normal
828 // code would have done this already, but we do it manually. 829 // code would have done this already, but we do it manually.
829 HostResolver::RequestInfo info(HostPortPair(test_hosts[i].name, kTestPort)); 830 HostResolver::RequestInfo info(HostPortPair(test_hosts[i].name, kTestPort));
830 host_resolver_.Resolve(info, 831 host_resolver_.Resolve(info, DEFAULT_PRIORITY, &test_hosts[i].addresses,
831 DEFAULT_PRIORITY, 832 CompletionCallback(), &req[i], BoundNetLog());
832 &test_hosts[i].addresses,
833 CompletionCallback(),
834 NULL,
835 BoundNetLog());
836 833
837 // Setup a SpdySessionKey 834 // Setup a SpdySessionKey
838 test_hosts[i].key = SpdySessionKey( 835 test_hosts[i].key = SpdySessionKey(
839 HostPortPair(test_hosts[i].name, kTestPort), ProxyServer::Direct(), 836 HostPortPair(test_hosts[i].name, kTestPort), ProxyServer::Direct(),
840 PRIVACY_MODE_DISABLED); 837 PRIVACY_MODE_DISABLED);
841 } 838 }
842 839
843 MockRead reads[] = { 840 MockRead reads[] = {
844 MockRead(ASYNC, ERR_IO_PENDING), 841 MockRead(ASYNC, ERR_IO_PENDING),
845 }; 842 };
(...skipping 27 matching lines...) Expand all
873 std::string iplist; 870 std::string iplist;
874 SpdySessionKey key; 871 SpdySessionKey key;
875 AddressList addresses; 872 AddressList addresses;
876 } test_hosts[] = { 873 } test_hosts[] = {
877 { "www.webkit.org", "192.0.2.33,192.168.0.1,192.168.0.5" }, 874 { "www.webkit.org", "192.0.2.33,192.168.0.1,192.168.0.5" },
878 { "js.webkit.com", "192.168.0.4,192.168.0.1,192.0.2.33" }, 875 { "js.webkit.com", "192.168.0.4,192.168.0.1,192.0.2.33" },
879 }; 876 };
880 877
881 TestCompletionCallback callback; 878 TestCompletionCallback callback;
882 int rv; 879 int rv;
880 std::unique_ptr<HostResolver::Request> req[arraysize(test_hosts)];
883 for (size_t i = 0; i < arraysize(test_hosts); i++) { 881 for (size_t i = 0; i < arraysize(test_hosts); i++) {
884 host_resolver_.rules()->AddIPLiteralRule( 882 host_resolver_.rules()->AddIPLiteralRule(
885 test_hosts[i].name, test_hosts[i].iplist, std::string()); 883 test_hosts[i].name, test_hosts[i].iplist, std::string());
886 884
887 // This test requires that the HostResolver cache be populated. Normal 885 // This test requires that the HostResolver cache be populated. Normal
888 // code would have done this already, but we do it manually. 886 // code would have done this already, but we do it manually.
889 HostResolver::RequestInfo info(HostPortPair(test_hosts[i].name, kTestPort)); 887 HostResolver::RequestInfo info(HostPortPair(test_hosts[i].name, kTestPort));
890 rv = host_resolver_.Resolve(info, 888 rv =
891 DEFAULT_PRIORITY, 889 host_resolver_.Resolve(info, DEFAULT_PRIORITY, &test_hosts[i].addresses,
892 &test_hosts[i].addresses, 890 callback.callback(), &req[i], BoundNetLog());
893 callback.callback(),
894 NULL,
895 BoundNetLog());
896 EXPECT_THAT(callback.GetResult(rv), IsOk()); 891 EXPECT_THAT(callback.GetResult(rv), IsOk());
897 892
898 // Setup a SpdySessionKey 893 // Setup a SpdySessionKey
899 test_hosts[i].key = SpdySessionKey( 894 test_hosts[i].key = SpdySessionKey(
900 HostPortPair(test_hosts[i].name, kTestPort), ProxyServer::Direct(), 895 HostPortPair(test_hosts[i].name, kTestPort), ProxyServer::Direct(),
901 PRIVACY_MODE_DISABLED); 896 PRIVACY_MODE_DISABLED);
902 } 897 }
903 898
904 MockRead reads[] = { 899 MockRead reads[] = {
905 MockRead(ASYNC, ERR_IO_PENDING), 900 MockRead(ASYNC, ERR_IO_PENDING),
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 ssl.channel_id_sent = true; 932 ssl.channel_id_sent = true;
938 ssl.SetNextProto(kProtoHTTP2); 933 ssl.SetNextProto(kProtoHTTP2);
939 TestIPPoolingDisabled(&ssl); 934 TestIPPoolingDisabled(&ssl);
940 } 935 }
941 936
942 // It would be nice to also test the timeouts in SSLClientSocketPool. 937 // It would be nice to also test the timeouts in SSLClientSocketPool.
943 938
944 } // namespace 939 } // namespace
945 940
946 } // namespace net 941 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698