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

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

Issue 3259006: Add support for speaking SPDY to an HTTPS proxy.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | net/http/http_proxy_client_socket.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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 1704 matching lines...) Expand 10 before | Expand all | Expand 10 after
1715 1715
1716 EXPECT_TRUE(response->headers->IsKeepAlive()); 1716 EXPECT_TRUE(response->headers->IsKeepAlive());
1717 EXPECT_EQ(200, response->headers->response_code()); 1717 EXPECT_EQ(200, response->headers->response_code());
1718 EXPECT_EQ(100, response->headers->GetContentLength()); 1718 EXPECT_EQ(100, response->headers->GetContentLength());
1719 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); 1719 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion());
1720 1720
1721 // The password prompt info should not be set. 1721 // The password prompt info should not be set.
1722 EXPECT_TRUE(response->auth_challenge.get() == NULL); 1722 EXPECT_TRUE(response->auth_challenge.get() == NULL);
1723 } 1723 }
1724 1724
1725 // Test a SPDY get through an HTTPS Proxy.
1726 TEST_F(HttpNetworkTransactionTest, HttpsProxySpdyGet) {
1727 // Configure against https proxy server "proxy:70".
1728 SessionDependencies session_deps(CreateFixedProxyService("https://proxy:70"));
1729 CapturingBoundNetLog log(CapturingNetLog::kUnbounded);
1730 session_deps.net_log = log.bound().net_log();
1731 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps));
1732
1733 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session));
1734
1735 HttpRequestInfo request;
1736 request.method = "GET";
1737 request.url = GURL("http://www.google.com/");
1738 request.load_flags = 0;
1739
1740 // fetch http://www.google.com/ via SPDY
1741 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST,
1742 false));
1743 MockWrite spdy_writes[] = { CreateMockWrite(*req) };
1744
1745 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1));
1746 scoped_ptr<spdy::SpdyFrame> data(ConstructSpdyBodyFrame(1, true));
1747 MockRead spdy_reads[] = {
1748 CreateMockRead(*resp),
1749 CreateMockRead(*data),
1750 MockRead(true, 0, 0),
1751 };
1752
1753 scoped_refptr<DelayedSocketData> spdy_data(
1754 new DelayedSocketData(
1755 1, // wait for one write to finish before reading.
1756 spdy_reads, arraysize(spdy_reads),
1757 spdy_writes, arraysize(spdy_writes)));
1758 session_deps.socket_factory.AddSocketDataProvider(spdy_data);
1759
1760 SSLSocketDataProvider ssl(true, OK);
1761 ssl.next_proto_status = SSLClientSocket::kNextProtoNegotiated;
1762 ssl.next_proto = "spdy/2";
1763 ssl.was_npn_negotiated = true;
1764 session_deps.socket_factory.AddSSLSocketDataProvider(&ssl);
1765
1766 TestCompletionCallback callback1;
1767
1768 int rv = trans->Start(&request, &callback1, log.bound());
1769 EXPECT_EQ(ERR_IO_PENDING, rv);
1770
1771 rv = callback1.WaitForResult();
1772 EXPECT_EQ(OK, rv);
1773
1774 const HttpResponseInfo* response = trans->GetResponseInfo();
1775 ASSERT_TRUE(response != NULL);
1776 ASSERT_TRUE(response->headers != NULL);
1777 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine());
1778
1779 std::string response_data;
1780 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data));
1781 EXPECT_EQ(net::kUploadData, response_data);
1782 }
1783
1725 // Test the challenge-response-retry sequence through an HTTPS Proxy 1784 // Test the challenge-response-retry sequence through an HTTPS Proxy
1726 TEST_F(HttpNetworkTransactionTest, HttpsProxyAuthRetry) { 1785 TEST_F(HttpNetworkTransactionTest, HttpsProxyAuthRetry) {
1727 // Configure against https proxy server "proxy:70". 1786 // Configure against https proxy server "proxy:70".
1728 SessionDependencies session_deps(CreateFixedProxyService("https://proxy:70")); 1787 SessionDependencies session_deps(CreateFixedProxyService("https://proxy:70"));
1729 CapturingBoundNetLog log(CapturingNetLog::kUnbounded); 1788 CapturingBoundNetLog log(CapturingNetLog::kUnbounded);
1730 session_deps.net_log = log.bound().net_log(); 1789 session_deps.net_log = log.bound().net_log();
1731 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); 1790 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps));
1732 1791
1733 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); 1792 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session));
1734 1793
(...skipping 5464 matching lines...) Expand 10 before | Expand all | Expand 10 after
7199 size_t pos = ExpectLogContainsSomewhere( 7258 size_t pos = ExpectLogContainsSomewhere(
7200 log.entries(), 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, 7259 log.entries(), 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
7201 NetLog::PHASE_NONE); 7260 NetLog::PHASE_NONE);
7202 ExpectLogContainsSomewhere( 7261 ExpectLogContainsSomewhere(
7203 log.entries(), pos, 7262 log.entries(), pos,
7204 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, 7263 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS,
7205 NetLog::PHASE_NONE); 7264 NetLog::PHASE_NONE);
7206 } 7265 }
7207 7266
7208 } // namespace net 7267 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/http/http_proxy_client_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698