Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 98 ui_test_utils::NavigateToURL(browser(), GURL("chrome://webrtc-internals")); | 98 ui_test_utils::NavigateToURL(browser(), GURL("chrome://webrtc-internals")); |
| 99 content::WebContents* webrtc_internals_tab = | 99 content::WebContents* webrtc_internals_tab = |
| 100 browser()->tab_strip_model()->GetActiveWebContents(); | 100 browser()->tab_strip_model()->GetActiveWebContents(); |
| 101 | 101 |
| 102 test::SleepInJavascript(webrtc_internals_tab, duration_msec); | 102 test::SleepInJavascript(webrtc_internals_tab, duration_msec); |
| 103 | 103 |
| 104 return std::unique_ptr<base::DictionaryValue>( | 104 return std::unique_ptr<base::DictionaryValue>( |
| 105 GetWebrtcInternalsData(webrtc_internals_tab)); | 105 GetWebrtcInternalsData(webrtc_internals_tab)); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void RunsAudioVideoCall60SecsAndLogsInternalMetrics( | 108 void RunsAudioVideoCall60SecsAndLogsInternalMetrics( |
|
phoglund_chromium
2016/07/27 09:15:05
You're not using opus_dtx for two-way calls, so re
Ivo-OOO until feb 6
2016/07/27 14:12:43
Done.
| |
| 109 const std::string& video_codec) { | 109 const std::string& video_codec, |
| 110 bool opus_dtx) { | |
| 110 ASSERT_TRUE(test::HasReferenceFilesInCheckout()); | 111 ASSERT_TRUE(test::HasReferenceFilesInCheckout()); |
| 111 ASSERT_TRUE(embedded_test_server()->Start()); | 112 ASSERT_TRUE(embedded_test_server()->Start()); |
| 112 | 113 |
| 113 ASSERT_GE(TestTimeouts::action_max_timeout().InSeconds(), 100) | 114 ASSERT_GE(TestTimeouts::action_max_timeout().InSeconds(), 100) |
| 114 << "This is a long-running test; you must specify " | 115 << "This is a long-running test; you must specify " |
| 115 "--ui-test-action-max-timeout to have a value of at least 100000."; | 116 "--ui-test-action-max-timeout to have a value of at least 100000."; |
| 116 | 117 |
| 117 content::WebContents* left_tab = | 118 content::WebContents* left_tab = |
| 118 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); | 119 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); |
| 119 content::WebContents* right_tab = | 120 content::WebContents* right_tab = |
| 120 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); | 121 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); |
| 121 | 122 |
| 122 SetupPeerconnectionWithLocalStream(left_tab); | 123 SetupPeerconnectionWithLocalStream(left_tab); |
| 123 SetupPeerconnectionWithLocalStream(right_tab); | 124 SetupPeerconnectionWithLocalStream(right_tab); |
| 124 | 125 |
| 125 NegotiateCall(left_tab, right_tab, video_codec); | 126 NegotiateCall(left_tab, right_tab, video_codec, opus_dtx); |
| 126 | 127 |
| 127 StartDetectingVideo(left_tab, "remote-view"); | 128 StartDetectingVideo(left_tab, "remote-view"); |
| 128 StartDetectingVideo(right_tab, "remote-view"); | 129 StartDetectingVideo(right_tab, "remote-view"); |
| 129 | 130 |
| 130 WaitForVideoToPlay(left_tab); | 131 WaitForVideoToPlay(left_tab); |
| 131 WaitForVideoToPlay(right_tab); | 132 WaitForVideoToPlay(right_tab); |
| 132 | 133 |
| 133 // Let values stabilize, bandwidth ramp up, etc. | 134 // Let values stabilize, bandwidth ramp up, etc. |
| 134 test::SleepInJavascript(left_tab, 60000); | 135 test::SleepInJavascript(left_tab, 60000); |
| 135 | 136 |
| 136 // Start measurements. | 137 // Start measurements. |
| 137 std::unique_ptr<base::DictionaryValue> all_data = | 138 std::unique_ptr<base::DictionaryValue> all_data = |
| 138 MeasureWebRtcInternalsData(10000); | 139 MeasureWebRtcInternalsData(10000); |
| 139 ASSERT_TRUE(all_data.get() != NULL); | 140 ASSERT_TRUE(all_data.get() != NULL); |
| 140 | 141 |
| 141 const base::DictionaryValue* first_pc_dict = | 142 const base::DictionaryValue* first_pc_dict = |
| 142 GetDataOnPeerConnection(all_data.get(), 0); | 143 GetDataOnPeerConnection(all_data.get(), 0); |
| 143 ASSERT_TRUE(first_pc_dict != NULL); | 144 ASSERT_TRUE(first_pc_dict != NULL); |
| 144 test::PrintBweForVideoMetrics(*first_pc_dict, "", video_codec); | 145 test::PrintBweForVideoMetrics(*first_pc_dict, opus_dtx ? "opus_dtx" : "", |
| 145 test::PrintMetricsForAllStreams(*first_pc_dict, "", video_codec); | 146 video_codec); |
| 147 test::PrintMetricsForAllStreams(*first_pc_dict, opus_dtx ? "opus_dtx" : "", | |
| 148 video_codec); | |
| 146 | 149 |
| 147 HangUp(left_tab); | 150 HangUp(left_tab); |
| 148 HangUp(right_tab); | 151 HangUp(right_tab); |
| 149 } | 152 } |
| 150 | 153 |
| 151 void RunsOneWayCall60SecsAndLogsInternalMetrics( | 154 void RunsOneWayCall60SecsAndLogsInternalMetrics( |
| 152 const std::string& video_codec) { | 155 const std::string& video_codec, |
| 156 bool opus_dtx) { | |
| 153 ASSERT_TRUE(test::HasReferenceFilesInCheckout()); | 157 ASSERT_TRUE(test::HasReferenceFilesInCheckout()); |
| 154 ASSERT_TRUE(embedded_test_server()->Start()); | 158 ASSERT_TRUE(embedded_test_server()->Start()); |
| 155 | 159 |
| 156 ASSERT_GE(TestTimeouts::action_max_timeout().InSeconds(), 100) | 160 ASSERT_GE(TestTimeouts::action_max_timeout().InSeconds(), 100) |
| 157 << "This is a long-running test; you must specify " | 161 << "This is a long-running test; you must specify " |
| 158 "--ui-test-action-max-timeout to have a value of at least 100000."; | 162 "--ui-test-action-max-timeout to have a value of at least 100000."; |
| 159 | 163 |
| 160 content::WebContents* left_tab = | 164 content::WebContents* left_tab = |
| 161 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); | 165 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); |
| 162 content::WebContents* right_tab = | 166 content::WebContents* right_tab = |
| 163 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); | 167 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); |
| 164 | 168 |
| 165 SetupPeerconnectionWithLocalStream(left_tab); | 169 SetupPeerconnectionWithLocalStream(left_tab); |
| 166 SetupPeerconnectionWithoutLocalStream(right_tab); | 170 SetupPeerconnectionWithoutLocalStream(right_tab); |
| 167 | 171 |
| 168 NegotiateCall(left_tab, right_tab, video_codec); | 172 NegotiateCall(left_tab, right_tab, video_codec, opus_dtx); |
| 169 | 173 |
| 170 // Remote video will only play in one tab since the call is one-way. | 174 // Remote video will only play in one tab since the call is one-way. |
| 171 StartDetectingVideo(right_tab, "remote-view"); | 175 StartDetectingVideo(right_tab, "remote-view"); |
| 172 WaitForVideoToPlay(right_tab); | 176 WaitForVideoToPlay(right_tab); |
| 173 | 177 |
| 174 // Let values stabilize, bandwidth ramp up, etc. | 178 // Let values stabilize, bandwidth ramp up, etc. |
| 175 test::SleepInJavascript(left_tab, 60000); | 179 test::SleepInJavascript(left_tab, 60000); |
| 176 | 180 |
| 177 std::unique_ptr<base::DictionaryValue> all_data = | 181 std::unique_ptr<base::DictionaryValue> all_data = |
| 178 MeasureWebRtcInternalsData(10000); | 182 MeasureWebRtcInternalsData(10000); |
| 179 ASSERT_TRUE(all_data.get() != NULL); | 183 ASSERT_TRUE(all_data.get() != NULL); |
| 180 | 184 |
| 181 // This assumes the sending peer connection is always listed first in the | 185 // This assumes the sending peer connection is always listed first in the |
| 182 // data store, and the receiving second. | 186 // data store, and the receiving second. |
| 183 const base::DictionaryValue* first_pc_dict = | 187 const base::DictionaryValue* first_pc_dict = |
| 184 GetDataOnPeerConnection(all_data.get(), 0); | 188 GetDataOnPeerConnection(all_data.get(), 0); |
| 185 ASSERT_TRUE(first_pc_dict != NULL); | 189 ASSERT_TRUE(first_pc_dict != NULL); |
| 186 test::PrintBweForVideoMetrics(*first_pc_dict, "_sendonly", video_codec); | 190 test::PrintBweForVideoMetrics( |
| 187 test::PrintMetricsForSendStreams(*first_pc_dict, "_sendonly", video_codec); | 191 *first_pc_dict, opus_dtx ? "_sendonly_with_opus_dtx" : "_sendonly", |
| 192 video_codec); | |
| 193 test::PrintMetricsForSendStreams( | |
| 194 *first_pc_dict, opus_dtx ? "_sendonly_with_opus_dtx" : "_sendonly", | |
| 195 video_codec); | |
| 188 | 196 |
| 189 const base::DictionaryValue* second_pc_dict = | 197 const base::DictionaryValue* second_pc_dict = |
| 190 GetDataOnPeerConnection(all_data.get(), 1); | 198 GetDataOnPeerConnection(all_data.get(), 1); |
| 191 ASSERT_TRUE(second_pc_dict != NULL); | 199 ASSERT_TRUE(second_pc_dict != NULL); |
| 192 test::PrintBweForVideoMetrics(*second_pc_dict, "_recvonly", video_codec); | 200 test::PrintBweForVideoMetrics( |
| 193 test::PrintMetricsForRecvStreams(*second_pc_dict, "_recvonly", video_codec); | 201 *second_pc_dict, opus_dtx ? "_recvonly_with_opus_dtx" : "_recvonly", |
| 202 video_codec); | |
| 203 test::PrintMetricsForRecvStreams( | |
| 204 *second_pc_dict, opus_dtx ? "_recvonly_with_opus_dtx" : "_recvonly", | |
| 205 video_codec); | |
| 194 | 206 |
| 195 HangUp(left_tab); | 207 HangUp(left_tab); |
| 196 HangUp(right_tab); | 208 HangUp(right_tab); |
| 197 } | 209 } |
| 198 }; | 210 }; |
| 199 | 211 |
| 200 // This is manual for its long execution time. | 212 // This is manual for its long execution time. |
| 201 | 213 |
| 202 IN_PROC_BROWSER_TEST_F( | 214 IN_PROC_BROWSER_TEST_F( |
| 203 WebRtcPerfBrowserTest, | 215 WebRtcPerfBrowserTest, |
| 204 MANUAL_RunsAudioVideoCall60SecsAndLogsInternalMetricsVp8) { | 216 MANUAL_RunsAudioVideoCall60SecsAndLogsInternalMetricsVp8) { |
| 205 RunsAudioVideoCall60SecsAndLogsInternalMetrics("VP8"); | 217 RunsAudioVideoCall60SecsAndLogsInternalMetrics("VP8", false); |
| 206 } | 218 } |
| 207 | 219 |
| 208 IN_PROC_BROWSER_TEST_F( | 220 IN_PROC_BROWSER_TEST_F( |
| 209 WebRtcPerfBrowserTest, | 221 WebRtcPerfBrowserTest, |
| 210 MANUAL_RunsAudioVideoCall60SecsAndLogsInternalMetricsVp9) { | 222 MANUAL_RunsAudioVideoCall60SecsAndLogsInternalMetricsVp9) { |
| 211 RunsAudioVideoCall60SecsAndLogsInternalMetrics("VP9"); | 223 RunsAudioVideoCall60SecsAndLogsInternalMetrics("VP9", false); |
| 212 } | 224 } |
| 213 | 225 |
| 214 #if BUILDFLAG(RTC_USE_H264) | 226 #if BUILDFLAG(RTC_USE_H264) |
| 215 | 227 |
| 216 IN_PROC_BROWSER_TEST_F( | 228 IN_PROC_BROWSER_TEST_F( |
| 217 WebRtcPerfBrowserTest, | 229 WebRtcPerfBrowserTest, |
| 218 MANUAL_RunsAudioVideoCall60SecsAndLogsInternalMetricsH264) { | 230 MANUAL_RunsAudioVideoCall60SecsAndLogsInternalMetricsH264) { |
| 219 // Only run test if run-time feature corresponding to |rtc_use_h264| is on. | 231 // Only run test if run-time feature corresponding to |rtc_use_h264| is on. |
| 220 if (!base::FeatureList::IsEnabled(content::kWebRtcH264WithOpenH264FFmpeg)) { | 232 if (!base::FeatureList::IsEnabled(content::kWebRtcH264WithOpenH264FFmpeg)) { |
| 221 LOG(WARNING) << "Run-time feature WebRTC-H264WithOpenH264FFmpeg disabled. " | 233 LOG(WARNING) << "Run-time feature WebRTC-H264WithOpenH264FFmpeg disabled. " |
| 222 "Skipping WebRtcPerfBrowserTest.MANUAL_RunsAudioVideoCall60SecsAndLogs" | 234 "Skipping WebRtcPerfBrowserTest.MANUAL_RunsAudioVideoCall60SecsAndLogs" |
| 223 "InternalMetricsH264 (test \"OK\")"; | 235 "InternalMetricsH264 (test \"OK\")"; |
| 224 return; | 236 return; |
| 225 } | 237 } |
| 226 RunsAudioVideoCall60SecsAndLogsInternalMetrics("H264"); | 238 RunsAudioVideoCall60SecsAndLogsInternalMetrics("H264", false); |
| 227 } | 239 } |
| 228 | 240 |
| 229 #endif // BUILDFLAG(RTC_USE_H264) | 241 #endif // BUILDFLAG(RTC_USE_H264) |
| 230 | 242 |
| 231 IN_PROC_BROWSER_TEST_F( | 243 IN_PROC_BROWSER_TEST_F( |
| 232 WebRtcPerfBrowserTest, | 244 WebRtcPerfBrowserTest, |
| 233 MANUAL_RunsOneWayCall60SecsAndLogsInternalMetricsDefault) { | 245 MANUAL_RunsOneWayCall60SecsAndLogsInternalMetricsDefault) { |
| 234 RunsOneWayCall60SecsAndLogsInternalMetrics(""); | 246 RunsOneWayCall60SecsAndLogsInternalMetrics("", false); |
| 235 } | 247 } |
| 248 | |
| 249 IN_PROC_BROWSER_TEST_F( | |
| 250 WebRtcPerfBrowserTest, | |
| 251 MANUAL_RunsOneWayCall60SecsAndLogsInternalMetricsWithOpusDtx) { | |
| 252 RunsOneWayCall60SecsAndLogsInternalMetrics("", true); | |
| 253 } | |
| OLD | NEW |