Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Unified Diff: net/tools/quic/test_tools/server_thread.h

Issue 24493003: Factor out ServerThread from the QUIC EndToEndTest in order to reuse in (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comments Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/tools/quic/quic_in_memory_cache.cc ('k') | net/tools/quic/test_tools/server_thread.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..68cca7b15334f11f8bd61ec830c170217b8b34c9
--- /dev/null
+++ b/net/tools/quic/test_tools/server_thread.h
@@ -0,0 +1,48 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// 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_
« no previous file with comments | « net/tools/quic/quic_in_memory_cache.cc ('k') | net/tools/quic/test_tools/server_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698