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/spdy/spdy_proxy_client_socket.h" | 5 #include "net/spdy/spdy_proxy_client_socket.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "net/base/address_list.h" | 10 #include "net/base/address_list.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "net/socket/next_proto.h" | 21 #include "net/socket/next_proto.h" |
22 #include "net/socket/socket_test_util.h" | 22 #include "net/socket/socket_test_util.h" |
23 #include "net/socket/tcp_client_socket.h" | 23 #include "net/socket/tcp_client_socket.h" |
24 #include "net/spdy/buffered_spdy_framer.h" | 24 #include "net/spdy/buffered_spdy_framer.h" |
25 #include "net/spdy/spdy_http_utils.h" | 25 #include "net/spdy/spdy_http_utils.h" |
26 #include "net/spdy/spdy_protocol.h" | 26 #include "net/spdy/spdy_protocol.h" |
27 #include "net/spdy/spdy_session_pool.h" | 27 #include "net/spdy/spdy_session_pool.h" |
28 #include "net/spdy/spdy_test_util_common.h" | 28 #include "net/spdy/spdy_test_util_common.h" |
29 #include "testing/gtest/include/gtest/gtest.h" | 29 #include "testing/gtest/include/gtest/gtest.h" |
30 #include "testing/platform_test.h" | 30 #include "testing/platform_test.h" |
| 31 #include "url/origin.h" |
31 | 32 |
32 //----------------------------------------------------------------------------- | 33 //----------------------------------------------------------------------------- |
33 | 34 |
34 namespace { | 35 namespace { |
35 | 36 |
36 static const char kRequestUrl[] = "https://www.google.com/"; | 37 static const char kRequestUrl[] = "https://www.google.com/"; |
37 static const char kOriginHost[] = "www.google.com"; | 38 static const char kOriginHost[] = "www.google.com"; |
38 static const int kOriginPort = 443; | 39 static const int kOriginPort = 443; |
39 static const char kOriginHostPort[] = "www.google.com:443"; | 40 static const char kOriginHostPort[] = "www.google.com:443"; |
40 static const char kProxyUrl[] = "https://myproxy:6121/"; | 41 static const char kProxyUrl[] = "https://myproxy:6121/"; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 void AssertReadReturns(const char* data, int len); | 92 void AssertReadReturns(const char* data, int len); |
92 void AssertAsyncWriteSucceeds(const char* data, int len); | 93 void AssertAsyncWriteSucceeds(const char* data, int len); |
93 void AssertWriteReturns(const char* data, int len, int rv); | 94 void AssertWriteReturns(const char* data, int len, int rv); |
94 void AssertWriteLength(int len); | 95 void AssertWriteLength(int len); |
95 void AssertAsyncWriteWithReadsSucceeds(const char* data, int len, | 96 void AssertAsyncWriteWithReadsSucceeds(const char* data, int len, |
96 int num_reads); | 97 int num_reads); |
97 | 98 |
98 void AddAuthToCache() { | 99 void AddAuthToCache() { |
99 const base::string16 kFoo(base::ASCIIToUTF16("foo")); | 100 const base::string16 kFoo(base::ASCIIToUTF16("foo")); |
100 const base::string16 kBar(base::ASCIIToUTF16("bar")); | 101 const base::string16 kBar(base::ASCIIToUTF16("bar")); |
101 session_->http_auth_cache()->Add(GURL(kProxyUrl), | 102 session_->http_auth_cache()->Add( |
102 "MyRealm1", | 103 url::Origin(kProxyUrl), "MyRealm1", HttpAuth::AUTH_SCHEME_BASIC, |
103 HttpAuth::AUTH_SCHEME_BASIC, | 104 "Basic realm=MyRealm1", AuthCredentials(kFoo, kBar), "/"); |
104 "Basic realm=MyRealm1", | |
105 AuthCredentials(kFoo, kBar), | |
106 "/"); | |
107 } | 105 } |
108 | 106 |
109 void Run(int steps) { | 107 void Run(int steps) { |
110 data_->StopAfter(steps); | 108 data_->StopAfter(steps); |
111 data_->Run(); | 109 data_->Run(); |
112 } | 110 } |
113 | 111 |
114 void CloseSpdySession(Error error, const std::string& description) { | 112 void CloseSpdySession(Error error, const std::string& description) { |
115 spdy_session_->CloseSessionOnError(error, description); | 113 spdy_session_->CloseSessionOnError(error, description); |
116 } | 114 } |
(...skipping 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1373 | 1371 |
1374 EXPECT_FALSE(sock_.get()); | 1372 EXPECT_FALSE(sock_.get()); |
1375 EXPECT_TRUE(read_callback.have_result()); | 1373 EXPECT_TRUE(read_callback.have_result()); |
1376 EXPECT_FALSE(write_callback_.have_result()); | 1374 EXPECT_FALSE(write_callback_.have_result()); |
1377 | 1375 |
1378 // Let the RST_STREAM write while |rst| is in-scope. | 1376 // Let the RST_STREAM write while |rst| is in-scope. |
1379 base::MessageLoop::current()->RunUntilIdle(); | 1377 base::MessageLoop::current()->RunUntilIdle(); |
1380 } | 1378 } |
1381 | 1379 |
1382 } // namespace net | 1380 } // namespace net |
OLD | NEW |