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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/files/file_util.h" | 6 #include "base/files/file_util.h" |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 chrome::AddTabAt(browser(), GURL(), -1, true); | 94 chrome::AddTabAt(browser(), GURL(), -1, true); |
95 ui_test_utils::NavigateToURL(browser(), GURL("chrome://webrtc-internals")); | 95 ui_test_utils::NavigateToURL(browser(), GURL("chrome://webrtc-internals")); |
96 content::WebContents* webrtc_internals_tab = | 96 content::WebContents* webrtc_internals_tab = |
97 browser()->tab_strip_model()->GetActiveWebContents(); | 97 browser()->tab_strip_model()->GetActiveWebContents(); |
98 | 98 |
99 test::SleepInJavascript(webrtc_internals_tab, duration_msec); | 99 test::SleepInJavascript(webrtc_internals_tab, duration_msec); |
100 | 100 |
101 return scoped_ptr<base::DictionaryValue>( | 101 return scoped_ptr<base::DictionaryValue>( |
102 GetWebrtcInternalsData(webrtc_internals_tab)); | 102 GetWebrtcInternalsData(webrtc_internals_tab)); |
103 } | 103 } |
| 104 |
| 105 void RunsAudioVideoCall60SecsAndLogsInternalMetrics( |
| 106 const std::string& video_codec) { |
| 107 ASSERT_TRUE(test::HasReferenceFilesInCheckout()); |
| 108 ASSERT_TRUE(embedded_test_server()->Start()); |
| 109 |
| 110 ASSERT_GE(TestTimeouts::action_max_timeout().InSeconds(), 100) |
| 111 << "This is a long-running test; you must specify " |
| 112 "--ui-test-action-max-timeout to have a value of at least 100000."; |
| 113 |
| 114 content::WebContents* left_tab = |
| 115 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); |
| 116 content::WebContents* right_tab = |
| 117 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); |
| 118 |
| 119 SetupPeerconnectionWithLocalStream(left_tab); |
| 120 SetupPeerconnectionWithLocalStream(right_tab); |
| 121 |
| 122 NegotiateCall(left_tab, right_tab, video_codec); |
| 123 |
| 124 StartDetectingVideo(left_tab, "remote-view"); |
| 125 StartDetectingVideo(right_tab, "remote-view"); |
| 126 |
| 127 WaitForVideoToPlay(left_tab); |
| 128 WaitForVideoToPlay(right_tab); |
| 129 |
| 130 // Let values stabilize, bandwidth ramp up, etc. |
| 131 test::SleepInJavascript(left_tab, 60000); |
| 132 |
| 133 // Start measurements. |
| 134 scoped_ptr<base::DictionaryValue> all_data = |
| 135 MeasureWebRtcInternalsData(10000); |
| 136 ASSERT_TRUE(all_data.get() != NULL); |
| 137 |
| 138 const base::DictionaryValue* first_pc_dict = |
| 139 GetDataOnPeerConnection(all_data.get(), 0); |
| 140 ASSERT_TRUE(first_pc_dict != NULL); |
| 141 test::PrintBweForVideoMetrics(*first_pc_dict, "", video_codec); |
| 142 test::PrintMetricsForAllStreams(*first_pc_dict, "", video_codec); |
| 143 |
| 144 HangUp(left_tab); |
| 145 HangUp(right_tab); |
| 146 } |
| 147 |
| 148 void RunsOneWayCall60SecsAndLogsInternalMetrics( |
| 149 const std::string& video_codec) { |
| 150 ASSERT_TRUE(test::HasReferenceFilesInCheckout()); |
| 151 ASSERT_TRUE(embedded_test_server()->Start()); |
| 152 |
| 153 ASSERT_GE(TestTimeouts::action_max_timeout().InSeconds(), 100) |
| 154 << "This is a long-running test; you must specify " |
| 155 "--ui-test-action-max-timeout to have a value of at least 100000."; |
| 156 |
| 157 content::WebContents* left_tab = |
| 158 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); |
| 159 content::WebContents* right_tab = |
| 160 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); |
| 161 |
| 162 SetupPeerconnectionWithLocalStream(left_tab); |
| 163 SetupPeerconnectionWithoutLocalStream(right_tab); |
| 164 |
| 165 NegotiateCall(left_tab, right_tab, video_codec); |
| 166 |
| 167 // Remote video will only play in one tab since the call is one-way. |
| 168 StartDetectingVideo(right_tab, "remote-view"); |
| 169 WaitForVideoToPlay(right_tab); |
| 170 |
| 171 // Let values stabilize, bandwidth ramp up, etc. |
| 172 test::SleepInJavascript(left_tab, 60000); |
| 173 |
| 174 scoped_ptr<base::DictionaryValue> all_data = |
| 175 MeasureWebRtcInternalsData(10000); |
| 176 ASSERT_TRUE(all_data.get() != NULL); |
| 177 |
| 178 // This assumes the sending peer connection is always listed first in the |
| 179 // data store, and the receiving second. |
| 180 const base::DictionaryValue* first_pc_dict = |
| 181 GetDataOnPeerConnection(all_data.get(), 0); |
| 182 ASSERT_TRUE(first_pc_dict != NULL); |
| 183 test::PrintBweForVideoMetrics(*first_pc_dict, "_sendonly", video_codec); |
| 184 test::PrintMetricsForAllStreams(*first_pc_dict, "_sendonly", video_codec); |
| 185 |
| 186 const base::DictionaryValue* second_pc_dict = |
| 187 GetDataOnPeerConnection(all_data.get(), 1); |
| 188 ASSERT_TRUE(second_pc_dict != NULL); |
| 189 test::PrintBweForVideoMetrics(*second_pc_dict, "_recvonly", video_codec); |
| 190 test::PrintMetricsForAllStreams(*second_pc_dict, "_recvonly", video_codec); |
| 191 |
| 192 HangUp(left_tab); |
| 193 HangUp(right_tab); |
| 194 } |
104 }; | 195 }; |
105 | 196 |
106 // This is manual for its long execution time. | 197 // This is manual for its long execution time. |
107 IN_PROC_BROWSER_TEST_F(WebRtcPerfBrowserTest, | |
108 MANUAL_RunsAudioVideoCall60SecsAndLogsInternalMetrics) { | |
109 ASSERT_TRUE(test::HasReferenceFilesInCheckout()); | |
110 ASSERT_TRUE(embedded_test_server()->Start()); | |
111 | 198 |
112 ASSERT_GE(TestTimeouts::action_max_timeout().InSeconds(), 100) << | 199 // The video codec name is now appended to result bucket (e.g. 'video_tx_VP8'). |
113 "This is a long-running test; you must specify " | 200 // TODO(asapersson): Keep test below using the default video codec (which do |
114 "--ui-test-action-max-timeout to have a value of at least 100000."; | 201 // not have the codec name appended ('video_tx')) until new tests have been |
115 | 202 // running for some time. |
116 content::WebContents* left_tab = | 203 IN_PROC_BROWSER_TEST_F( |
117 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); | 204 WebRtcPerfBrowserTest, |
118 content::WebContents* right_tab = | 205 MANUAL_RunsAudioVideoCall60SecsAndLogsInternalMetricsDefault) { |
119 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); | 206 RunsAudioVideoCall60SecsAndLogsInternalMetrics(""); |
120 | |
121 SetupPeerconnectionWithLocalStream(left_tab); | |
122 SetupPeerconnectionWithLocalStream(right_tab); | |
123 | |
124 NegotiateCall(left_tab, right_tab); | |
125 | |
126 StartDetectingVideo(left_tab, "remote-view"); | |
127 StartDetectingVideo(right_tab, "remote-view"); | |
128 | |
129 WaitForVideoToPlay(left_tab); | |
130 WaitForVideoToPlay(right_tab); | |
131 | |
132 // Let values stabilize, bandwidth ramp up, etc. | |
133 test::SleepInJavascript(left_tab, 60000); | |
134 | |
135 // Start measurements. | |
136 scoped_ptr<base::DictionaryValue> all_data = | |
137 MeasureWebRtcInternalsData(10000); | |
138 ASSERT_TRUE(all_data.get() != NULL); | |
139 | |
140 const base::DictionaryValue* first_pc_dict = | |
141 GetDataOnPeerConnection(all_data.get(), 0); | |
142 ASSERT_TRUE(first_pc_dict != NULL); | |
143 test::PrintBweForVideoMetrics(*first_pc_dict, ""); | |
144 test::PrintMetricsForAllStreams(*first_pc_dict, ""); | |
145 | |
146 HangUp(left_tab); | |
147 HangUp(right_tab); | |
148 } | 207 } |
149 | 208 |
150 IN_PROC_BROWSER_TEST_F(WebRtcPerfBrowserTest, | 209 IN_PROC_BROWSER_TEST_F( |
151 MANUAL_RunsOneWayCall60SecsAndLogsInternalMetrics) { | 210 WebRtcPerfBrowserTest, |
152 ASSERT_TRUE(test::HasReferenceFilesInCheckout()); | 211 MANUAL_RunsAudioVideoCall60SecsAndLogsInternalMetricsVp8) { |
153 ASSERT_TRUE(embedded_test_server()->Start()); | 212 RunsAudioVideoCall60SecsAndLogsInternalMetrics("VP8"); |
| 213 } |
154 | 214 |
155 ASSERT_GE(TestTimeouts::action_max_timeout().InSeconds(), 100) << | 215 IN_PROC_BROWSER_TEST_F( |
156 "This is a long-running test; you must specify " | 216 WebRtcPerfBrowserTest, |
157 "--ui-test-action-max-timeout to have a value of at least 100000."; | 217 MANUAL_RunsAudioVideoCall60SecsAndLogsInternalMetricsVp9) { |
| 218 RunsAudioVideoCall60SecsAndLogsInternalMetrics("VP9"); |
| 219 } |
158 | 220 |
159 content::WebContents* left_tab = | 221 IN_PROC_BROWSER_TEST_F( |
160 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); | 222 WebRtcPerfBrowserTest, |
161 content::WebContents* right_tab = | 223 MANUAL_RunsOneWayCall60SecsAndLogsInternalMetricsDefault) { |
162 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); | 224 RunsOneWayCall60SecsAndLogsInternalMetrics(""); |
| 225 } |
163 | 226 |
164 SetupPeerconnectionWithLocalStream(left_tab); | |
165 SetupPeerconnectionWithoutLocalStream(right_tab); | |
166 | |
167 NegotiateCall(left_tab, right_tab); | |
168 | |
169 // Remote video will only play in one tab since the call is one-way. | |
170 StartDetectingVideo(right_tab, "remote-view"); | |
171 WaitForVideoToPlay(right_tab); | |
172 | |
173 // Let values stabilize, bandwidth ramp up, etc. | |
174 test::SleepInJavascript(left_tab, 60000); | |
175 | |
176 scoped_ptr<base::DictionaryValue> all_data = | |
177 MeasureWebRtcInternalsData(10000); | |
178 ASSERT_TRUE(all_data.get() != NULL); | |
179 | |
180 // This assumes the sending peer connection is always listed first in the | |
181 // data store, and the receiving second. | |
182 const base::DictionaryValue* first_pc_dict = | |
183 GetDataOnPeerConnection(all_data.get(), 0); | |
184 ASSERT_TRUE(first_pc_dict != NULL); | |
185 test::PrintBweForVideoMetrics(*first_pc_dict, "_sendonly"); | |
186 test::PrintMetricsForAllStreams(*first_pc_dict, "_sendonly"); | |
187 | |
188 const base::DictionaryValue* second_pc_dict = | |
189 GetDataOnPeerConnection(all_data.get(), 1); | |
190 ASSERT_TRUE(second_pc_dict != NULL); | |
191 test::PrintBweForVideoMetrics(*second_pc_dict, "_recvonly"); | |
192 test::PrintMetricsForAllStreams(*second_pc_dict, "_recvonly"); | |
193 | |
194 HangUp(left_tab); | |
195 HangUp(right_tab); | |
196 } | |
OLD | NEW |