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 import os | 4 import os |
| 5 | 5 |
| 6 from telemetry import story | |
| 6 from telemetry.page import page as page_module | 7 from telemetry.page import page as page_module |
| 7 from telemetry import story | |
| 8 | 8 |
| 9 | 9 |
| 10 WEBRTC_GITHUB_SAMPLES_URL = 'https://webrtc.github.io/samples/src/content/' | 10 WEBRTC_GITHUB_SAMPLES_URL = 'https://webrtc.github.io/samples/src/content/' |
| 11 CANVAS_CAPTURE_URL = ('https://rawgit.com/cricdecyan/mediarecorder/master/' | |
|
phoglund_chromium
2016/04/08 11:50:22
Maybe call it MEDIARECORDER_GIT_URL, and assign it
cpaulin (no longer in chrome)
2016/04/08 18:01:38
Done.
| |
| 12 'canvascapture/canvas_capture_peerconnection.html') | |
| 11 | 13 |
| 12 | 14 |
| 13 class WebrtcPage(page_module.Page): | 15 class WebrtcPage(page_module.Page): |
| 14 | 16 |
| 15 def __init__(self, url, page_set, name): | 17 def __init__(self, url, page_set, name): |
| 16 super(WebrtcPage, self).__init__( | 18 super(WebrtcPage, self).__init__( |
| 17 url=url, page_set=page_set, name=name) | 19 url=url, page_set=page_set, name=name) |
| 18 | 20 |
| 19 with open(os.path.join(os.path.dirname(__file__), | 21 with open(os.path.join(os.path.dirname(__file__), |
| 20 'webrtc_track_peerconnections.js')) as javascript: | 22 'webrtc_track_peerconnections.js')) as javascript: |
| 21 self.script_to_evaluate_on_commit = javascript.read() | 23 self.script_to_evaluate_on_commit = javascript.read() |
| 22 | 24 |
| 23 | 25 |
| 24 class Page1(WebrtcPage): | 26 class Page1(WebrtcPage): |
| 25 """ Why: Acquires a high definition (720p) local stream. """ | 27 """Why: Acquires a high definition (720p) local stream.""" |
| 26 | 28 |
| 27 def __init__(self, page_set): | 29 def __init__(self, page_set): |
| 28 super(Page1, self).__init__( | 30 super(Page1, self).__init__( |
| 29 url=WEBRTC_GITHUB_SAMPLES_URL + 'getusermedia/resolution/', | 31 url=WEBRTC_GITHUB_SAMPLES_URL + 'getusermedia/resolution/', |
| 30 name='hd_local_stream_10s', | 32 name='hd_local_stream_10s', |
| 31 page_set=page_set) | 33 page_set=page_set) |
| 32 | 34 |
| 33 def RunPageInteractions(self, action_runner): | 35 def RunPageInteractions(self, action_runner): |
| 34 action_runner.ClickElement('button[id="hd"]') | 36 action_runner.ClickElement('button[id="hd"]') |
| 35 action_runner.Wait(10) | 37 action_runner.Wait(10) |
| 36 | 38 |
| 37 | 39 |
| 38 class Page2(WebrtcPage): | 40 class Page2(WebrtcPage): |
| 39 """ Why: Sets up a local video-only WebRTC 720p call for 45 seconds. """ | 41 """Why: Sets up a local video-only WebRTC 720p call for 45 seconds.""" |
| 40 | 42 |
| 41 def __init__(self, page_set): | 43 def __init__(self, page_set): |
| 42 super(Page2, self).__init__( | 44 super(Page2, self).__init__( |
| 43 url=WEBRTC_GITHUB_SAMPLES_URL + 'peerconnection/constraints/', | 45 url=WEBRTC_GITHUB_SAMPLES_URL + 'peerconnection/constraints/', |
| 44 name='720p_call_45s', | 46 name='720p_call_45s', |
| 45 page_set=page_set) | 47 page_set=page_set) |
| 46 | 48 |
| 47 def RunPageInteractions(self, action_runner): | 49 def RunPageInteractions(self, action_runner): |
| 48 with action_runner.CreateInteraction('Action_Create_PeerConnection', | 50 with action_runner.CreateInteraction('Action_Create_PeerConnection', |
| 49 repeatable=False): | 51 repeatable=False): |
| 50 action_runner.ExecuteJavaScript('minWidthInput.value = 1280') | 52 action_runner.ExecuteJavaScript('minWidthInput.value = 1280') |
| 51 action_runner.ExecuteJavaScript('maxWidthInput.value = 1280') | 53 action_runner.ExecuteJavaScript('maxWidthInput.value = 1280') |
| 52 action_runner.ExecuteJavaScript('minHeightInput.value = 720') | 54 action_runner.ExecuteJavaScript('minHeightInput.value = 720') |
| 53 action_runner.ExecuteJavaScript('maxHeightInput.value = 720') | 55 action_runner.ExecuteJavaScript('maxHeightInput.value = 720') |
| 54 action_runner.ClickElement('button[id="getMedia"]') | 56 action_runner.ClickElement('button[id="getMedia"]') |
| 55 action_runner.Wait(2) | 57 action_runner.Wait(2) |
| 56 action_runner.ClickElement('button[id="connect"]') | 58 action_runner.ClickElement('button[id="connect"]') |
| 57 action_runner.Wait(45) | 59 action_runner.Wait(45) |
| 58 | 60 |
| 59 | 61 |
| 60 class Page3(WebrtcPage): | 62 class Page3(WebrtcPage): |
| 61 """ Why: Transfer as much data as possible through a data channel in 20s. """ | 63 """Why: Transfer as much data as possible through a data channel in 20s.""" |
| 62 | 64 |
| 63 def __init__(self, page_set): | 65 def __init__(self, page_set): |
| 64 super(Page3, self).__init__( | 66 super(Page3, self).__init__( |
| 65 url=WEBRTC_GITHUB_SAMPLES_URL + 'datachannel/datatransfer', | 67 url=WEBRTC_GITHUB_SAMPLES_URL + 'datachannel/datatransfer', |
| 66 name="30s_datachannel_transfer", | 68 name='30s_datachannel_transfer', |
| 67 page_set=page_set) | 69 page_set=page_set) |
| 68 | 70 |
| 69 def RunPageInteractions(self, action_runner): | 71 def RunPageInteractions(self, action_runner): |
| 70 # It won't have time to finish the 512 MB, but we're only interested in | 72 # It won't have time to finish the 512 MB, but we're only interested in |
| 71 # cpu + memory anyway rather than how much data we manage to transfer. | 73 # cpu + memory anyway rather than how much data we manage to transfer. |
| 72 action_runner.ExecuteJavaScript('megsToSend.value = 512;') | 74 action_runner.ExecuteJavaScript('megsToSend.value = 512;') |
| 73 action_runner.ClickElement('button[id="sendTheData"]') | 75 action_runner.ClickElement('button[id="sendTheData"]') |
| 74 action_runner.Wait(30) | 76 action_runner.Wait(30) |
| 75 | 77 |
| 76 | 78 |
| 77 | |
| 78 class Page4(WebrtcPage): | 79 class Page4(WebrtcPage): |
| 79 """ Why: Sets up a WebRTC audio call with Opus. """ | 80 """Why: Sets up a WebRTC audio call with Opus.""" |
| 80 | 81 |
| 81 def __init__(self, page_set): | 82 def __init__(self, page_set): |
| 82 super(Page4, self).__init__( | 83 super(Page4, self).__init__( |
| 83 url=WEBRTC_GITHUB_SAMPLES_URL + 'peerconnection/audio/?codec=OPUS', | 84 url=WEBRTC_GITHUB_SAMPLES_URL + 'peerconnection/audio/?codec=OPUS', |
| 84 name='audio_call_opus_10s', | 85 name='audio_call_opus_10s', |
| 85 page_set=page_set) | 86 page_set=page_set) |
| 86 | 87 |
| 87 def RunPageInteractions(self, action_runner): | 88 def RunPageInteractions(self, action_runner): |
| 88 action_runner.ExecuteJavaScript('codecSelector.value="OPUS";') | 89 action_runner.ExecuteJavaScript('codecSelector.value="OPUS";') |
| 89 action_runner.ClickElement('button[id="callButton"]') | 90 action_runner.ClickElement('button[id="callButton"]') |
| 90 action_runner.Wait(10) | 91 action_runner.Wait(10) |
| 91 | 92 |
| 92 | 93 |
| 93 class Page5(WebrtcPage): | 94 class Page5(WebrtcPage): |
| 94 """ Why: Sets up a WebRTC audio call with G722. """ | 95 """Why: Sets up a WebRTC audio call with G722.""" |
| 95 | 96 |
| 96 def __init__(self, page_set): | 97 def __init__(self, page_set): |
| 97 super(Page5, self).__init__( | 98 super(Page5, self).__init__( |
| 98 url=WEBRTC_GITHUB_SAMPLES_URL + 'peerconnection/audio/?codec=G722', | 99 url=WEBRTC_GITHUB_SAMPLES_URL + 'peerconnection/audio/?codec=G722', |
| 99 name='audio_call_g722_10s', | 100 name='audio_call_g722_10s', |
| 100 page_set=page_set) | 101 page_set=page_set) |
| 101 | 102 |
| 102 def RunPageInteractions(self, action_runner): | 103 def RunPageInteractions(self, action_runner): |
| 103 action_runner.ExecuteJavaScript('codecSelector.value="G722";') | 104 action_runner.ExecuteJavaScript('codecSelector.value="G722";') |
| 104 action_runner.ClickElement('button[id="callButton"]') | 105 action_runner.ClickElement('button[id="callButton"]') |
| 105 action_runner.Wait(10) | 106 action_runner.Wait(10) |
| 106 | 107 |
| 107 | 108 |
| 108 class Page6(WebrtcPage): | 109 class Page6(WebrtcPage): |
| 109 """ Why: Sets up a WebRTC audio call with PCMU. """ | 110 """Why: Sets up a WebRTC audio call with PCMU.""" |
| 110 | 111 |
| 111 def __init__(self, page_set): | 112 def __init__(self, page_set): |
| 112 super(Page6, self).__init__( | 113 super(Page6, self).__init__( |
| 113 url=WEBRTC_GITHUB_SAMPLES_URL + 'peerconnection/audio/?codec=PCMU', | 114 url=WEBRTC_GITHUB_SAMPLES_URL + 'peerconnection/audio/?codec=PCMU', |
| 114 name='audio_call_pcmu_10s', | 115 name='audio_call_pcmu_10s', |
| 115 page_set=page_set) | 116 page_set=page_set) |
| 116 | 117 |
| 117 def RunPageInteractions(self, action_runner): | 118 def RunPageInteractions(self, action_runner): |
| 118 action_runner.ExecuteJavaScript('codecSelector.value="PCMU";') | 119 action_runner.ExecuteJavaScript('codecSelector.value="PCMU";') |
| 119 action_runner.ClickElement('button[id="callButton"]') | 120 action_runner.ClickElement('button[id="callButton"]') |
| 120 action_runner.Wait(10) | 121 action_runner.Wait(10) |
| 121 | 122 |
| 122 | 123 |
| 123 class Page7(WebrtcPage): | 124 class Page7(WebrtcPage): |
| 124 """ Why: Sets up a WebRTC audio call with iSAC 16K. """ | 125 """Why: Sets up a WebRTC audio call with iSAC 16K.""" |
| 125 | 126 |
| 126 def __init__(self, page_set): | 127 def __init__(self, page_set): |
| 127 super(Page7, self).__init__( | 128 super(Page7, self).__init__( |
| 128 url=WEBRTC_GITHUB_SAMPLES_URL + 'peerconnection/audio/?codec=ISAC_16K', | 129 url=WEBRTC_GITHUB_SAMPLES_URL + 'peerconnection/audio/?codec=ISAC_16K', |
| 129 name='audio_call_isac16k_10s', | 130 name='audio_call_isac16k_10s', |
| 130 page_set=page_set) | 131 page_set=page_set) |
| 131 | 132 |
| 132 def RunPageInteractions(self, action_runner): | 133 def RunPageInteractions(self, action_runner): |
| 133 action_runner.ExecuteJavaScript('codecSelector.value="ISAC/16000";') | 134 action_runner.ExecuteJavaScript('codecSelector.value="ISAC/16000";') |
| 134 action_runner.ClickElement('button[id="callButton"]') | 135 action_runner.ClickElement('button[id="callButton"]') |
| 135 action_runner.Wait(10) | 136 action_runner.Wait(10) |
| 136 | 137 |
| 137 | 138 |
| 139 class Page8(WebrtcPage): | |
| 140 """Why: Sets up a canvas capture stream connection to a peer connection.""" | |
| 141 | |
| 142 def __init__(self, page_set): | |
| 143 super(Page8, self).__init__( | |
| 144 url=CANVAS_CAPTURE_URL, | |
| 145 name='canvas_capture_peer_connection', | |
| 146 page_set=page_set) | |
| 147 | |
| 148 def RunPageInteractions(self, action_runner): | |
| 149 with action_runner.CreateInteraction('Action_Canvas_PeerConnection', | |
| 150 repeatable=False): | |
| 151 action_runner.ExecuteJavaScript('draw();') | |
| 152 action_runner.ExecuteJavaScript('doCanvasCaptureAndPeerConnection();') | |
| 153 action_runner.Wait(10) | |
| 154 | |
| 155 | |
| 138 class WebrtcGetusermediaPageSet(story.StorySet): | 156 class WebrtcGetusermediaPageSet(story.StorySet): |
| 139 """ WebRTC tests for local getUserMedia: video capture and playback. """ | 157 """WebRTC tests for local getUserMedia: video capture and playback.""" |
| 140 | 158 |
| 141 def __init__(self): | 159 def __init__(self): |
| 142 super(WebrtcGetusermediaPageSet, self).__init__( | 160 super(WebrtcGetusermediaPageSet, self).__init__( |
| 143 archive_data_file='data/webrtc_getusermedia_cases.json', | 161 archive_data_file='data/webrtc_getusermedia_cases.json', |
| 144 cloud_storage_bucket=story.PUBLIC_BUCKET) | 162 cloud_storage_bucket=story.PUBLIC_BUCKET) |
| 145 | 163 |
| 146 self.AddStory(Page1(self)) | 164 self.AddStory(Page1(self)) |
| 147 | 165 |
| 148 | 166 |
| 149 class WebrtcPeerconnectionPageSet(story.StorySet): | 167 class WebrtcPeerconnectionPageSet(story.StorySet): |
| 150 """ WebRTC tests for Real-time video and audio communication. """ | 168 """WebRTC tests for Real-time video and audio communication.""" |
| 151 | 169 |
| 152 def __init__(self): | 170 def __init__(self): |
| 153 super(WebrtcPeerconnectionPageSet, self).__init__( | 171 super(WebrtcPeerconnectionPageSet, self).__init__( |
| 154 archive_data_file='data/webrtc_peerconnection_cases.json', | 172 archive_data_file='data/webrtc_peerconnection_cases.json', |
| 155 cloud_storage_bucket=story.PUBLIC_BUCKET) | 173 cloud_storage_bucket=story.PUBLIC_BUCKET) |
| 156 | 174 |
| 157 self.AddStory(Page2(self)) | 175 self.AddStory(Page2(self)) |
| 158 | 176 |
| 159 | 177 |
| 160 class WebrtcDatachannelPageSet(story.StorySet): | 178 class WebrtcDatachannelPageSet(story.StorySet): |
| 161 """ WebRTC tests for Real-time communication via the data channel. """ | 179 """WebRTC tests for Real-time communication via the data channel.""" |
| 162 | 180 |
| 163 def __init__(self): | 181 def __init__(self): |
| 164 super(WebrtcDatachannelPageSet, self).__init__( | 182 super(WebrtcDatachannelPageSet, self).__init__( |
| 165 archive_data_file='data/webrtc_datachannel_cases.json', | 183 archive_data_file='data/webrtc_datachannel_cases.json', |
| 166 cloud_storage_bucket=story.PUBLIC_BUCKET) | 184 cloud_storage_bucket=story.PUBLIC_BUCKET) |
| 167 | 185 |
| 168 self.AddStory(Page3(self)) | 186 self.AddStory(Page3(self)) |
| 169 | 187 |
| 188 | |
| 170 class WebrtcAudioPageSet(story.StorySet): | 189 class WebrtcAudioPageSet(story.StorySet): |
| 171 """ WebRTC tests for Real-time audio communication. """ | 190 """WebRTC tests for Real-time audio communication.""" |
| 172 | 191 |
| 173 def __init__(self): | 192 def __init__(self): |
| 174 super(WebrtcAudioPageSet, self).__init__( | 193 super(WebrtcAudioPageSet, self).__init__( |
| 175 archive_data_file='data/webrtc_audio_cases.json', | 194 archive_data_file='data/webrtc_audio_cases.json', |
| 176 cloud_storage_bucket=story.PUBLIC_BUCKET) | 195 cloud_storage_bucket=story.PUBLIC_BUCKET) |
| 177 | 196 |
| 178 self.AddStory(Page4(self)) | 197 self.AddStory(Page4(self)) |
| 179 self.AddStory(Page5(self)) | 198 self.AddStory(Page5(self)) |
| 180 self.AddStory(Page6(self)) | 199 self.AddStory(Page6(self)) |
| 181 self.AddStory(Page7(self)) | 200 self.AddStory(Page7(self)) |
| 201 | |
| 202 | |
| 203 class WebrtcRenderingPageSet(story.StorySet): | |
| 204 """WebRTC tests for video rendering.""" | |
| 205 | |
| 206 def __init__(self): | |
| 207 super(WebrtcRenderingPageSet, self).__init__( | |
| 208 archive_data_file='data/webrtc_smoothness_cases.json', | |
| 209 cloud_storage_bucket=story.PARTNER_BUCKET) | |
| 210 | |
| 211 self.AddStory(Page2(self)) | |
| 212 self.AddStory(Page8(self)) | |
| OLD | NEW |