From da389e351878d046f9eb6f305f04537774375f27 Mon Sep 17 00:00:00 2001 From: hbos Date: Tue, 25 Oct 2016 10:55:08 -0700 Subject: [PATCH] PrintTo functions for RTCStats added in rtcstatscollector_unittest.cc Future test code will do stuff like EXPECT_EQ(report, expected_report). They're all defined in the unittest because it and stats' operator== is only used for testing. See https://cs.chromium.org/chromium/src/testing/gtest/include/gtest/gtest-printers.h?sq=package:chromium&dr=C&rcl=1477394469&l=707 BUG=chromium:627816 Review-Url: https://codereview.webrtc.org/2445343003 Cr-Commit-Position: refs/heads/master@{#14779} --- webrtc/api/rtcstatscollector_unittest.cc | 30 ++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/webrtc/api/rtcstatscollector_unittest.cc b/webrtc/api/rtcstatscollector_unittest.cc index 8686056629..97ede90207 100644 --- a/webrtc/api/rtcstatscollector_unittest.cc +++ b/webrtc/api/rtcstatscollector_unittest.cc @@ -11,6 +11,7 @@ #include "webrtc/api/rtcstatscollector.h" #include +#include #include #include @@ -41,6 +42,35 @@ using testing::ReturnRef; namespace webrtc { +// These are used by gtest code, such as if |EXPECT_EQ| fails. +void PrintTo(const RTCCertificateStats& stats, ::std::ostream* os) { + *os << stats.ToString(); +} + +void PrintTo(const RTCDataChannelStats& stats, ::std::ostream* os) { + *os << stats.ToString(); +} + +void PrintTo(const RTCIceCandidatePairStats& stats, ::std::ostream* os) { + *os << stats.ToString(); +} + +void PrintTo(const RTCLocalIceCandidateStats& stats, ::std::ostream* os) { + *os << stats.ToString(); +} + +void PrintTo(const RTCRemoteIceCandidateStats& stats, ::std::ostream* os) { + *os << stats.ToString(); +} + +void PrintTo(const RTCPeerConnectionStats& stats, ::std::ostream* os) { + *os << stats.ToString(); +} + +void PrintTo(const RTCTransportStats& stats, ::std::ostream* os) { + *os << stats.ToString(); +} + namespace { const int64_t kGetStatsReportTimeoutMs = 1000;