Correct data histogram entry for incoming DC

Both incoming and outgoing datachannels should cause
the DATA_ADDED flag to be set.

This CL also moves all tests into their own file, and
improves scaffolding.

Bug: chromium:718508
Change-Id: I5c4c257ccb6f26799f7593bce8b27ebf59015b1e
Reviewed-on: https://webrtc-review.googlesource.com/85348
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23766}
diff --git a/pc/peerconnection.cc b/pc/peerconnection.cc
index d953833..15966ba 100644
--- a/pc/peerconnection.cc
+++ b/pc/peerconnection.cc
@@ -1040,10 +1040,10 @@
         RtpTransceiverProxyWithInternal<RtpTransceiver>::Create(
             signaling_thread(), new RtpTransceiver(cricket::MEDIA_TYPE_VIDEO)));
   }
-  signaling_thread()->PostDelayed(
-      RTC_FROM_HERE,
-      return_histogram_very_quickly_ ? 0 : REPORT_USAGE_PATTERN_DELAY_MS, this,
-      MSG_REPORT_USAGE_PATTERN, nullptr);
+  int delay_ms =
+      return_histogram_very_quickly_ ? 0 : REPORT_USAGE_PATTERN_DELAY_MS;
+  signaling_thread()->PostDelayed(RTC_FROM_HERE, delay_ms, this,
+                                  MSG_REPORT_USAGE_PATTERN, nullptr);
   return true;
 }
 
@@ -4547,6 +4547,7 @@
   rtc::scoped_refptr<DataChannelInterface> proxy_channel =
       DataChannelProxy::Create(signaling_thread(), channel);
   observer_->OnDataChannel(std::move(proxy_channel));
+  NoteUsageEvent(UsageEvent::DATA_ADDED);
 }
 
 rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>>