Chromium Code Reviews| Index: net/tools/quic/test_tools/server_thread.h |
| diff --git a/net/tools/quic/test_tools/server_thread.h b/net/tools/quic/test_tools/server_thread.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6605df23d4e5b9c4064ba7ba39a0091bc13da83f |
| --- /dev/null |
| +++ b/net/tools/quic/test_tools/server_thread.h |
| @@ -0,0 +1,48 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
|
ramant (doing other things)
2013/09/25 14:39:12
nit: consider changing 2012 to 2013.
Ryan Hamilton
2013/09/25 23:29:36
Done.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef NET_TOOLS_QUIC_SERVER_THREAD_H_ |
| +#define NET_TOOLS_QUIC_SERVER_THREAD_H_ |
| + |
| +#include "base/threading/simple_thread.h" |
| +#include "net/base/ip_endpoint.h" |
| +#include "net/quic/quic_config.h" |
| +#include "net/tools/quic/quic_server.h" |
| + |
| +namespace net { |
| +namespace tools { |
| +namespace test { |
| + |
| +// Simple wrapper class to run server in a thread. |
| +class ServerThread : public base::SimpleThread { |
| + public: |
| + ServerThread(IPEndPoint address, |
| + const QuicConfig& config, |
| + bool strike_register_no_startup_period); |
| + |
| + virtual ~ServerThread(); |
| + |
| + virtual void Run() OVERRIDE; |
| + |
| + int GetPort(); |
| + |
| + base::WaitableEvent* listening() { return &listening_; } |
| + base::WaitableEvent* quit() { return &quit_; } |
| + |
| + private: |
| + base::WaitableEvent listening_; |
| + base::WaitableEvent quit_; |
| + base::Lock port_lock_; |
| + tools::QuicServer server_; |
| + IPEndPoint address_; |
| + int port_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ServerThread); |
| +}; |
| + |
| +} // namespace test |
| +} // namespace tools |
| +} // namespace net |
| + |
| +#endif // NET_TOOLS_QUIC_SERVER_THREAD_H_ |