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

Side by Side Diff: net/http/http_network_transaction_unittest.cc

Issue 1356933002: make ProxyService::CreateSystemProxyConfigService return scoped_ptrs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: proper namespacing Created 5 years, 2 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
« no previous file with comments | « ios/web/shell/shell_url_request_context_getter.cc ('k') | net/proxy/proxy_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_network_transaction.h" 5 #include "net/http/http_network_transaction.h"
6 6
7 #include <math.h> // ceil 7 #include <math.h> // ceil
8 #include <stdarg.h> 8 #include <stdarg.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 9937 matching lines...) Expand 10 before | Expand all | Expand 10 after
9948 UseAlternateProtocolForTunneledNpnSpdy) { 9948 UseAlternateProtocolForTunneledNpnSpdy) {
9949 session_deps_.use_alternative_services = true; 9949 session_deps_.use_alternative_services = true;
9950 session_deps_.next_protos = SpdyNextProtos(); 9950 session_deps_.next_protos = SpdyNextProtos();
9951 9951
9952 ProxyConfig proxy_config; 9952 ProxyConfig proxy_config;
9953 proxy_config.set_auto_detect(true); 9953 proxy_config.set_auto_detect(true);
9954 proxy_config.set_pac_url(GURL("http://fooproxyurl")); 9954 proxy_config.set_pac_url(GURL("http://fooproxyurl"));
9955 9955
9956 CapturingProxyResolver capturing_proxy_resolver; 9956 CapturingProxyResolver capturing_proxy_resolver;
9957 session_deps_.proxy_service.reset(new ProxyService( 9957 session_deps_.proxy_service.reset(new ProxyService(
9958 new ProxyConfigServiceFixed(proxy_config), 9958 make_scoped_ptr(new ProxyConfigServiceFixed(proxy_config)),
9959 make_scoped_ptr( 9959 make_scoped_ptr(
9960 new CapturingProxyResolverFactory(&capturing_proxy_resolver)), 9960 new CapturingProxyResolverFactory(&capturing_proxy_resolver)),
9961 NULL)); 9961 NULL));
9962 TestNetLog net_log; 9962 TestNetLog net_log;
9963 session_deps_.net_log = &net_log; 9963 session_deps_.net_log = &net_log;
9964 9964
9965 HttpRequestInfo request; 9965 HttpRequestInfo request;
9966 request.method = "GET"; 9966 request.method = "GET";
9967 request.url = GURL("http://www.example.org/"); 9967 request.url = GURL("http://www.example.org/");
9968 request.load_flags = 0; 9968 request.load_flags = 0;
(...skipping 2788 matching lines...) Expand 10 before | Expand all | Expand 10 after
12757 new DeterministicSocketData(reads2, arraysize(reads2), 12757 new DeterministicSocketData(reads2, arraysize(reads2),
12758 writes2, arraysize(writes2))); 12758 writes2, arraysize(writes2)));
12759 MockConnect connect_data2(ASYNC, OK); 12759 MockConnect connect_data2(ASYNC, OK);
12760 data2->set_connect_data(connect_data2); 12760 data2->set_connect_data(connect_data2);
12761 12761
12762 // Set up a proxy config that sends HTTP requests to a proxy, and 12762 // Set up a proxy config that sends HTTP requests to a proxy, and
12763 // all others direct. 12763 // all others direct.
12764 ProxyConfig proxy_config; 12764 ProxyConfig proxy_config;
12765 proxy_config.proxy_rules().ParseFromString("http=https://proxy:443"); 12765 proxy_config.proxy_rules().ParseFromString("http=https://proxy:443");
12766 session_deps_.proxy_service.reset(new ProxyService( 12766 session_deps_.proxy_service.reset(new ProxyService(
12767 new ProxyConfigServiceFixed(proxy_config), nullptr, NULL)); 12767 make_scoped_ptr(new ProxyConfigServiceFixed(proxy_config)), nullptr,
12768 NULL));
12768 12769
12769 SSLSocketDataProvider ssl1(ASYNC, OK); // to the proxy 12770 SSLSocketDataProvider ssl1(ASYNC, OK); // to the proxy
12770 ssl1.SetNextProto(GetParam()); 12771 ssl1.SetNextProto(GetParam());
12771 // Load a valid cert. Note, that this does not need to 12772 // Load a valid cert. Note, that this does not need to
12772 // be valid for proxy because the MockSSLClientSocket does 12773 // be valid for proxy because the MockSSLClientSocket does
12773 // not actually verify it. But SpdySession will use this 12774 // not actually verify it. But SpdySession will use this
12774 // to see if it is valid for the new origin 12775 // to see if it is valid for the new origin
12775 ssl1.cert = ImportCertFromFile(GetTestCertsDirectory(), "ok_cert.pem"); 12776 ssl1.cert = ImportCertFromFile(GetTestCertsDirectory(), "ok_cert.pem");
12776 ASSERT_TRUE(ssl1.cert.get()); 12777 ASSERT_TRUE(ssl1.cert.get());
12777 session_deps_.deterministic_socket_factory->AddSSLSocketDataProvider(&ssl1); 12778 session_deps_.deterministic_socket_factory->AddSSLSocketDataProvider(&ssl1);
(...skipping 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after
14720 std::string response_data; 14721 std::string response_data;
14721 EXPECT_EQ(OK, ReadTransaction(trans.get(), &response_data)); 14722 EXPECT_EQ(OK, ReadTransaction(trans.get(), &response_data));
14722 14723
14723 EXPECT_EQ(CountWriteBytes(data_writes, arraysize(data_writes)), 14724 EXPECT_EQ(CountWriteBytes(data_writes, arraysize(data_writes)),
14724 trans->GetTotalSentBytes()); 14725 trans->GetTotalSentBytes());
14725 EXPECT_EQ(CountReadBytes(data_reads, arraysize(data_reads)), 14726 EXPECT_EQ(CountReadBytes(data_reads, arraysize(data_reads)),
14726 trans->GetTotalReceivedBytes()); 14727 trans->GetTotalReceivedBytes());
14727 } 14728 }
14728 14729
14729 } // namespace net 14730 } // namespace net
OLDNEW
« no previous file with comments | « ios/web/shell/shell_url_request_context_getter.cc ('k') | net/proxy/proxy_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698