RTCDataChannelStats[1] added, supporting all stats members.

Also updates MockDataChannel to also mock id, messages_sent, bytes_sent,
messages_received and bytes_received.

[1] https://w3c.github.io/webrtc-stats/#dcstats-dict*

BUG=chromium:654927, chromium:627816

Review-Url: https://codereview.webrtc.org/2420473002
Cr-Commit-Position: refs/heads/master@{#14670}
diff --git a/webrtc/api/rtcstatscollector.h b/webrtc/api/rtcstatscollector.h
index 712f9e2..ae04e61 100644
--- a/webrtc/api/rtcstatscollector.h
+++ b/webrtc/api/rtcstatscollector.h
@@ -14,6 +14,7 @@
 #include <memory>
 #include <vector>
 
+#include "webrtc/api/datachannelinterface.h"
 #include "webrtc/api/stats/rtcstats_objects.h"
 #include "webrtc/api/stats/rtcstatsreport.h"
 #include "webrtc/base/asyncinvoker.h"
@@ -85,6 +86,9 @@
   void ProduceCertificateStatsFromSSLCertificateAndChain_s(
       int64_t timestamp_us, const rtc::SSLCertificate& certificate,
       RTCStatsReport* report) const;
+  // Produces |RTCDataChannelStats|.
+  void ProduceDataChannelStats_s(
+      int64_t timestamp_us, RTCStatsReport* report) const;
   // Produces |RTCIceCandidatePairStats| and |RTCIceCandidateStats|.
   void ProduceIceCandidateAndPairStats_s(
       int64_t timestamp_us, const SessionStats& session_stats,
@@ -116,8 +120,10 @@
   rtc::scoped_refptr<const RTCStatsReport> cached_report_;
 };
 
-// Helper function, exposed for unittests.
-const char* CandidateTypeToRTCIceCandidateType(const std::string& type);
+const char* CandidateTypeToRTCIceCandidateTypeForTesting(
+    const std::string& type);
+const char* DataStateToRTCDataChannelStateForTesting(
+    DataChannelInterface::DataState state);
 
 }  // namespace webrtc