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

Unified Diff: net/quic/test_tools/quic_test_utils.h

Issue 2306173003: Add a new QuicFlagSaver class for saving/restoring the values of QUIC flags in tests. (Closed)
Patch Set: Better 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 | « net/quic/core/quic_stream_sequencer_buffer_test.cc ('k') | net/quic/test_tools/quic_test_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/test_tools/quic_test_utils.h
diff --git a/net/quic/test_tools/quic_test_utils.h b/net/quic/test_tools/quic_test_utils.h
index 46a0c2d2d643eae91ac9c3cab4c8513750d51423..a708dacc8f573ddad7e82e5212371868ab5038c7 100644
--- a/net/quic/test_tools/quic_test_utils.h
+++ b/net/quic/test_tools/quic_test_utils.h
@@ -215,19 +215,12 @@ QuicPacket* BuildUnsizedDataPacket(QuicFramer* framer,
const QuicFrames& frames,
size_t packet_size);
-template <typename SaveType>
-class ValueRestore {
+// When constructed, checks that all QUIC flags have their correct default
+// values and when destructed, restores those values.
+class QuicFlagSaver {
public:
- ValueRestore(SaveType* name, SaveType value) : name_(name), value_(*name) {
- *name_ = value;
- }
- ~ValueRestore() { *name_ = value_; }
-
- private:
- SaveType* name_;
- SaveType value_;
-
- DISALLOW_COPY_AND_ASSIGN(ValueRestore);
+ QuicFlagSaver();
+ ~QuicFlagSaver();
};
// Simple random number generator used to compute random numbers suitable
« no previous file with comments | « net/quic/core/quic_stream_sequencer_buffer_test.cc ('k') | net/quic/test_tools/quic_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698