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