OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/media/webrtc_browsertest_perf.h" | 5 #include "chrome/browser/media/webrtc_browsertest_perf.h" |
6 | 6 |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/test/base/in_process_browser_test.h" | 9 #include "chrome/test/base/in_process_browser_test.h" |
10 #include "testing/perf/perf_test.h" | 10 #include "testing/perf/perf_test.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 static bool MaybePrintResultsForAudioSend( | 39 static bool MaybePrintResultsForAudioSend( |
40 const std::string& ssrc, const base::DictionaryValue& pc_dict) { | 40 const std::string& ssrc, const base::DictionaryValue& pc_dict) { |
41 std::string value; | 41 std::string value; |
42 if (!pc_dict.GetString(Statistic("audioInputLevel", ssrc), &value)) { | 42 if (!pc_dict.GetString(Statistic("audioInputLevel", ssrc), &value)) { |
43 // Not an audio send stream. | 43 // Not an audio send stream. |
44 return false; | 44 return false; |
45 } | 45 } |
46 | 46 |
47 EXPECT_TRUE(pc_dict.GetString(Statistic("bytesSent", ssrc), &value)); | 47 EXPECT_TRUE(pc_dict.GetString(Statistic("bytesSent", ssrc), &value)); |
48 perf_test::PrintResult("audio_recv", "", "bytes_sent", value, "bytes", false); | 48 perf_test::PrintResult("audio_send", "", "bytes_sent", value, "bytes", false); |
49 EXPECT_TRUE(pc_dict.GetString(Statistic("googJitterReceived", ssrc), &value)); | 49 EXPECT_TRUE(pc_dict.GetString(Statistic("googJitterReceived", ssrc), &value)); |
50 perf_test::PrintResult("audio_recv", "", "goog_jitter_recv", value, "", | 50 perf_test::PrintResult("audio_send", "", "goog_jitter_recv", value, "", |
51 false); | 51 false); |
52 EXPECT_TRUE(pc_dict.GetString(Statistic("googRtt", ssrc), &value)); | 52 EXPECT_TRUE(pc_dict.GetString(Statistic("googRtt", ssrc), &value)); |
53 perf_test::PrintResult("audio_recv", "", "goog_rtt", value, "ms", false); | 53 perf_test::PrintResult("audio_send", "", "goog_rtt", value, "ms", false); |
54 return true; | 54 return true; |
55 } | 55 } |
56 | 56 |
57 static bool MaybePrintResultsForVideoReceive( | 57 static bool MaybePrintResultsForVideoReceive( |
58 const std::string& ssrc, const base::DictionaryValue& pc_dict) { | 58 const std::string& ssrc, const base::DictionaryValue& pc_dict) { |
59 std::string value; | 59 std::string value; |
60 if (!pc_dict.GetString(Statistic("googFrameRateInput", ssrc), &value)) { | 60 if (!pc_dict.GetString(Statistic("googFrameRateInput", ssrc), &value)) { |
61 // Not a video receive stream. | 61 // Not a video receive stream. |
62 return false; | 62 return false; |
63 } | 63 } |
(...skipping 10 matching lines...) Expand all Loading... |
74 perf_test::PrintResult("video_recv", "", "goog_firs_recv", value, "", false); | 74 perf_test::PrintResult("video_recv", "", "goog_firs_recv", value, "", false); |
75 EXPECT_TRUE(pc_dict.GetString(Statistic("googNacksReceived", ssrc), &value)); | 75 EXPECT_TRUE(pc_dict.GetString(Statistic("googNacksReceived", ssrc), &value)); |
76 perf_test::PrintResult("video_recv", "", "goog_nacks_recv", value, "", false); | 76 perf_test::PrintResult("video_recv", "", "goog_nacks_recv", value, "", false); |
77 EXPECT_TRUE(pc_dict.GetString(Statistic("googFrameWidthSent", ssrc), &value)); | 77 EXPECT_TRUE(pc_dict.GetString(Statistic("googFrameWidthSent", ssrc), &value)); |
78 perf_test::PrintResult("video_recv", "", "goog_frame_width_sent", value, | 78 perf_test::PrintResult("video_recv", "", "goog_frame_width_sent", value, |
79 "pixels", false); | 79 "pixels", false); |
80 EXPECT_TRUE( | 80 EXPECT_TRUE( |
81 pc_dict.GetString(Statistic("googFrameHeightSent", ssrc), &value)); | 81 pc_dict.GetString(Statistic("googFrameHeightSent", ssrc), &value)); |
82 perf_test::PrintResult("video_recv", "", "goog_frame_height_sent", value, | 82 perf_test::PrintResult("video_recv", "", "goog_frame_height_sent", value, |
83 "pixels", false); | 83 "pixels", false); |
| 84 EXPECT_TRUE(pc_dict.GetString( |
| 85 Statistic("googCaptureJitterMs", ssrc), &value)); |
| 86 perf_test::PrintResult("video_send", "", "goog_capture_jitter_ms", value, |
| 87 "ms", false); |
| 88 EXPECT_TRUE(pc_dict.GetString( |
| 89 Statistic("googCaptureQueueDelayMsPerS", ssrc), &value)); |
| 90 perf_test::PrintResult("video_send", "", "goog_capture_queue_delay_ms_per_s", |
| 91 value, "ms/s", false); |
| 92 EXPECT_TRUE(pc_dict.GetString( |
| 93 Statistic("googEncodeUsagePercent", ssrc), &value)); |
| 94 perf_test::PrintResult("video_send", "", "goog_encode_usage_percent", |
| 95 value, "%", false); |
| 96 EXPECT_TRUE(pc_dict.GetString(Statistic("googAvgEncodeMs", ssrc), &value)); |
| 97 perf_test::PrintResult("video_send", "", "goog_avg_encode_ms", value, "ms", |
| 98 false); |
| 99 EXPECT_TRUE(pc_dict.GetString(Statistic("googRtt", ssrc), &value)); |
| 100 perf_test::PrintResult("video_send", "", "goog_rtt", value, "ms", false); |
84 return true; | 101 return true; |
85 } | 102 } |
86 | 103 |
87 static bool MaybePrintResultsForVideoSend( | 104 static bool MaybePrintResultsForVideoSend( |
88 const std::string& ssrc, const base::DictionaryValue& pc_dict) { | 105 const std::string& ssrc, const base::DictionaryValue& pc_dict) { |
89 std::string value; | 106 std::string value; |
90 if (!pc_dict.GetString(Statistic("googFrameRateOutput", ssrc), &value)) { | 107 if (!pc_dict.GetString(Statistic("googFrameRateOutput", ssrc), &value)) { |
91 // Not a video receive stream. | 108 // Not a video receive stream. |
92 return false; | 109 return false; |
93 } | 110 } |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 bool did_recognize_stream_type = | 211 bool did_recognize_stream_type = |
195 MaybePrintResultsForAudioReceive(ssrc, pc_dict) || | 212 MaybePrintResultsForAudioReceive(ssrc, pc_dict) || |
196 MaybePrintResultsForAudioSend(ssrc, pc_dict) || | 213 MaybePrintResultsForAudioSend(ssrc, pc_dict) || |
197 MaybePrintResultsForVideoReceive(ssrc, pc_dict) || | 214 MaybePrintResultsForVideoReceive(ssrc, pc_dict) || |
198 MaybePrintResultsForVideoSend(ssrc, pc_dict); | 215 MaybePrintResultsForVideoSend(ssrc, pc_dict); |
199 ASSERT_TRUE(did_recognize_stream_type) << "Failed to figure out which " | 216 ASSERT_TRUE(did_recognize_stream_type) << "Failed to figure out which " |
200 "kind of stream SSRC " << ssrc | 217 "kind of stream SSRC " << ssrc |
201 << " is. "; | 218 << " is. "; |
202 } | 219 } |
203 } | 220 } |
OLD | NEW |