| 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" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 // Get called from the EmbeddedTestServer thread to be notified that | 76 // Get called from the EmbeddedTestServer thread to be notified that |
| 77 // a connection was accepted. | 77 // a connection was accepted. |
| 78 void AcceptedSocket(const net::StreamSocket& connection) override { | 78 void AcceptedSocket(const net::StreamSocket& connection) override { |
| 79 base::AutoLock lock(lock_); | 79 base::AutoLock lock(lock_); |
| 80 ++socket_accepted_count_; | 80 ++socket_accepted_count_; |
| 81 task_runner_->PostTask(FROM_HERE, accept_loop_.QuitClosure()); | 81 task_runner_->PostTask(FROM_HERE, accept_loop_.QuitClosure()); |
| 82 } | 82 } |
| 83 | 83 |
| 84 // Get called from the EmbeddedTestServer thread to be notified that | 84 // Get called from the EmbeddedTestServer thread to be notified that |
| 85 // a connection was read from. | 85 // a connection was read from. |
| 86 void ReadFromSocket(const net::StreamSocket& connection) override { | 86 void ReadFromSocket(const net::StreamSocket& connection, int rv) override { |
| 87 base::AutoLock lock(lock_); | 87 base::AutoLock lock(lock_); |
| 88 did_read_from_socket_ = true; | 88 did_read_from_socket_ = true; |
| 89 } | 89 } |
| 90 | 90 |
| 91 void WaitUntilFirstConnectionAccepted() { accept_loop_.Run(); } | 91 void WaitUntilFirstConnectionAccepted() { accept_loop_.Run(); } |
| 92 | 92 |
| 93 size_t SocketAcceptedCount() const { | 93 size_t SocketAcceptedCount() const { |
| 94 base::AutoLock lock(lock_); | 94 base::AutoLock lock(lock_); |
| 95 return socket_accepted_count_; | 95 return socket_accepted_count_; |
| 96 } | 96 } |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 INSTANTIATE_TEST_CASE_P( | 593 INSTANTIATE_TEST_CASE_P( |
| 594 EmbeddedTestServerThreadingTestInstantiation, | 594 EmbeddedTestServerThreadingTestInstantiation, |
| 595 EmbeddedTestServerThreadingTest, | 595 EmbeddedTestServerThreadingTest, |
| 596 testing::Combine(testing::Bool(), | 596 testing::Combine(testing::Bool(), |
| 597 testing::Bool(), | 597 testing::Bool(), |
| 598 testing::Values(EmbeddedTestServer::TYPE_HTTP, | 598 testing::Values(EmbeddedTestServer::TYPE_HTTP, |
| 599 EmbeddedTestServer::TYPE_HTTPS))); | 599 EmbeddedTestServer::TYPE_HTTPS))); |
| 600 | 600 |
| 601 } // namespace test_server | 601 } // namespace test_server |
| 602 } // namespace net | 602 } // namespace net |
| OLD | NEW |