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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 115 "--ui-test-action-max-timeout to have a value of at least 100000."; | 115 "--ui-test-action-max-timeout to have a value of at least 100000."; |
| 116 | 116 |
| 117 content::WebContents* left_tab = | 117 content::WebContents* left_tab = |
| 118 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); | 118 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); |
| 119 content::WebContents* right_tab = | 119 content::WebContents* right_tab = |
| 120 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); | 120 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); |
| 121 | 121 |
| 122 SetupPeerconnectionWithLocalStream(left_tab); | 122 SetupPeerconnectionWithLocalStream(left_tab); |
| 123 SetupPeerconnectionWithLocalStream(right_tab); | 123 SetupPeerconnectionWithLocalStream(right_tab); |
| 124 | 124 |
| 125 NegotiateCall(left_tab, right_tab, video_codec); | 125 if (!video_codec.empty()) { |
| 126 SetDefaultVideoCodec(left_tab, video_codec); | |
| 127 SetDefaultVideoCodec(right_tab, video_codec); | |
| 128 } | |
| 129 NegotiateCall(left_tab, right_tab); | |
| 126 | 130 |
| 127 StartDetectingVideo(left_tab, "remote-view"); | 131 StartDetectingVideo(left_tab, "remote-view"); |
| 128 StartDetectingVideo(right_tab, "remote-view"); | 132 StartDetectingVideo(right_tab, "remote-view"); |
| 129 | 133 |
| 130 WaitForVideoToPlay(left_tab); | 134 WaitForVideoToPlay(left_tab); |
| 131 WaitForVideoToPlay(right_tab); | 135 WaitForVideoToPlay(right_tab); |
| 132 | 136 |
| 133 // Let values stabilize, bandwidth ramp up, etc. | 137 // Let values stabilize, bandwidth ramp up, etc. |
| 134 test::SleepInJavascript(left_tab, 60000); | 138 test::SleepInJavascript(left_tab, 60000); |
| 135 | 139 |
| 136 // Start measurements. | 140 // Start measurements. |
| 137 std::unique_ptr<base::DictionaryValue> all_data = | 141 std::unique_ptr<base::DictionaryValue> all_data = |
| 138 MeasureWebRtcInternalsData(10000); | 142 MeasureWebRtcInternalsData(10000); |
| 139 ASSERT_TRUE(all_data.get() != NULL); | 143 ASSERT_TRUE(all_data.get() != NULL); |
| 140 | 144 |
| 141 const base::DictionaryValue* first_pc_dict = | 145 const base::DictionaryValue* first_pc_dict = |
| 142 GetDataOnPeerConnection(all_data.get(), 0); | 146 GetDataOnPeerConnection(all_data.get(), 0); |
| 143 ASSERT_TRUE(first_pc_dict != NULL); | 147 ASSERT_TRUE(first_pc_dict != NULL); |
| 144 test::PrintBweForVideoMetrics(*first_pc_dict, "", video_codec); | 148 test::PrintBweForVideoMetrics(*first_pc_dict, "", video_codec); |
| 145 test::PrintMetricsForAllStreams(*first_pc_dict, "", video_codec); | 149 test::PrintMetricsForAllStreams(*first_pc_dict, "", video_codec); |
| 146 | 150 |
| 147 HangUp(left_tab); | 151 HangUp(left_tab); |
| 148 HangUp(right_tab); | 152 HangUp(right_tab); |
| 149 } | 153 } |
| 150 | 154 |
| 151 void RunsOneWayCall60SecsAndLogsInternalMetrics( | 155 void RunsOneWayCall60SecsAndLogsInternalMetrics( |
| 152 const std::string& video_codec) { | 156 const std::string& video_codec, |
| 157 bool opus_dtx) { | |
| 153 ASSERT_TRUE(test::HasReferenceFilesInCheckout()); | 158 ASSERT_TRUE(test::HasReferenceFilesInCheckout()); |
| 154 ASSERT_TRUE(embedded_test_server()->Start()); | 159 ASSERT_TRUE(embedded_test_server()->Start()); |
| 155 | 160 |
| 156 ASSERT_GE(TestTimeouts::action_max_timeout().InSeconds(), 100) | 161 ASSERT_GE(TestTimeouts::action_max_timeout().InSeconds(), 100) |
| 157 << "This is a long-running test; you must specify " | 162 << "This is a long-running test; you must specify " |
| 158 "--ui-test-action-max-timeout to have a value of at least 100000."; | 163 "--ui-test-action-max-timeout to have a value of at least 100000."; |
| 159 | 164 |
| 160 content::WebContents* left_tab = | 165 content::WebContents* left_tab = |
| 161 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); | 166 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); |
| 162 content::WebContents* right_tab = | 167 content::WebContents* right_tab = |
| 163 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); | 168 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); |
| 164 | 169 |
| 165 SetupPeerconnectionWithLocalStream(left_tab); | 170 SetupPeerconnectionWithLocalStream(left_tab); |
| 166 SetupPeerconnectionWithoutLocalStream(right_tab); | 171 SetupPeerconnectionWithoutLocalStream(right_tab); |
| 167 | 172 |
| 168 NegotiateCall(left_tab, right_tab, video_codec); | 173 if (!video_codec.empty()) { |
| 174 SetDefaultVideoCodec(left_tab, video_codec); | |
| 175 SetDefaultVideoCodec(right_tab, video_codec); | |
| 176 } | |
| 177 if (opus_dtx) { | |
| 178 EnableOpusDtx(left_tab); | |
| 179 EnableOpusDtx(right_tab); | |
| 180 } | |
| 181 NegotiateCall(left_tab, right_tab); | |
| 169 | 182 |
| 170 // Remote video will only play in one tab since the call is one-way. | 183 // Remote video will only play in one tab since the call is one-way. |
| 171 StartDetectingVideo(right_tab, "remote-view"); | 184 StartDetectingVideo(right_tab, "remote-view"); |
| 172 WaitForVideoToPlay(right_tab); | 185 WaitForVideoToPlay(right_tab); |
| 173 | 186 |
| 174 // Let values stabilize, bandwidth ramp up, etc. | 187 // Let values stabilize, bandwidth ramp up, etc. |
| 175 test::SleepInJavascript(left_tab, 60000); | 188 test::SleepInJavascript(left_tab, 60000); |
| 176 | 189 |
| 177 std::unique_ptr<base::DictionaryValue> all_data = | 190 std::unique_ptr<base::DictionaryValue> all_data = |
| 178 MeasureWebRtcInternalsData(10000); | 191 MeasureWebRtcInternalsData(10000); |
| 179 ASSERT_TRUE(all_data.get() != NULL); | 192 ASSERT_TRUE(all_data.get() != NULL); |
| 180 | 193 |
| 181 // This assumes the sending peer connection is always listed first in the | 194 // This assumes the sending peer connection is always listed first in the |
| 182 // data store, and the receiving second. | 195 // data store, and the receiving second. |
| 183 const base::DictionaryValue* first_pc_dict = | 196 const base::DictionaryValue* first_pc_dict = |
| 184 GetDataOnPeerConnection(all_data.get(), 0); | 197 GetDataOnPeerConnection(all_data.get(), 0); |
| 185 ASSERT_TRUE(first_pc_dict != NULL); | 198 ASSERT_TRUE(first_pc_dict != NULL); |
| 186 test::PrintBweForVideoMetrics(*first_pc_dict, "_sendonly", video_codec); | 199 test::PrintBweForVideoMetrics( |
| 187 test::PrintMetricsForSendStreams(*first_pc_dict, "_sendonly", video_codec); | 200 *first_pc_dict, opus_dtx ? "_sendonly_with_opus_dtx" : "_sendonly", |
|
phoglund_chromium
2016/07/28 06:39:01
Maybe pull this out to a helper _MakePerfTestLabel
Ivo-OOO until feb 6
2016/07/28 12:29:31
Done.
| |
| 201 video_codec); | |
| 202 test::PrintMetricsForSendStreams( | |
| 203 *first_pc_dict, opus_dtx ? "_sendonly_with_opus_dtx" : "_sendonly", | |
| 204 video_codec); | |
| 188 | 205 |
| 189 const base::DictionaryValue* second_pc_dict = | 206 const base::DictionaryValue* second_pc_dict = |
| 190 GetDataOnPeerConnection(all_data.get(), 1); | 207 GetDataOnPeerConnection(all_data.get(), 1); |
| 191 ASSERT_TRUE(second_pc_dict != NULL); | 208 ASSERT_TRUE(second_pc_dict != NULL); |
| 192 test::PrintBweForVideoMetrics(*second_pc_dict, "_recvonly", video_codec); | 209 test::PrintBweForVideoMetrics( |
| 193 test::PrintMetricsForRecvStreams(*second_pc_dict, "_recvonly", video_codec); | 210 *second_pc_dict, opus_dtx ? "_recvonly_with_opus_dtx" : "_recvonly", |
| 211 video_codec); | |
| 212 test::PrintMetricsForRecvStreams( | |
| 213 *second_pc_dict, opus_dtx ? "_recvonly_with_opus_dtx" : "_recvonly", | |
| 214 video_codec); | |
| 194 | 215 |
| 195 HangUp(left_tab); | 216 HangUp(left_tab); |
| 196 HangUp(right_tab); | 217 HangUp(right_tab); |
| 197 } | 218 } |
| 198 }; | 219 }; |
| 199 | 220 |
| 200 // This is manual for its long execution time. | 221 // This is manual for its long execution time. |
| 201 | 222 |
| 202 IN_PROC_BROWSER_TEST_F( | 223 IN_PROC_BROWSER_TEST_F( |
| 203 WebRtcPerfBrowserTest, | 224 WebRtcPerfBrowserTest, |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 224 return; | 245 return; |
| 225 } | 246 } |
| 226 RunsAudioVideoCall60SecsAndLogsInternalMetrics("H264"); | 247 RunsAudioVideoCall60SecsAndLogsInternalMetrics("H264"); |
| 227 } | 248 } |
| 228 | 249 |
| 229 #endif // BUILDFLAG(RTC_USE_H264) | 250 #endif // BUILDFLAG(RTC_USE_H264) |
| 230 | 251 |
| 231 IN_PROC_BROWSER_TEST_F( | 252 IN_PROC_BROWSER_TEST_F( |
| 232 WebRtcPerfBrowserTest, | 253 WebRtcPerfBrowserTest, |
| 233 MANUAL_RunsOneWayCall60SecsAndLogsInternalMetricsDefault) { | 254 MANUAL_RunsOneWayCall60SecsAndLogsInternalMetricsDefault) { |
| 234 RunsOneWayCall60SecsAndLogsInternalMetrics(""); | 255 RunsOneWayCall60SecsAndLogsInternalMetrics("", false); |
| 235 } | 256 } |
| 257 | |
| 258 IN_PROC_BROWSER_TEST_F( | |
| 259 WebRtcPerfBrowserTest, | |
| 260 MANUAL_RunsOneWayCall60SecsAndLogsInternalMetricsWithOpusDtx) { | |
| 261 RunsOneWayCall60SecsAndLogsInternalMetrics("", true); | |
| 262 } | |
| OLD | NEW |