DescriptionAdd operator<<(ostream, AlternativeService) for test output formatting.
The advantage is that if a test expectation like
EXPECT_EQ(alternative_service1, alternative_service2) fails in any test
in any file, then pretty printed contents of both alternative service
structs will be displayed.
The disadvantage is that this helper function is now in production code.
Note that the same approach is already used with a number of formatting
helper methods, for example, for SpdySettingsIds, SpdyFrameType,
Http2FrameType etc.
Repeating PrintTo() definition in every unittest.cc does not work: it
causes a namespace collision. Moving it into anonymous namespace does
not work: gTest would not find it there, and it indeed fails with unused
function error. There is no obvious place for this function:
//net/http/http_test_utils.h does not exist,
//net/spdy/spdy_test_utils.h or //net/quic/test_tools/quic_test_utils.h
is not quite the right place.
Review-Url: https://codereview.chromium.org/2808843002
Cr-Commit-Position: refs/heads/master@{#463290}
Committed: https://chromium.googlesource.com/chromium/src/+/396d33b1f92f90f9cdecd880748bf489954691e7
Patch Set 1 #
Messages
Total messages: 12 (8 generated)
|