| 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 8493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8504 | 8504 |
| 8505 std::string response_data; | 8505 std::string response_data; |
| 8506 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); | 8506 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
| 8507 EXPECT_EQ("hello world", response_data); | 8507 EXPECT_EQ("hello world", response_data); |
| 8508 | 8508 |
| 8509 ASSERT_TRUE(http_server_properties->HasAlternateProtocol( | 8509 ASSERT_TRUE(http_server_properties->HasAlternateProtocol( |
| 8510 HostPortPair::FromURL(request.url))); | 8510 HostPortPair::FromURL(request.url))); |
| 8511 const AlternateProtocolInfo alternate = | 8511 const AlternateProtocolInfo alternate = |
| 8512 http_server_properties->GetAlternateProtocol( | 8512 http_server_properties->GetAlternateProtocol( |
| 8513 HostPortPair::FromURL(request.url)); | 8513 HostPortPair::FromURL(request.url)); |
| 8514 EXPECT_EQ(ALTERNATE_PROTOCOL_BROKEN, alternate.protocol); | 8514 EXPECT_TRUE(alternate.is_broken); |
| 8515 } | 8515 } |
| 8516 | 8516 |
| 8517 TEST_P(HttpNetworkTransactionTest, | 8517 TEST_P(HttpNetworkTransactionTest, |
| 8518 AlternateProtocolPortRestrictedBlocked) { | 8518 AlternateProtocolPortRestrictedBlocked) { |
| 8519 // Ensure that we're not allowed to redirect traffic via an alternate | 8519 // Ensure that we're not allowed to redirect traffic via an alternate |
| 8520 // protocol to an unrestricted (port >= 1024) when the original traffic was | 8520 // protocol to an unrestricted (port >= 1024) when the original traffic was |
| 8521 // on a restricted port (port < 1024). Ensure that we can redirect in all | 8521 // on a restricted port (port < 1024). Ensure that we can redirect in all |
| 8522 // other cases. | 8522 // other cases. |
| 8523 session_deps_.use_alternate_protocols = true; | 8523 session_deps_.use_alternate_protocols = true; |
| 8524 | 8524 |
| (...skipping 4652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13177 EXPECT_EQ(ERR_IO_PENDING, rv); | 13177 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 13178 | 13178 |
| 13179 rv = callback.WaitForResult(); | 13179 rv = callback.WaitForResult(); |
| 13180 EXPECT_EQ(ERR_CONNECTION_RESET, rv); | 13180 EXPECT_EQ(ERR_CONNECTION_RESET, rv); |
| 13181 | 13181 |
| 13182 const HttpResponseInfo* response = trans->GetResponseInfo(); | 13182 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 13183 EXPECT_TRUE(response == NULL); | 13183 EXPECT_TRUE(response == NULL); |
| 13184 } | 13184 } |
| 13185 | 13185 |
| 13186 } // namespace net | 13186 } // namespace net |
| OLD | NEW |