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

Unified Diff: net/tools/quic/stateless_rejector_test.cc

Issue 2311543002: Improve test case naming in stateless_rejector_test (Closed)
Patch Set: Created 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/quic/stateless_rejector_test.cc
diff --git a/net/tools/quic/stateless_rejector_test.cc b/net/tools/quic/stateless_rejector_test.cc
index 95cbb924d199d6f8ec7faada241964c5f3354111..d7dde9e694766da3d909d22deb8982e9db844a9e 100644
--- a/net/tools/quic/stateless_rejector_test.cc
+++ b/net/tools/quic/stateless_rejector_test.cc
@@ -7,6 +7,7 @@
#include <memory>
#include <vector>
+#include "base/strings/stringprintf.h"
#include "net/quic/core/crypto/crypto_handshake_message.h"
#include "net/quic/core/crypto/proof_source.h"
#include "net/quic/core/quic_utils.h"
@@ -28,16 +29,30 @@ const QuicConnectionId kServerDesignateConnectionId = 24;
// All four combinations of the two flags involved.
enum FlagsMode { ENABLED, STATELESS_DISABLED, CHEAP_DISABLED, BOTH_DISABLED };
+const char* FlagsModeToString(FlagsMode mode) {
+ switch (mode) {
+ case ENABLED:
+ return "ENABLED";
+ case STATELESS_DISABLED:
+ return "STATELESS_DISABLED";
+ case CHEAP_DISABLED:
+ return "CHEAP_DISABLED";
+ case BOTH_DISABLED:
+ return "BOTH_DISABLED";
+ }
+}
+
// Test various combinations of QUIC version and flag state.
struct TestParams {
QuicVersion version;
FlagsMode flags;
- friend ostream& operator<<(ostream& os, const TestParams& p) {
- os << "{ version: " << p.version << " flags: " << p.flags << " }";
- return os;
- }
};
+string TestParamToString(const testing::TestParamInfo<TestParams>& params) {
+ return base::StringPrintf("v%i_%s", params.param.version,
+ FlagsModeToString(params.param.flags));
+}
+
vector<TestParams> GetTestParams() {
vector<TestParams> params;
for (FlagsMode flags :
@@ -130,7 +145,8 @@ class StatelessRejectorTest : public ::testing::TestWithParam<TestParams> {
INSTANTIATE_TEST_CASE_P(Flags,
StatelessRejectorTest,
- ::testing::ValuesIn(GetTestParams()));
+ ::testing::ValuesIn(GetTestParams()),
+ TestParamToString);
TEST_P(StatelessRejectorTest, InvalidChlo) {
// clang-format off
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698