OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/test/embedded_test_server/embedded_test_server.h" | 5 #include "net/test/embedded_test_server/embedded_test_server.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
15 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
16 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
17 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
18 #include "crypto/nss_util.h" | 18 #include "crypto/nss_util.h" |
19 #include "net/base/test_completion_callback.h" | 19 #include "net/base/test_completion_callback.h" |
20 #include "net/http/http_response_headers.h" | 20 #include "net/http/http_response_headers.h" |
| 21 #include "net/log/net_log_source.h" |
21 #include "net/log/test_net_log.h" | 22 #include "net/log/test_net_log.h" |
22 #include "net/socket/client_socket_factory.h" | 23 #include "net/socket/client_socket_factory.h" |
23 #include "net/socket/stream_socket.h" | 24 #include "net/socket/stream_socket.h" |
24 #include "net/test/embedded_test_server/embedded_test_server_connection_listener
.h" | 25 #include "net/test/embedded_test_server/embedded_test_server_connection_listener
.h" |
25 #include "net/test/embedded_test_server/http_request.h" | 26 #include "net/test/embedded_test_server/http_request.h" |
26 #include "net/test/embedded_test_server/http_response.h" | 27 #include "net/test/embedded_test_server/http_response.h" |
27 #include "net/test/embedded_test_server/request_handler_util.h" | 28 #include "net/test/embedded_test_server/request_handler_util.h" |
28 #include "net/test/gtest_util.h" | 29 #include "net/test/gtest_util.h" |
29 #include "net/url_request/url_fetcher.h" | 30 #include "net/url_request/url_fetcher.h" |
30 #include "net/url_request/url_fetcher_delegate.h" | 31 #include "net/url_request/url_fetcher_delegate.h" |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 | 297 |
297 TEST_P(EmbeddedTestServerTest, ConnectionListenerAccept) { | 298 TEST_P(EmbeddedTestServerTest, ConnectionListenerAccept) { |
298 ASSERT_TRUE(server_->Start()); | 299 ASSERT_TRUE(server_->Start()); |
299 | 300 |
300 TestNetLog net_log; | 301 TestNetLog net_log; |
301 net::AddressList address_list; | 302 net::AddressList address_list; |
302 EXPECT_TRUE(server_->GetAddressList(&address_list)); | 303 EXPECT_TRUE(server_->GetAddressList(&address_list)); |
303 | 304 |
304 std::unique_ptr<StreamSocket> socket = | 305 std::unique_ptr<StreamSocket> socket = |
305 ClientSocketFactory::GetDefaultFactory()->CreateTransportClientSocket( | 306 ClientSocketFactory::GetDefaultFactory()->CreateTransportClientSocket( |
306 address_list, NULL, &net_log, NetLog::Source()); | 307 address_list, NULL, &net_log, NetLogSource()); |
307 TestCompletionCallback callback; | 308 TestCompletionCallback callback; |
308 ASSERT_THAT(callback.GetResult(socket->Connect(callback.callback())), IsOk()); | 309 ASSERT_THAT(callback.GetResult(socket->Connect(callback.callback())), IsOk()); |
309 | 310 |
310 connection_listener_.WaitUntilFirstConnectionAccepted(); | 311 connection_listener_.WaitUntilFirstConnectionAccepted(); |
311 | 312 |
312 EXPECT_EQ(1u, connection_listener_.SocketAcceptedCount()); | 313 EXPECT_EQ(1u, connection_listener_.SocketAcceptedCount()); |
313 EXPECT_FALSE(connection_listener_.DidReadFromSocket()); | 314 EXPECT_FALSE(connection_listener_.DidReadFromSocket()); |
314 } | 315 } |
315 | 316 |
316 TEST_P(EmbeddedTestServerTest, ConnectionListenerRead) { | 317 TEST_P(EmbeddedTestServerTest, ConnectionListenerRead) { |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 INSTANTIATE_TEST_CASE_P( | 598 INSTANTIATE_TEST_CASE_P( |
598 EmbeddedTestServerThreadingTestInstantiation, | 599 EmbeddedTestServerThreadingTestInstantiation, |
599 EmbeddedTestServerThreadingTest, | 600 EmbeddedTestServerThreadingTest, |
600 testing::Combine(testing::Bool(), | 601 testing::Combine(testing::Bool(), |
601 testing::Bool(), | 602 testing::Bool(), |
602 testing::Values(EmbeddedTestServer::TYPE_HTTP, | 603 testing::Values(EmbeddedTestServer::TYPE_HTTP, |
603 EmbeddedTestServer::TYPE_HTTPS))); | 604 EmbeddedTestServer::TYPE_HTTPS))); |
604 | 605 |
605 } // namespace test_server | 606 } // namespace test_server |
606 } // namespace net | 607 } // namespace net |
OLD | NEW |