Adds debug printing of units in unit tests.
Bug: webrtc:9656
Change-Id: I643b79bc214643f47b2b64967ce713665dbef5c9
Reviewed-on: https://webrtc-review.googlesource.com/95652
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24436}
diff --git a/api/units/timestamp.h b/api/units/timestamp.h
index 1b5e84f..6e5e392 100644
--- a/api/units/timestamp.h
+++ b/api/units/timestamp.h
@@ -11,6 +11,10 @@
#ifndef API_UNITS_TIMESTAMP_H_
#define API_UNITS_TIMESTAMP_H_
+#ifdef UNIT_TEST
+#include <ostream> // no-presubmit-check TODO(webrtc:8982)
+#endif // UNIT_TEST
+
#include <stdint.h>
#include <limits>
#include <string>
@@ -203,6 +207,14 @@
std::string ToString(const Timestamp& value);
+#ifdef UNIT_TEST
+inline std::ostream& operator<<( // no-presubmit-check TODO(webrtc:8982)
+ std::ostream& stream, // no-presubmit-check TODO(webrtc:8982)
+ Timestamp value) {
+ return stream << ToString(value);
+}
+#endif // UNIT_TEST
+
} // namespace webrtc
#endif // API_UNITS_TIMESTAMP_H_