| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 content::WebContents* webrtc_internals_tab = | 107 content::WebContents* webrtc_internals_tab = |
| 108 browser()->tab_strip_model()->GetActiveWebContents(); | 108 browser()->tab_strip_model()->GetActiveWebContents(); |
| 109 | 109 |
| 110 test::SleepInJavascript(webrtc_internals_tab, duration_msec); | 110 test::SleepInJavascript(webrtc_internals_tab, duration_msec); |
| 111 | 111 |
| 112 return std::unique_ptr<base::DictionaryValue>( | 112 return std::unique_ptr<base::DictionaryValue>( |
| 113 GetWebrtcInternalsData(webrtc_internals_tab)); | 113 GetWebrtcInternalsData(webrtc_internals_tab)); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void RunsAudioVideoCall60SecsAndLogsInternalMetrics( | 116 void RunsAudioVideoCall60SecsAndLogsInternalMetrics( |
| 117 const std::string& video_codec) { | 117 const std::string& video_codec, |
| 118 bool prefer_hw_video_codec) { |
| 118 ASSERT_TRUE(test::HasReferenceFilesInCheckout()); | 119 ASSERT_TRUE(test::HasReferenceFilesInCheckout()); |
| 119 ASSERT_TRUE(embedded_test_server()->Start()); | 120 ASSERT_TRUE(embedded_test_server()->Start()); |
| 120 | 121 |
| 121 ASSERT_GE(TestTimeouts::action_max_timeout().InSeconds(), 100) | 122 ASSERT_GE(TestTimeouts::action_max_timeout().InSeconds(), 100) |
| 122 << "This is a long-running test; you must specify " | 123 << "This is a long-running test; you must specify " |
| 123 "--ui-test-action-max-timeout to have a value of at least 100000."; | 124 "--ui-test-action-max-timeout to have a value of at least 100000."; |
| 124 | 125 |
| 125 content::WebContents* left_tab = | 126 content::WebContents* left_tab = |
| 126 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); | 127 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); |
| 127 content::WebContents* right_tab = | 128 content::WebContents* right_tab = |
| 128 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); | 129 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); |
| 129 | 130 |
| 130 SetupPeerconnectionWithLocalStream(left_tab); | 131 SetupPeerconnectionWithLocalStream(left_tab); |
| 131 SetupPeerconnectionWithLocalStream(right_tab); | 132 SetupPeerconnectionWithLocalStream(right_tab); |
| 132 | 133 |
| 133 if (!video_codec.empty()) { | 134 if (!video_codec.empty()) { |
| 134 SetDefaultVideoCodec(left_tab, video_codec); | 135 SetDefaultVideoCodec(left_tab, video_codec, prefer_hw_video_codec); |
| 135 SetDefaultVideoCodec(right_tab, video_codec); | 136 SetDefaultVideoCodec(right_tab, video_codec, prefer_hw_video_codec); |
| 136 } | 137 } |
| 137 NegotiateCall(left_tab, right_tab); | 138 NegotiateCall(left_tab, right_tab); |
| 138 | 139 |
| 139 StartDetectingVideo(left_tab, "remote-view"); | 140 StartDetectingVideo(left_tab, "remote-view"); |
| 140 StartDetectingVideo(right_tab, "remote-view"); | 141 StartDetectingVideo(right_tab, "remote-view"); |
| 141 | 142 |
| 142 WaitForVideoToPlay(left_tab); | 143 WaitForVideoToPlay(left_tab); |
| 143 WaitForVideoToPlay(right_tab); | 144 WaitForVideoToPlay(right_tab); |
| 144 | 145 |
| 145 // Let values stabilize, bandwidth ramp up, etc. | 146 // Let values stabilize, bandwidth ramp up, etc. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 172 | 173 |
| 173 content::WebContents* left_tab = | 174 content::WebContents* left_tab = |
| 174 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); | 175 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); |
| 175 content::WebContents* right_tab = | 176 content::WebContents* right_tab = |
| 176 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); | 177 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); |
| 177 | 178 |
| 178 SetupPeerconnectionWithLocalStream(left_tab); | 179 SetupPeerconnectionWithLocalStream(left_tab); |
| 179 SetupPeerconnectionWithoutLocalStream(right_tab); | 180 SetupPeerconnectionWithoutLocalStream(right_tab); |
| 180 | 181 |
| 181 if (!video_codec.empty()) { | 182 if (!video_codec.empty()) { |
| 182 SetDefaultVideoCodec(left_tab, video_codec); | 183 SetDefaultVideoCodec(left_tab, video_codec, false /* prefer_hw_codec */); |
| 183 SetDefaultVideoCodec(right_tab, video_codec); | 184 SetDefaultVideoCodec(right_tab, video_codec, false /* prefer_hw_codec */); |
| 184 } | 185 } |
| 185 if (opus_dtx) { | 186 if (opus_dtx) { |
| 186 EnableOpusDtx(left_tab); | 187 EnableOpusDtx(left_tab); |
| 187 EnableOpusDtx(right_tab); | 188 EnableOpusDtx(right_tab); |
| 188 } | 189 } |
| 189 NegotiateCall(left_tab, right_tab); | 190 NegotiateCall(left_tab, right_tab); |
| 190 | 191 |
| 191 // Remote video will only play in one tab since the call is one-way. | 192 // Remote video will only play in one tab since the call is one-way. |
| 192 StartDetectingVideo(right_tab, "remote-view"); | 193 StartDetectingVideo(right_tab, "remote-view"); |
| 193 WaitForVideoToPlay(right_tab); | 194 WaitForVideoToPlay(right_tab); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 221 HangUp(right_tab); | 222 HangUp(right_tab); |
| 222 } | 223 } |
| 223 }; | 224 }; |
| 224 | 225 |
| 225 // This is manual for its long execution time. | 226 // This is manual for its long execution time. |
| 226 | 227 |
| 227 IN_PROC_BROWSER_TEST_F( | 228 IN_PROC_BROWSER_TEST_F( |
| 228 WebRtcInternalsPerfBrowserTest, | 229 WebRtcInternalsPerfBrowserTest, |
| 229 MANUAL_RunsAudioVideoCall60SecsAndLogsInternalMetricsVp8) { | 230 MANUAL_RunsAudioVideoCall60SecsAndLogsInternalMetricsVp8) { |
| 230 base::ThreadRestrictions::ScopedAllowIO allow_io; | 231 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 231 RunsAudioVideoCall60SecsAndLogsInternalMetrics("VP8"); | 232 RunsAudioVideoCall60SecsAndLogsInternalMetrics( |
| 233 "VP8", false /* prefer_hw_video_codec */); |
| 232 } | 234 } |
| 233 | 235 |
| 234 IN_PROC_BROWSER_TEST_F( | 236 IN_PROC_BROWSER_TEST_F( |
| 235 WebRtcInternalsPerfBrowserTest, | 237 WebRtcInternalsPerfBrowserTest, |
| 236 MANUAL_RunsAudioVideoCall60SecsAndLogsInternalMetricsVp9) { | 238 MANUAL_RunsAudioVideoCall60SecsAndLogsInternalMetricsVp9) { |
| 237 base::ThreadRestrictions::ScopedAllowIO allow_io; | 239 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 238 RunsAudioVideoCall60SecsAndLogsInternalMetrics("VP9"); | 240 RunsAudioVideoCall60SecsAndLogsInternalMetrics( |
| 241 "VP9", false /* prefer_hw_video_codec */); |
| 239 } | 242 } |
| 240 | 243 |
| 241 #if BUILDFLAG(RTC_USE_H264) | 244 #if BUILDFLAG(RTC_USE_H264) |
| 242 | 245 |
| 243 IN_PROC_BROWSER_TEST_F( | 246 IN_PROC_BROWSER_TEST_F( |
| 244 WebRtcInternalsPerfBrowserTest, | 247 WebRtcInternalsPerfBrowserTest, |
| 245 MANUAL_RunsAudioVideoCall60SecsAndLogsInternalMetricsH264) { | 248 MANUAL_RunsAudioVideoCall60SecsAndLogsInternalMetricsH264) { |
| 246 base::ThreadRestrictions::ScopedAllowIO allow_io; | 249 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 247 // Only run test if run-time feature corresponding to |rtc_use_h264| is on. | 250 // Only run test if run-time feature corresponding to |rtc_use_h264| is on. |
| 248 if (!base::FeatureList::IsEnabled(content::kWebRtcH264WithOpenH264FFmpeg)) { | 251 if (!base::FeatureList::IsEnabled(content::kWebRtcH264WithOpenH264FFmpeg)) { |
| 249 LOG(WARNING) << "Run-time feature WebRTC-H264WithOpenH264FFmpeg disabled. " | 252 LOG(WARNING) << "Run-time feature WebRTC-H264WithOpenH264FFmpeg disabled. " |
| 250 "Skipping WebRtcInternalsPerfBrowserTest." | 253 "Skipping WebRtcInternalsPerfBrowserTest." |
| 251 "MANUAL_RunsAudioVideoCall60SecsAndLogsInternalMetricsH264 (test " | 254 "MANUAL_RunsAudioVideoCall60SecsAndLogsInternalMetricsH264 (test " |
| 252 "\"OK\")"; | 255 "\"OK\")"; |
| 253 return; | 256 return; |
| 254 } | 257 } |
| 255 RunsAudioVideoCall60SecsAndLogsInternalMetrics("H264"); | 258 RunsAudioVideoCall60SecsAndLogsInternalMetrics( |
| 259 "H264", true /* prefer_hw_video_codec */); |
| 256 } | 260 } |
| 257 | 261 |
| 258 #endif // BUILDFLAG(RTC_USE_H264) | 262 #endif // BUILDFLAG(RTC_USE_H264) |
| 259 | 263 |
| 260 IN_PROC_BROWSER_TEST_F( | 264 IN_PROC_BROWSER_TEST_F( |
| 261 WebRtcInternalsPerfBrowserTest, | 265 WebRtcInternalsPerfBrowserTest, |
| 262 MANUAL_RunsOneWayCall60SecsAndLogsInternalMetricsDefault) { | 266 MANUAL_RunsOneWayCall60SecsAndLogsInternalMetricsDefault) { |
| 263 base::ThreadRestrictions::ScopedAllowIO allow_io; | 267 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 264 RunsOneWayCall60SecsAndLogsInternalMetrics("", false); | 268 RunsOneWayCall60SecsAndLogsInternalMetrics("", false); |
| 265 } | 269 } |
| 266 | 270 |
| 267 IN_PROC_BROWSER_TEST_F( | 271 IN_PROC_BROWSER_TEST_F( |
| 268 WebRtcInternalsPerfBrowserTest, | 272 WebRtcInternalsPerfBrowserTest, |
| 269 MANUAL_RunsOneWayCall60SecsAndLogsInternalMetricsWithOpusDtx) { | 273 MANUAL_RunsOneWayCall60SecsAndLogsInternalMetricsWithOpusDtx) { |
| 270 base::ThreadRestrictions::ScopedAllowIO allow_io; | 274 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 271 RunsOneWayCall60SecsAndLogsInternalMetrics("", true); | 275 RunsOneWayCall60SecsAndLogsInternalMetrics("", true); |
| 272 } | 276 } |
| OLD | NEW |