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

Unified Diff: net/quic/quic_protocol.h

Issue 11973021: Teach gtest how to print QuicConsumedData and QuicEncryptedPacket. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Sync with ToT Created 7 years, 11 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 | net/quic/quic_protocol.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_protocol.h
===================================================================
--- net/quic/quic_protocol.h (revision 177746)
+++ net/quic/quic_protocol.h (working copy)
@@ -479,6 +479,13 @@
QuicEncryptedPacket(char* buffer, size_t length, bool owns_buffer)
: QuicData(buffer, length, owns_buffer) { }
+ // By default, gtest prints the raw bytes of an object. The bool data
+ // member (in the base class QuicData) causes this object to have padding
+ // bytes, which causes the default gtest object printer to read
+ // uninitialize memory. So we need to teach gtest how to print this object.
+ NET_EXPORT_PRIVATE friend std::ostream& operator<<(
+ std::ostream& os, const QuicEncryptedPacket& s);
+
base::StringPiece AssociatedData() const {
return base::StringPiece(data() + kStartOfHashData, kStartOfEncryptedData);
}
@@ -495,6 +502,14 @@
: bytes_consumed(bytes_consumed),
fin_consumed(fin_consumed) {
}
+
+ // By default, gtest prints the raw bytes of an object. The bool data
+ // member causes this object to have padding bytes, which causes the
+ // default gtest object printer to read uninitialize memory. So we need
+ // to teach gtest how to print this object.
+ NET_EXPORT_PRIVATE friend std::ostream& operator<<(
+ std::ostream& os, const QuicConsumedData& s);
+
size_t bytes_consumed;
bool fin_consumed;
};
« no previous file with comments | « no previous file | net/quic/quic_protocol.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698