Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(326)

Unified Diff: webrtc/api/androidtests/src/org/webrtc/PeerConnectionTest.java

Issue 1952223007: Android: Add API for getting native histograms. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: address comments Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/api/api.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « no previous file | webrtc/api/api.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698