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

Unified Diff: net/quic/core/crypto/quic_crypto_client_config_test.cc

Issue 2848203002: Add a platform implementation of QuicTest and QuicTestWithParam (Closed)
Patch Set: net/quic/platform/impl/quic_test_impl.cc Created 3 years, 8 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
Index: net/quic/core/crypto/quic_crypto_client_config_test.cc
diff --git a/net/quic/core/crypto/quic_crypto_client_config_test.cc b/net/quic/core/crypto/quic_crypto_client_config_test.cc
index c38d80583967896a32d7c6328fcf3d616a4acde9..54bc6e18893a30aa328f2159305528709f28038e 100644
--- a/net/quic/core/crypto/quic_crypto_client_config_test.cc
+++ b/net/quic/core/crypto/quic_crypto_client_config_test.cc
@@ -8,10 +8,10 @@
#include "net/quic/core/quic_server_id.h"
#include "net/quic/core/quic_utils.h"
#include "net/quic/platform/api/quic_endian.h"
+#include "net/quic/platform/api/quic_test.h"
#include "net/quic/test_tools/crypto_test_utils.h"
#include "net/quic/test_tools/mock_random.h"
#include "net/quic/test_tools/quic_test_utils.h"
-#include "testing/gtest/include/gtest/gtest.h"
using std::string;
@@ -47,24 +47,26 @@ class AllServerIdsFilter : public QuicCryptoClientConfig::ServerIdFilter {
} // namespace
-TEST(QuicCryptoClientConfigTest, CachedState_IsEmpty) {
+class QuicCryptoClientConfigTest : public QuicTest {};
+
+TEST_F(QuicCryptoClientConfigTest, CachedState_IsEmpty) {
QuicCryptoClientConfig::CachedState state;
EXPECT_TRUE(state.IsEmpty());
}
-TEST(QuicCryptoClientConfigTest, CachedState_IsComplete) {
+TEST_F(QuicCryptoClientConfigTest, CachedState_IsComplete) {
QuicCryptoClientConfig::CachedState state;
EXPECT_FALSE(state.IsComplete(QuicWallTime::FromUNIXSeconds(0)));
}
-TEST(QuicCryptoClientConfigTest, CachedState_GenerationCounter) {
+TEST_F(QuicCryptoClientConfigTest, CachedState_GenerationCounter) {
QuicCryptoClientConfig::CachedState state;
EXPECT_EQ(0u, state.generation_counter());
state.SetProofInvalid();
EXPECT_EQ(1u, state.generation_counter());
}
-TEST(QuicCryptoClientConfigTest, CachedState_SetProofVerifyDetails) {
+TEST_F(QuicCryptoClientConfigTest, CachedState_SetProofVerifyDetails) {
QuicCryptoClientConfig::CachedState state;
EXPECT_TRUE(state.proof_verify_details() == nullptr);
ProofVerifyDetails* details = new TestProofVerifyDetails;
@@ -72,7 +74,7 @@ TEST(QuicCryptoClientConfigTest, CachedState_SetProofVerifyDetails) {
EXPECT_EQ(details, state.proof_verify_details());
}
-TEST(QuicCryptoClientConfigTest, CachedState_ServerDesignatedConnectionId) {
+TEST_F(QuicCryptoClientConfigTest, CachedState_ServerDesignatedConnectionId) {
QuicCryptoClientConfig::CachedState state;
EXPECT_FALSE(state.has_server_designated_connection_id());
@@ -103,7 +105,7 @@ TEST(QuicCryptoClientConfigTest, CachedState_ServerDesignatedConnectionId) {
EXPECT_EQ(second_cid, state.GetNextServerDesignatedConnectionId());
}
-TEST(QuicCryptoClientConfigTest, CachedState_ServerIdConsumedBeforeSet) {
+TEST_F(QuicCryptoClientConfigTest, CachedState_ServerIdConsumedBeforeSet) {
QuicCryptoClientConfig::CachedState state;
EXPECT_FALSE(state.has_server_designated_connection_id());
#if GTEST_HAS_DEATH_TEST && !defined(NDEBUG)
@@ -113,7 +115,7 @@ TEST(QuicCryptoClientConfigTest, CachedState_ServerIdConsumedBeforeSet) {
#endif // GTEST_HAS_DEATH_TEST && !defined(NDEBUG)
}
-TEST(QuicCryptoClientConfigTest, CachedState_ServerNonce) {
+TEST_F(QuicCryptoClientConfigTest, CachedState_ServerNonce) {
QuicCryptoClientConfig::CachedState state;
EXPECT_FALSE(state.has_server_nonce());
@@ -144,7 +146,7 @@ TEST(QuicCryptoClientConfigTest, CachedState_ServerNonce) {
EXPECT_EQ(second_nonce, state.GetNextServerNonce());
}
-TEST(QuicCryptoClientConfigTest, CachedState_ServerNonceConsumedBeforeSet) {
+TEST_F(QuicCryptoClientConfigTest, CachedState_ServerNonceConsumedBeforeSet) {
QuicCryptoClientConfig::CachedState state;
EXPECT_FALSE(state.has_server_nonce());
#if GTEST_HAS_DEATH_TEST && !defined(NDEBUG)
@@ -154,7 +156,7 @@ TEST(QuicCryptoClientConfigTest, CachedState_ServerNonceConsumedBeforeSet) {
#endif // GTEST_HAS_DEATH_TEST && !defined(NDEBUG)
}
-TEST(QuicCryptoClientConfigTest, CachedState_InitializeFrom) {
+TEST_F(QuicCryptoClientConfigTest, CachedState_InitializeFrom) {
QuicCryptoClientConfig::CachedState state;
QuicCryptoClientConfig::CachedState other;
state.set_source_address_token("TOKEN");
@@ -168,7 +170,7 @@ TEST(QuicCryptoClientConfigTest, CachedState_InitializeFrom) {
EXPECT_FALSE(state.has_server_nonce());
}
-TEST(QuicCryptoClientConfigTest, InchoateChlo) {
+TEST_F(QuicCryptoClientConfigTest, InchoateChlo) {
QuicCryptoClientConfig::CachedState state;
QuicCryptoClientConfig config(crypto_test_utils::ProofVerifierForTesting());
QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> params(
@@ -187,7 +189,7 @@ TEST(QuicCryptoClientConfigTest, InchoateChlo) {
EXPECT_EQ(string(32, 'r'), proof_nonce);
}
-TEST(QuicCryptoClientConfigTest, PreferAesGcm) {
+TEST_F(QuicCryptoClientConfigTest, PreferAesGcm) {
QuicCryptoClientConfig config(crypto_test_utils::ProofVerifierForTesting());
if (config.aead.size() > 1)
EXPECT_NE(kAESG, config.aead[0]);
@@ -195,7 +197,7 @@ TEST(QuicCryptoClientConfigTest, PreferAesGcm) {
EXPECT_EQ(kAESG, config.aead[0]);
}
-TEST(QuicCryptoClientConfigTest, InchoateChloSecure) {
+TEST_F(QuicCryptoClientConfigTest, InchoateChloSecure) {
QuicCryptoClientConfig::CachedState state;
QuicCryptoClientConfig config(crypto_test_utils::ProofVerifierForTesting());
QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> params(
@@ -213,7 +215,7 @@ TEST(QuicCryptoClientConfigTest, InchoateChloSecure) {
EXPECT_FALSE(msg.GetStringPiece(kSCID, &scid));
}
-TEST(QuicCryptoClientConfigTest, InchoateChloSecureWithSCIDNoEXPY) {
+TEST_F(QuicCryptoClientConfigTest, InchoateChloSecureWithSCIDNoEXPY) {
// Test that a config with no EXPY is still valid when a non-zero
// expiry time is passed in.
QuicCryptoClientConfig::CachedState state;
@@ -241,7 +243,7 @@ TEST(QuicCryptoClientConfigTest, InchoateChloSecureWithSCIDNoEXPY) {
EXPECT_EQ("12345678", scid);
}
-TEST(QuicCryptoClientConfigTest, InchoateChloSecureWithSCID) {
+TEST_F(QuicCryptoClientConfigTest, InchoateChloSecureWithSCID) {
QuicCryptoClientConfig::CachedState state;
CryptoHandshakeMessage scfg;
scfg.set_tag(kSCFG);
@@ -268,7 +270,7 @@ TEST(QuicCryptoClientConfigTest, InchoateChloSecureWithSCID) {
EXPECT_EQ("12345678", scid);
}
-TEST(QuicCryptoClientConfigTest, FillClientHello) {
+TEST_F(QuicCryptoClientConfigTest, FillClientHello) {
QuicCryptoClientConfig::CachedState state;
QuicCryptoClientConfig config(crypto_test_utils::ProofVerifierForTesting());
QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> params(
@@ -289,7 +291,7 @@ TEST(QuicCryptoClientConfigTest, FillClientHello) {
EXPECT_EQ(QuicVersionToQuicTag(QuicVersionMax()), cver);
}
-TEST(QuicCryptoClientConfigTest, ProcessServerDowngradeAttack) {
+TEST_F(QuicCryptoClientConfigTest, ProcessServerDowngradeAttack) {
QuicVersionVector supported_versions = AllSupportedVersions();
if (supported_versions.size() == 1) {
// No downgrade attack is possible if the client only supports one version.
@@ -316,7 +318,7 @@ TEST(QuicCryptoClientConfigTest, ProcessServerDowngradeAttack) {
EXPECT_EQ("Downgrade attack detected", error);
}
-TEST(QuicCryptoClientConfigTest, InitializeFrom) {
+TEST_F(QuicCryptoClientConfigTest, InitializeFrom) {
QuicCryptoClientConfig config(crypto_test_utils::ProofVerifierForTesting());
QuicServerId canonical_server_id("www.google.com", 443,
PRIVACY_MODE_DISABLED);
@@ -337,7 +339,7 @@ TEST(QuicCryptoClientConfigTest, InitializeFrom) {
EXPECT_EQ(1u, other->generation_counter());
}
-TEST(QuicCryptoClientConfigTest, Canonical) {
+TEST_F(QuicCryptoClientConfigTest, Canonical) {
QuicCryptoClientConfig config(crypto_test_utils::ProofVerifierForTesting());
config.AddCanonicalSuffix(".google.com");
QuicServerId canonical_id1("www.google.com", 443, PRIVACY_MODE_DISABLED);
@@ -361,7 +363,7 @@ TEST(QuicCryptoClientConfigTest, Canonical) {
EXPECT_TRUE(config.LookupOrCreate(different_id)->IsEmpty());
}
-TEST(QuicCryptoClientConfigTest, CanonicalNotUsedIfNotValid) {
+TEST_F(QuicCryptoClientConfigTest, CanonicalNotUsedIfNotValid) {
QuicCryptoClientConfig config(crypto_test_utils::ProofVerifierForTesting());
config.AddCanonicalSuffix(".google.com");
QuicServerId canonical_id1("www.google.com", 443, PRIVACY_MODE_DISABLED);
@@ -376,7 +378,7 @@ TEST(QuicCryptoClientConfigTest, CanonicalNotUsedIfNotValid) {
EXPECT_TRUE(config.LookupOrCreate(canonical_id2)->IsEmpty());
}
-TEST(QuicCryptoClientConfigTest, ClearCachedStates) {
+TEST_F(QuicCryptoClientConfigTest, ClearCachedStates) {
QuicCryptoClientConfig config(crypto_test_utils::ProofVerifierForTesting());
// Create two states on different origins.
@@ -464,7 +466,7 @@ TEST(QuicCryptoClientConfigTest, ClearCachedStates) {
EXPECT_EQ(3u, cleared_cache->generation_counter());
}
-TEST(QuicCryptoClientConfigTest, ProcessReject) {
+TEST_F(QuicCryptoClientConfigTest, ProcessReject) {
CryptoHandshakeMessage rej;
crypto_test_utils::FillInDummyReject(&rej, /* stateless */ false);
@@ -482,7 +484,7 @@ TEST(QuicCryptoClientConfigTest, ProcessReject) {
EXPECT_FALSE(cached.has_server_nonce());
}
-TEST(QuicCryptoClientConfigTest, ProcessRejectWithLongTTL) {
+TEST_F(QuicCryptoClientConfigTest, ProcessRejectWithLongTTL) {
CryptoHandshakeMessage rej;
crypto_test_utils::FillInDummyReject(&rej, /* stateless */ false);
QuicTime::Delta one_week = QuicTime::Delta::FromSeconds(kNumSecondsPerWeek);
@@ -507,7 +509,7 @@ TEST(QuicCryptoClientConfigTest, ProcessRejectWithLongTTL) {
QuicWallTime::FromUNIXSeconds(one_week.ToSeconds() - 1)));
}
-TEST(QuicCryptoClientConfigTest, ProcessStatelessReject) {
+TEST_F(QuicCryptoClientConfigTest, ProcessStatelessReject) {
// Create a dummy reject message and mark it as stateless.
CryptoHandshakeMessage rej;
crypto_test_utils::FillInDummyReject(&rej, /* stateless */ true);
@@ -534,7 +536,7 @@ TEST(QuicCryptoClientConfigTest, ProcessStatelessReject) {
EXPECT_EQ(server_nonce, cached.GetNextServerNonce());
}
-TEST(QuicCryptoClientConfigTest, BadlyFormattedStatelessReject) {
+TEST_F(QuicCryptoClientConfigTest, BadlyFormattedStatelessReject) {
// Create a dummy reject message and mark it as stateless. Do not
// add an server-designated connection-id.
CryptoHandshakeMessage rej;
@@ -554,7 +556,7 @@ TEST(QuicCryptoClientConfigTest, BadlyFormattedStatelessReject) {
EXPECT_EQ("Missing kRCID", error);
}
-TEST(QuicCryptoClientConfigTest, ServerNonceinSHLO) {
+TEST_F(QuicCryptoClientConfigTest, ServerNonceinSHLO) {
// Test that the server must include a nonce in the SHLO.
CryptoHandshakeMessage msg;
msg.set_tag(kSHLO);
« no previous file with comments | « net/quic/core/crypto/quic_compressed_certs_cache_test.cc ('k') | net/quic/core/crypto/quic_crypto_server_config_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698