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

Issue 2808843002: Add operator<<(ostream, AlternativeService) for test output formatting. (Closed)

Created:
3 years, 8 months ago by Bence
Modified:
3 years, 8 months ago
Reviewers:
Ryan Hamilton
CC:
chromium-reviews, cbentzel+watch_chromium.org, net-reviews_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Add 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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+11 lines, -4 lines) Patch
M net/http/http_server_properties.h View 2 chunks +5 lines, -0 lines 0 comments Download
M net/http/http_server_properties.cc View 1 chunk +6 lines, -0 lines 0 comments Download
M net/http/http_server_properties_impl_unittest.cc View 1 chunk +0 lines, -4 lines 0 comments Download

Messages

Total messages: 12 (8 generated)
Bence
Ryan: PTAL. Thank you.
3 years, 8 months ago (2017-04-10 13:37:53 UTC) #4
Ryan Hamilton
lgtm
3 years, 8 months ago (2017-04-10 13:45:35 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2808843002/1
3 years, 8 months ago (2017-04-10 16:34:30 UTC) #9
commit-bot: I haz the power
3 years, 8 months ago (2017-04-10 16:41:32 UTC) #12
Message was sent while issue was closed.
Committed patchset #1 (id:1) as
https://chromium.googlesource.com/chromium/src/+/396d33b1f92f90f9cdecd880748b...

Powered by Google App Engine
This is Rietveld 408576698