Chromium Code Reviews| 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 for (const char* host : {"test.example.com:443"}) { |
| 163 HostPortPair::FromString("test.example.com:443"); | 163 params_.origins_to_force_quic_on.insert(HostPortPair::FromString(host)); |
|
Ryan Hamilton
2016/03/20 22:46:53
nit: do we really need a loop here?
ramant (doing other things)
2016/03/21 17:23:48
Done.
| |
| 164 } | |
| 164 | 165 |
| 165 transaction_factory_.reset(new TestTransactionFactory(params_)); | 166 transaction_factory_.reset(new TestTransactionFactory(params_)); |
| 166 } | 167 } |
| 167 | 168 |
| 168 void TearDown() override { | 169 void TearDown() override { |
| 169 StopServer(); | 170 StopServer(); |
| 170 QuicInMemoryCachePeer::ResetForTests(); | 171 QuicInMemoryCachePeer::ResetForTests(); |
| 171 } | 172 } |
| 172 | 173 |
| 173 // Starts the QUIC server listening on a random port. | 174 // 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(); | 374 base::MessageLoop::current()->Run(); |
| 374 | 375 |
| 375 for (size_t i = 0; i < num_requests; ++i) { | 376 for (size_t i = 0; i < num_requests; ++i) { |
| 376 CheckResponse(*consumers[i], "HTTP/1.1 200", kResponseBody); | 377 CheckResponse(*consumers[i], "HTTP/1.1 200", kResponseBody); |
| 377 } | 378 } |
| 378 STLDeleteElements(&consumers); | 379 STLDeleteElements(&consumers); |
| 379 } | 380 } |
| 380 | 381 |
| 381 } // namespace test | 382 } // namespace test |
| 382 } // namespace net | 383 } // namespace net |
| OLD | NEW |