OLD | NEW |
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 <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 2544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2555 ExpectLogContainsSomewhere( | 2555 ExpectLogContainsSomewhere( |
2556 entries, pos, | 2556 entries, pos, |
2557 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, | 2557 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, |
2558 NetLog::PHASE_NONE); | 2558 NetLog::PHASE_NONE); |
2559 | 2559 |
2560 const HttpResponseInfo* response = trans->GetResponseInfo(); | 2560 const HttpResponseInfo* response = trans->GetResponseInfo(); |
2561 ASSERT_TRUE(response); | 2561 ASSERT_TRUE(response); |
2562 ASSERT_TRUE(response->headers); | 2562 ASSERT_TRUE(response->headers); |
2563 EXPECT_TRUE(response->headers->IsKeepAlive()); | 2563 EXPECT_TRUE(response->headers->IsKeepAlive()); |
2564 EXPECT_EQ(407, response->headers->response_code()); | 2564 EXPECT_EQ(407, response->headers->response_code()); |
2565 EXPECT_EQ(-1, response->headers->GetContentLength()); | 2565 EXPECT_EQ(10, response->headers->GetContentLength()); |
2566 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); | 2566 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); |
2567 EXPECT_TRUE(CheckBasicProxyAuth(response->auth_challenge.get())); | 2567 EXPECT_TRUE(CheckBasicProxyAuth(response->auth_challenge.get())); |
2568 | 2568 |
2569 TestCompletionCallback callback2; | 2569 TestCompletionCallback callback2; |
2570 | 2570 |
2571 // Wrong password (should be "bar"). | 2571 // Wrong password (should be "bar"). |
2572 rv = trans->RestartWithAuth( | 2572 rv = trans->RestartWithAuth( |
2573 AuthCredentials(kFoo, kBaz), callback2.callback()); | 2573 AuthCredentials(kFoo, kBaz), callback2.callback()); |
2574 EXPECT_EQ(ERR_IO_PENDING, rv); | 2574 EXPECT_EQ(ERR_IO_PENDING, rv); |
2575 | 2575 |
2576 rv = callback2.WaitForResult(); | 2576 rv = callback2.WaitForResult(); |
2577 EXPECT_EQ(OK, rv); | 2577 EXPECT_EQ(OK, rv); |
2578 | 2578 |
2579 response = trans->GetResponseInfo(); | 2579 response = trans->GetResponseInfo(); |
2580 ASSERT_TRUE(response); | 2580 ASSERT_TRUE(response); |
2581 ASSERT_TRUE(response->headers); | 2581 ASSERT_TRUE(response->headers); |
2582 EXPECT_TRUE(response->headers->IsKeepAlive()); | 2582 EXPECT_TRUE(response->headers->IsKeepAlive()); |
2583 EXPECT_EQ(407, response->headers->response_code()); | 2583 EXPECT_EQ(407, response->headers->response_code()); |
2584 EXPECT_EQ(-1, response->headers->GetContentLength()); | 2584 EXPECT_EQ(10, response->headers->GetContentLength()); |
2585 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); | 2585 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); |
2586 EXPECT_TRUE(CheckBasicProxyAuth(response->auth_challenge.get())); | 2586 EXPECT_TRUE(CheckBasicProxyAuth(response->auth_challenge.get())); |
2587 | 2587 |
2588 // Flush the idle socket before the NetLog and HttpNetworkTransaction go | 2588 // Flush the idle socket before the NetLog and HttpNetworkTransaction go |
2589 // out of scope. | 2589 // out of scope. |
2590 session->CloseAllConnections(); | 2590 session->CloseAllConnections(); |
2591 } | 2591 } |
2592 | 2592 |
2593 // Test that we don't read the response body when we fail to establish a tunnel, | 2593 // Test that we don't read the response body when we fail to establish a tunnel, |
2594 // even if the user cancels the proxy's auth attempt. | 2594 // even if the user cancels the proxy's auth attempt. |
(...skipping 10958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13553 ASSERT_TRUE(response); | 13553 ASSERT_TRUE(response); |
13554 ASSERT_TRUE(response->headers.get()); | 13554 ASSERT_TRUE(response->headers.get()); |
13555 | 13555 |
13556 EXPECT_EQ(101, response->headers->response_code()); | 13556 EXPECT_EQ(101, response->headers->response_code()); |
13557 | 13557 |
13558 trans.reset(); | 13558 trans.reset(); |
13559 session->CloseAllConnections(); | 13559 session->CloseAllConnections(); |
13560 } | 13560 } |
13561 | 13561 |
13562 } // namespace net | 13562 } // namespace net |
OLD | NEW |