| 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 <ostream> | 5 #include <ostream> |
| 6 #include <utility> | 6 #include <utility> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 StartServer(); | 152 StartServer(); |
| 153 | 153 |
| 154 // Use a mapped host resolver so that request for test.example.com (port 80) | 154 // Use a mapped host resolver so that request for test.example.com (port 80) |
| 155 // reach the server running on localhost. | 155 // reach the server running on localhost. |
| 156 std::string map_rule = "MAP test.example.com test.example.com:" + | 156 std::string map_rule = "MAP test.example.com test.example.com:" + |
| 157 base::IntToString(server_thread_->GetPort()); | 157 base::IntToString(server_thread_->GetPort()); |
| 158 EXPECT_TRUE(host_resolver_.AddRuleFromString(map_rule)); | 158 EXPECT_TRUE(host_resolver_.AddRuleFromString(map_rule)); |
| 159 | 159 |
| 160 // To simplify the test, and avoid the race with the HTTP request, we force | 160 // To simplify the test, and avoid the race with the HTTP request, we force |
| 161 // QUIC for these requests. | 161 // QUIC for these requests. |
| 162 params_.origin_to_force_quic_on = | 162 params_.origins_to_force_quic_on.insert( |
| 163 HostPortPair::FromString("test.example.com:443"); | 163 HostPortPair::FromString("test.example.com:443")); |
| 164 | 164 |
| 165 transaction_factory_.reset(new TestTransactionFactory(params_)); | 165 transaction_factory_.reset(new TestTransactionFactory(params_)); |
| 166 } | 166 } |
| 167 | 167 |
| 168 void TearDown() override { | 168 void TearDown() override { |
| 169 StopServer(); | 169 StopServer(); |
| 170 QuicInMemoryCachePeer::ResetForTests(); | 170 QuicInMemoryCachePeer::ResetForTests(); |
| 171 } | 171 } |
| 172 | 172 |
| 173 // Starts the QUIC server listening on a random port. | 173 // Starts the QUIC server listening on a random port. |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 base::MessageLoop::current()->Run(); | 373 base::MessageLoop::current()->Run(); |
| 374 | 374 |
| 375 for (size_t i = 0; i < num_requests; ++i) { | 375 for (size_t i = 0; i < num_requests; ++i) { |
| 376 CheckResponse(*consumers[i], "HTTP/1.1 200", kResponseBody); | 376 CheckResponse(*consumers[i], "HTTP/1.1 200", kResponseBody); |
| 377 } | 377 } |
| 378 STLDeleteElements(&consumers); | 378 STLDeleteElements(&consumers); |
| 379 } | 379 } |
| 380 | 380 |
| 381 } // namespace test | 381 } // namespace test |
| 382 } // namespace net | 382 } // namespace net |
| OLD | NEW |