Index: webrtc/api/androidtests/src/org/webrtc/PeerConnectionTest.java |
diff --git a/webrtc/api/androidtests/src/org/webrtc/PeerConnectionTest.java b/webrtc/api/androidtests/src/org/webrtc/PeerConnectionTest.java |
index ebeeecd9a9145a4b2f5ded821f639af249c78b9c..809603a3b402ada99968dd4408af532b68d063ca 100644 |
--- a/webrtc/api/androidtests/src/org/webrtc/PeerConnectionTest.java |
+++ b/webrtc/api/androidtests/src/org/webrtc/PeerConnectionTest.java |
@@ -10,6 +10,8 @@ |
package org.webrtc; |
+import org.webrtc.Metrics; |
+import org.webrtc.Metrics.HistogramInfo; |
import org.webrtc.PeerConnection.IceConnectionState; |
import org.webrtc.PeerConnection.IceGatheringState; |
import org.webrtc.PeerConnection.SignalingState; |
@@ -530,6 +532,7 @@ public class PeerConnectionTest extends ActivityTestCase { |
@MediumTest |
public void testCompleteSession() throws Exception { |
+ Metrics.enable(); |
// Allow loopback interfaces too since our Android devices often don't |
// have those. |
PeerConnectionFactory.Options options = new PeerConnectionFactory.Options(); |
@@ -741,6 +744,7 @@ public class PeerConnectionTest extends ActivityTestCase { |
answeringExpectations.expectStateChange(DataChannel.State.CLOSED); |
answeringExpectations.dataChannel.close(); |
offeringExpectations.dataChannel.close(); |
+ getMetrics(); |
// Free the Java-land objects, collect them, and sleep a bit to make sure we |
// don't get late-arrival crashes after the Java-land objects have been |
@@ -968,6 +972,18 @@ public class PeerConnectionTest extends ActivityTestCase { |
System.gc(); |
} |
+ private static void getMetrics() { |
+ Metrics metrics = Metrics.getAndReset(); |
+ assertTrue(metrics.map.size() > 0); |
åsapersson
2016/05/23 09:14:03
A certain time must have elapsed in order for vide
perkj_webrtc
2016/05/23 12:50:27
the test waits for 10 frames to be rendered so you
åsapersson
2016/05/23 13:01:23
There are no stats for these after 10 frames.
|
+ // Test for example that the configured video codec is recorded when a |
+ // VideoSendStream is created. |
+ String name = "WebRTC.Video.Encoder.CodecType"; |
+ assertTrue(metrics.map.containsKey(name)); |
+ HistogramInfo info = metrics.map.get(name); |
+ assertEquals(1, info.samples.size()); // samples: <sample value, # of events> |
+ assertTrue(info.samples.containsValue(2)); // <codec type, 2>, same codec configured |
+ } |
+ |
private static void shutdownPC( |
PeerConnection pc, ObserverExpectations expectations) { |
if (expectations.dataChannel != null) { |