summaryrefslogtreecommitdiffstats
path: root/net/tools
diff options
context:
space:
mode:
authorrtenneti <rtenneti@chromium.org>2015-02-27 19:39:41 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-28 03:41:52 +0000
commit3183ac4cda7d296f8f59a658a1aca3ed961d76f3 (patch)
tree2bd070a1c835b114b43ca95bd26d9c2b46f6c848 /net/tools
parent99c214e2f73f3edf2e56050961443c66a5302e28 (diff)
downloadchromium_src-3183ac4cda7d296f8f59a658a1aca3ed961d76f3.zip
chromium_src-3183ac4cda7d296f8f59a658a1aca3ed961d76f3.tar.gz
chromium_src-3183ac4cda7d296f8f59a658a1aca3ed961d76f3.tar.bz2
Land Recent QUIC Changes until 2/21/2015.
QUIC - use a range-based for loops. Sync'ing with the internal tree. Merge internal change: 86845495 https://codereview.chromium.org/963333002/ Deprecate FLAGS_quic_record_send_time_before_write. Merge internal change: 86804950 https://codereview.chromium.org/965873004/ QuicConnection no longer owns the debug visitor. No behavior change. The visitor_ isn't owned by the connection, this makes the debug_visitor_ ownership model the same. Merge internal change: 86801250 https://codereview.chromium.org/961173003/ Cleanup of QUIC's TransmissionInfo constructor to make more fields const and supply them in the constructor. No functional change. Merge internal change: 86734009 https://codereview.chromium.org/968493002/ Fixing a bug in the QUIC prober where if we received a GOAWAY before stream creation it would result in a crash. I verified that given our improper client, the prober would crash as-was, and would fail cleanly with the nullptr check but the client not ignoring goaways. Test changes and quic server changes. Merge internal change: 86703503 https://codereview.chromium.org/965943002/ Remove dead method QuicUnackedPacketMap::RestoreInFlight. Merge internal change: 86690324 https://codereview.chromium.org/960913004/ Deprecating FLAGS_quic_attach_ack_notifiers_to_packets. Merge internal change: 86688595 https://codereview.chromium.org/969443002/ Remove RevertRetransmissionTimeout from QUIC's SendAlgorithmInterface now that it's no longer used by QuicSentPacketManager. Merge internal change: 86651704 https://codereview.chromium.org/963293002/ Remove stats for recording reno vs cubic mode in internal server's varz. Removed now that we know how much cubic mode is in play. Merge internal change: 86629919 https://codereview.chromium.org/964483005/ R=rch@chromium.org Review URL: https://codereview.chromium.org/968513002 Cr-Commit-Position: refs/heads/master@{#318588}
Diffstat (limited to 'net/tools')
-rw-r--r--net/tools/quic/end_to_end_test.cc3
-rw-r--r--net/tools/quic/quic_server.h2
-rw-r--r--net/tools/quic/test_tools/quic_test_server.cc69
-rw-r--r--net/tools/quic/test_tools/quic_test_server.h51
4 files changed, 122 insertions, 3 deletions
diff --git a/net/tools/quic/end_to_end_test.cc b/net/tools/quic/end_to_end_test.cc
index 9e7605f..2478b84 100644
--- a/net/tools/quic/end_to_end_test.cc
+++ b/net/tools/quic/end_to_end_test.cc
@@ -1406,9 +1406,6 @@ TEST_P(EndToEndTest, AckNotifierWithPacketLossAndBlockedSocket) {
// socket, an AckNotifierDelegate will get informed that the data it is
// interested in has been ACKed. This tests end-to-end ACK notification, and
// demonstrates that retransmissions do not break this functionality.
- ValueRestore<bool> old_flag(&FLAGS_quic_attach_ack_notifiers_to_packets,
- true);
-
SetPacketLossPercentage(5);
ASSERT_TRUE(Initialize());
diff --git a/net/tools/quic/quic_server.h b/net/tools/quic/quic_server.h
index f8a5533..31e5988 100644
--- a/net/tools/quic/quic_server.h
+++ b/net/tools/quic/quic_server.h
@@ -90,6 +90,8 @@ class QuicServer : public EpollCallbackInterface {
}
EpollServer* epoll_server() { return &epoll_server_; }
+ QuicDispatcher* dispatcher() { return dispatcher_.get(); }
+
private:
friend class net::tools::test::QuicServerPeer;
diff --git a/net/tools/quic/test_tools/quic_test_server.cc b/net/tools/quic/test_tools/quic_test_server.cc
new file mode 100644
index 0000000..3d6c247
--- /dev/null
+++ b/net/tools/quic/test_tools/quic_test_server.cc
@@ -0,0 +1,69 @@
+// Copyright 2015 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.
+
+#include "net/tools/quic/test_tools/quic_test_server.h"
+
+namespace net {
+
+namespace tools {
+
+namespace test {
+
+class QuicTestDispatcher : public QuicDispatcher {
+ public:
+ QuicTestDispatcher(const QuicConfig& config,
+ const QuicCryptoServerConfig& crypto_config,
+ const QuicVersionVector& versions,
+ PacketWriterFactory* factory,
+ EpollServer* eps)
+ : QuicDispatcher(config, crypto_config, versions, factory, eps) {}
+ QuicSession* CreateQuicSession(QuicConnectionId id,
+ const IPEndPoint& server,
+ const IPEndPoint& client) override {
+ if (session_creator_ == nullptr) {
+ return QuicDispatcher::CreateQuicSession(id, server, client);
+ } else {
+ QuicConnection* connection = CreateQuicConnection(id, server, client);
+ QuicServerSession* session =
+ (session_creator_)(config(), connection, this);
+ session->InitializeSession(crypto_config());
+ return session;
+ }
+ }
+
+ void set_session_creator(
+ const QuicTestServer::SessionCreationFunction& function) {
+ session_creator_ = function;
+ }
+
+ private:
+ QuicTestServer::SessionCreationFunction session_creator_;
+};
+
+QuicDispatcher* QuicTestServer::CreateQuicDispatcher() {
+ return new QuicTestDispatcher(
+ config(), crypto_config(), supported_versions(),
+ new QuicDispatcher::DefaultPacketWriterFactory(), epoll_server());
+}
+
+void QuicTestServer::SetSessionCreator(
+ const SessionCreationFunction& function) {
+ static_cast<QuicTestDispatcher*>(dispatcher())->set_session_creator(function);
+}
+
+/////////////////////////// TEST SESSIONS ///////////////////////////////
+
+ImmediateGoAwaySession::ImmediateGoAwaySession(
+ const QuicConfig& config,
+ QuicConnection* connection,
+ QuicServerSessionVisitor* visitor)
+ : QuicServerSession(config, connection, visitor) {
+ SendGoAway(QUIC_PEER_GOING_AWAY, "");
+}
+
+} // namespace test
+
+} // namespace tools
+
+} // namespace net
diff --git a/net/tools/quic/test_tools/quic_test_server.h b/net/tools/quic/test_tools/quic_test_server.h
new file mode 100644
index 0000000..1e56e43
--- /dev/null
+++ b/net/tools/quic/test_tools/quic_test_server.h
@@ -0,0 +1,51 @@
+// Copyright 2015 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_TEST_TOOLS_QUIC_TEST_SERVER_H_
+#define NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_SERVER_H_
+
+#include "net/tools/quic/quic_dispatcher.h"
+#include "net/tools/quic/quic_server.h"
+#include "net/tools/quic/quic_server_session.h"
+
+namespace net {
+
+namespace tools {
+
+namespace test {
+
+// A test server which enables easy creation of custom QuicServerSessions
+//
+// Eventually this may be extended to allow custom QuicConnections etc.
+class QuicTestServer : public QuicServer {
+ public:
+ typedef std::function<QuicServerSession*(const QuicConfig& config,
+ QuicConnection* connection,
+ QuicServerSessionVisitor* visitor)>
+ SessionCreationFunction;
+
+ // Create a custom dispatcher which creates custom sessions.
+ QuicDispatcher* CreateQuicDispatcher() override;
+
+ void SetSessionCreator(const SessionCreationFunction& function);
+};
+
+// Useful test sessions for the QuicTestServer.
+
+// Test session which sends a GOAWAY immedaitely on creation, before crypto
+// credentials have even been established.
+class ImmediateGoAwaySession : public QuicServerSession {
+ public:
+ ImmediateGoAwaySession(const QuicConfig& config,
+ QuicConnection* connection,
+ QuicServerSessionVisitor* visitor);
+};
+
+} // namespace test
+
+} // namespace tools
+
+} // namespace net
+
+#endif // NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_SERVER_H_