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

Unified Diff: net/quic/quic_protocol_test.cc

Issue 19858003: * Removed QuicTag kQuicVersion1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed comments from rch Created 7 years, 5 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/quic/quic_protocol.cc ('k') | net/quic/quic_stream_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_protocol_test.cc
diff --git a/net/quic/quic_protocol_test.cc b/net/quic/quic_protocol_test.cc
index 271cca61e3f7580c961ba599dcbaa4d4716c022e..842241fe4c0e436f45d69a66885f7ae5e080e33f 100644
--- a/net/quic/quic_protocol_test.cc
+++ b/net/quic/quic_protocol_test.cc
@@ -43,6 +43,71 @@ TEST(QuicProtocolTest, InsertMissingPacketsBetween) {
}
}
+TEST(QuicProtocolTest, QuicVersionToQuicTag) {
+ // If you add a new version to the QuicVersion enum you will need to add a new
+ // case to QuicVersionToQuicTag, otherwise this test will fail.
+
+ // Explicitly test a specific version.
+ EXPECT_EQ(MakeQuicTag('Q', '0', '0', '6'),
+ QuicVersionToQuicTag(QUIC_VERSION_6));
+
+ // Loop over all supported versions and make sure that we never hit the
+ // default case (i.e. all supported versions should be successfully converted
+ // to valid QuicTags).
+ for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) {
+ const QuicVersion& version = kSupportedQuicVersions[i];
+ EXPECT_LT(0u, QuicVersionToQuicTag(version));
+ }
+}
+
+TEST(QuicProtocolTest, QuicTagToQuicVersion) {
+ // If you add a new version to the QuicVersion enum you will need to add a new
+ // case to QuicTagToQuicVersion, otherwise this test will fail.
+
+ // Explicitly test specific versions.
+ EXPECT_EQ(QUIC_VERSION_6,
+ QuicTagToQuicVersion(MakeQuicTag('Q', '0', '0', '6')));
+ EXPECT_EQ(QUIC_VERSION_UNSUPPORTED,
+ QuicTagToQuicVersion(MakeQuicTag('F', 'A', 'K', 'E')));
+
+ // TODO(rtenneti): Enable checking of Log(ERROR) messages.
+#if 0
+ // Loop over all supported versions, and make sure we never hit the default
+ // case (which would result in a LOG(ERROR)).
+ ScopedMockLog log(kDoNotCaptureLogsYet);
+ EXPECT_CALL(log, Log(ERROR, _, _)).Times(0);
+ log.StartCapturingLogs();
+#endif
+
+ for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) {
+ const QuicVersion& version = kSupportedQuicVersions[i];
+
+ // Get the tag from the version (we can loop over QuicVersions easily).
+ QuicTag tag = QuicVersionToQuicTag(version);
+ EXPECT_LT(0u, tag);
+
+ // Now try converting back.
+ QuicVersion tag_to_quic_version = QuicTagToQuicVersion(tag);
+ EXPECT_EQ(version, tag_to_quic_version);
+ EXPECT_NE(QUIC_VERSION_UNSUPPORTED, tag_to_quic_version);
+ }
+}
+
+TEST(QuicProtocolTest, QuicVersionToString) {
+ EXPECT_EQ("QUIC_VERSION_6",
+ QuicVersionToString(QUIC_VERSION_6));
+ EXPECT_EQ("QUIC_VERSION_UNSUPPORTED",
+ QuicVersionToString(QUIC_VERSION_UNSUPPORTED));
+
+ QuicVersion single_version[] = {QUIC_VERSION_6};
+ EXPECT_EQ("QUIC_VERSION_6,", QuicVersionArrayToString(single_version,
+ arraysize(single_version)));
+ // QuicVersion multiple_versions[] = {QUIC_VERSION_7, QUIC_VERSION_6};
+ // EXPECT_EQ("QUIC_VERSION_7,QUIC_VERSION_6,",
+ // QuicVersionArrayToString(multiple_versions,
+ // arraysize(multiple_versions)));
+}
+
} // namespace
} // namespace test
} // namespace net
« no previous file with comments | « net/quic/quic_protocol.cc ('k') | net/quic/quic_stream_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698