| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 net::QuicConfig config; | 97 net::QuicConfig config; |
| 98 // Set up server certs. | 98 // Set up server certs. |
| 99 std::unique_ptr<net::ProofSourceChromium> proof_source( | 99 std::unique_ptr<net::ProofSourceChromium> proof_source( |
| 100 new net::ProofSourceChromium()); | 100 new net::ProofSourceChromium()); |
| 101 base::FilePath directory = GetTestCertsDirectory(); | 101 base::FilePath directory = GetTestCertsDirectory(); |
| 102 CHECK(proof_source->Initialize( | 102 CHECK(proof_source->Initialize( |
| 103 directory.Append(FILE_PATH_LITERAL("quic_test.example.com.crt")), | 103 directory.Append(FILE_PATH_LITERAL("quic_test.example.com.crt")), |
| 104 directory.Append(FILE_PATH_LITERAL("quic_test.example.com.key.pkcs8")), | 104 directory.Append(FILE_PATH_LITERAL("quic_test.example.com.key.pkcs8")), |
| 105 directory.Append(FILE_PATH_LITERAL("quic_test.example.com.key.sct")))); | 105 directory.Append(FILE_PATH_LITERAL("quic_test.example.com.key.sct")))); |
| 106 server_.reset(new QuicSimpleServer( | 106 server_.reset(new QuicSimpleServer( |
| 107 test::CryptoTestUtils::ProofSourceForTesting(), config, | 107 test::crypto_test_utils::ProofSourceForTesting(), config, |
| 108 net::QuicCryptoServerConfig::ConfigOptions(), AllSupportedVersions(), | 108 net::QuicCryptoServerConfig::ConfigOptions(), AllSupportedVersions(), |
| 109 &response_cache_)); | 109 &response_cache_)); |
| 110 int rv = server_->Listen( | 110 int rv = server_->Listen( |
| 111 net::IPEndPoint(net::IPAddress::IPv4AllZeros(), kTestServerPort)); | 111 net::IPEndPoint(net::IPAddress::IPv4AllZeros(), kTestServerPort)); |
| 112 EXPECT_GE(rv, 0) << "Quic server fails to start"; | 112 EXPECT_GE(rv, 0) << "Quic server fails to start"; |
| 113 | 113 |
| 114 std::unique_ptr<MockHostResolver> resolver(new MockHostResolver()); | 114 std::unique_ptr<MockHostResolver> resolver(new MockHostResolver()); |
| 115 resolver->rules()->AddRule("test.example.com", "127.0.0.1"); | 115 resolver->rules()->AddRule("test.example.com", "127.0.0.1"); |
| 116 host_resolver_.reset(new MappedHostResolver(std::move(resolver))); | 116 host_resolver_.reset(new MappedHostResolver(std::move(resolver))); |
| 117 // Use a mapped host resolver so that request for test.example.com (port 80) | 117 // Use a mapped host resolver so that request for test.example.com (port 80) |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 ASSERT_TRUE(request2->is_pending()); | 237 ASSERT_TRUE(request2->is_pending()); |
| 238 run_loop.Run(); | 238 run_loop.Run(); |
| 239 | 239 |
| 240 EXPECT_TRUE(request->status().is_success()); | 240 EXPECT_TRUE(request->status().is_success()); |
| 241 EXPECT_TRUE(request2->status().is_success()); | 241 EXPECT_TRUE(request2->status().is_success()); |
| 242 EXPECT_EQ(kHelloBodyValue, delegate.data_received()); | 242 EXPECT_EQ(kHelloBodyValue, delegate.data_received()); |
| 243 EXPECT_EQ(kHelloBodyValue, delegate2.data_received()); | 243 EXPECT_EQ(kHelloBodyValue, delegate2.data_received()); |
| 244 } | 244 } |
| 245 | 245 |
| 246 } // namespace net | 246 } // namespace net |
| OLD | NEW |