| 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 MEDIARECORDER_GITHUB_URL = 'https://rawgit.com/cricdecyan/mediarecorder/master/' |
| 11 | 12 |
| 12 | 13 |
| 13 class WebrtcPage(page_module.Page): | 14 class WebrtcPage(page_module.Page): |
| 14 | 15 |
| 15 def __init__(self, url, page_set, name): | 16 def __init__(self, url, page_set, name): |
| 16 super(WebrtcPage, self).__init__( | 17 super(WebrtcPage, self).__init__( |
| 17 url=url, page_set=page_set, name=name) | 18 url=url, page_set=page_set, name=name) |
| 18 | 19 |
| 19 with open(os.path.join(os.path.dirname(__file__), | 20 with open(os.path.join(os.path.dirname(__file__), |
| 20 'webrtc_track_peerconnections.js')) as javascript: | 21 'webrtc_track_peerconnections.js')) as javascript: |
| 21 self.script_to_evaluate_on_commit = javascript.read() | 22 self.script_to_evaluate_on_commit = javascript.read() |
| 22 | 23 |
| 23 | 24 |
| 24 class Page1(WebrtcPage): | 25 class Page1(WebrtcPage): |
| 25 """ Why: Acquires a high definition (720p) local stream. """ | 26 """Why: Acquires a high definition (720p) local stream.""" |
| 26 | 27 |
| 27 def __init__(self, page_set): | 28 def __init__(self, page_set): |
| 28 super(Page1, self).__init__( | 29 super(Page1, self).__init__( |
| 29 url=WEBRTC_GITHUB_SAMPLES_URL + 'getusermedia/resolution/', | 30 url=WEBRTC_GITHUB_SAMPLES_URL + 'getusermedia/resolution/', |
| 30 name='hd_local_stream_10s', | 31 name='hd_local_stream_10s', |
| 31 page_set=page_set) | 32 page_set=page_set) |
| 32 | 33 |
| 33 def RunPageInteractions(self, action_runner): | 34 def RunPageInteractions(self, action_runner): |
| 34 action_runner.ClickElement('button[id="hd"]') | 35 action_runner.ClickElement('button[id="hd"]') |
| 35 action_runner.Wait(10) | 36 action_runner.Wait(10) |
| 36 | 37 |
| 37 | 38 |
| 38 class Page2(WebrtcPage): | 39 class Page2(WebrtcPage): |
| 39 """ Why: Sets up a local video-only WebRTC 720p call for 45 seconds. """ | 40 """Why: Sets up a local video-only WebRTC 720p call for 45 seconds.""" |
| 40 | 41 |
| 41 def __init__(self, page_set): | 42 def __init__(self, page_set): |
| 42 super(Page2, self).__init__( | 43 super(Page2, self).__init__( |
| 43 url=WEBRTC_GITHUB_SAMPLES_URL + 'peerconnection/constraints/', | 44 url=WEBRTC_GITHUB_SAMPLES_URL + 'peerconnection/constraints/', |
| 44 name='720p_call_45s', | 45 name='720p_call_45s', |
| 45 page_set=page_set) | 46 page_set=page_set) |
| 46 | 47 |
| 47 def RunPageInteractions(self, action_runner): | 48 def RunPageInteractions(self, action_runner): |
| 48 with action_runner.CreateInteraction('Action_Create_PeerConnection', | 49 with action_runner.CreateInteraction('Action_Create_PeerConnection', |
| 49 repeatable=False): | 50 repeatable=False): |
| 50 action_runner.ExecuteJavaScript('minWidthInput.value = 1280') | 51 action_runner.ExecuteJavaScript('minWidthInput.value = 1280') |
| 51 action_runner.ExecuteJavaScript('maxWidthInput.value = 1280') | 52 action_runner.ExecuteJavaScript('maxWidthInput.value = 1280') |
| 52 action_runner.ExecuteJavaScript('minHeightInput.value = 720') | 53 action_runner.ExecuteJavaScript('minHeightInput.value = 720') |
| 53 action_runner.ExecuteJavaScript('maxHeightInput.value = 720') | 54 action_runner.ExecuteJavaScript('maxHeightInput.value = 720') |
| 54 action_runner.ClickElement('button[id="getMedia"]') | 55 action_runner.ClickElement('button[id="getMedia"]') |
| 55 action_runner.Wait(2) | 56 action_runner.Wait(2) |
| 56 action_runner.ClickElement('button[id="connect"]') | 57 action_runner.ClickElement('button[id="connect"]') |
| 57 action_runner.Wait(45) | 58 action_runner.Wait(45) |
| 58 | 59 |
| 59 | 60 |
| 60 class Page3(WebrtcPage): | 61 class Page3(WebrtcPage): |
| 61 """ Why: Transfer as much data as possible through a data channel in 20s. """ | 62 """Why: Transfer as much data as possible through a data channel in 20s.""" |
| 62 | 63 |
| 63 def __init__(self, page_set): | 64 def __init__(self, page_set): |
| 64 super(Page3, self).__init__( | 65 super(Page3, self).__init__( |
| 65 url=WEBRTC_GITHUB_SAMPLES_URL + 'datachannel/datatransfer', | 66 url=WEBRTC_GITHUB_SAMPLES_URL + 'datachannel/datatransfer', |
| 66 name="30s_datachannel_transfer", | 67 name='30s_datachannel_transfer', |
| 67 page_set=page_set) | 68 page_set=page_set) |
| 68 | 69 |
| 69 def RunPageInteractions(self, action_runner): | 70 def RunPageInteractions(self, action_runner): |
| 70 # It won't have time to finish the 512 MB, but we're only interested in | 71 # 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. | 72 # cpu + memory anyway rather than how much data we manage to transfer. |
| 72 action_runner.ExecuteJavaScript('megsToSend.value = 512;') | 73 action_runner.ExecuteJavaScript('megsToSend.value = 512;') |
| 73 action_runner.ClickElement('button[id="sendTheData"]') | 74 action_runner.ClickElement('button[id="sendTheData"]') |
| 74 action_runner.Wait(30) | 75 action_runner.Wait(30) |
| 75 | 76 |
| 76 | 77 |
| 77 | |
| 78 class Page4(WebrtcPage): | 78 class Page4(WebrtcPage): |
| 79 """ Why: Sets up a WebRTC audio call with Opus. """ | 79 """Why: Sets up a WebRTC audio call with Opus.""" |
| 80 | 80 |
| 81 def __init__(self, page_set): | 81 def __init__(self, page_set): |
| 82 super(Page4, self).__init__( | 82 super(Page4, self).__init__( |
| 83 url=WEBRTC_GITHUB_SAMPLES_URL + 'peerconnection/audio/?codec=OPUS', | 83 url=WEBRTC_GITHUB_SAMPLES_URL + 'peerconnection/audio/?codec=OPUS', |
| 84 name='audio_call_opus_10s', | 84 name='audio_call_opus_10s', |
| 85 page_set=page_set) | 85 page_set=page_set) |
| 86 | 86 |
| 87 def RunPageInteractions(self, action_runner): | 87 def RunPageInteractions(self, action_runner): |
| 88 action_runner.ExecuteJavaScript('codecSelector.value="OPUS";') | 88 action_runner.ExecuteJavaScript('codecSelector.value="OPUS";') |
| 89 action_runner.ClickElement('button[id="callButton"]') | 89 action_runner.ClickElement('button[id="callButton"]') |
| 90 action_runner.Wait(10) | 90 action_runner.Wait(10) |
| 91 | 91 |
| 92 | 92 |
| 93 class Page5(WebrtcPage): | 93 class Page5(WebrtcPage): |
| 94 """ Why: Sets up a WebRTC audio call with G722. """ | 94 """Why: Sets up a WebRTC audio call with G722.""" |
| 95 | 95 |
| 96 def __init__(self, page_set): | 96 def __init__(self, page_set): |
| 97 super(Page5, self).__init__( | 97 super(Page5, self).__init__( |
| 98 url=WEBRTC_GITHUB_SAMPLES_URL + 'peerconnection/audio/?codec=G722', | 98 url=WEBRTC_GITHUB_SAMPLES_URL + 'peerconnection/audio/?codec=G722', |
| 99 name='audio_call_g722_10s', | 99 name='audio_call_g722_10s', |
| 100 page_set=page_set) | 100 page_set=page_set) |
| 101 | 101 |
| 102 def RunPageInteractions(self, action_runner): | 102 def RunPageInteractions(self, action_runner): |
| 103 action_runner.ExecuteJavaScript('codecSelector.value="G722";') | 103 action_runner.ExecuteJavaScript('codecSelector.value="G722";') |
| 104 action_runner.ClickElement('button[id="callButton"]') | 104 action_runner.ClickElement('button[id="callButton"]') |
| 105 action_runner.Wait(10) | 105 action_runner.Wait(10) |
| 106 | 106 |
| 107 | 107 |
| 108 class Page6(WebrtcPage): | 108 class Page6(WebrtcPage): |
| 109 """ Why: Sets up a WebRTC audio call with PCMU. """ | 109 """Why: Sets up a WebRTC audio call with PCMU.""" |
| 110 | 110 |
| 111 def __init__(self, page_set): | 111 def __init__(self, page_set): |
| 112 super(Page6, self).__init__( | 112 super(Page6, self).__init__( |
| 113 url=WEBRTC_GITHUB_SAMPLES_URL + 'peerconnection/audio/?codec=PCMU', | 113 url=WEBRTC_GITHUB_SAMPLES_URL + 'peerconnection/audio/?codec=PCMU', |
| 114 name='audio_call_pcmu_10s', | 114 name='audio_call_pcmu_10s', |
| 115 page_set=page_set) | 115 page_set=page_set) |
| 116 | 116 |
| 117 def RunPageInteractions(self, action_runner): | 117 def RunPageInteractions(self, action_runner): |
| 118 action_runner.ExecuteJavaScript('codecSelector.value="PCMU";') | 118 action_runner.ExecuteJavaScript('codecSelector.value="PCMU";') |
| 119 action_runner.ClickElement('button[id="callButton"]') | 119 action_runner.ClickElement('button[id="callButton"]') |
| 120 action_runner.Wait(10) | 120 action_runner.Wait(10) |
| 121 | 121 |
| 122 | 122 |
| 123 class Page7(WebrtcPage): | 123 class Page7(WebrtcPage): |
| 124 """ Why: Sets up a WebRTC audio call with iSAC 16K. """ | 124 """Why: Sets up a WebRTC audio call with iSAC 16K.""" |
| 125 | 125 |
| 126 def __init__(self, page_set): | 126 def __init__(self, page_set): |
| 127 super(Page7, self).__init__( | 127 super(Page7, self).__init__( |
| 128 url=WEBRTC_GITHUB_SAMPLES_URL + 'peerconnection/audio/?codec=ISAC_16K', | 128 url=WEBRTC_GITHUB_SAMPLES_URL + 'peerconnection/audio/?codec=ISAC_16K', |
| 129 name='audio_call_isac16k_10s', | 129 name='audio_call_isac16k_10s', |
| 130 page_set=page_set) | 130 page_set=page_set) |
| 131 | 131 |
| 132 def RunPageInteractions(self, action_runner): | 132 def RunPageInteractions(self, action_runner): |
| 133 action_runner.ExecuteJavaScript('codecSelector.value="ISAC/16000";') | 133 action_runner.ExecuteJavaScript('codecSelector.value="ISAC/16000";') |
| 134 action_runner.ClickElement('button[id="callButton"]') | 134 action_runner.ClickElement('button[id="callButton"]') |
| 135 action_runner.Wait(10) | 135 action_runner.Wait(10) |
| 136 | 136 |
| 137 | 137 |
| 138 class Page8(WebrtcPage): |
| 139 """Why: Sets up a canvas capture stream connection to a peer connection.""" |
| 140 |
| 141 def __init__(self, page_set): |
| 142 canvas_capure_html = 'canvascapture/canvas_capture_peerconnection.html' |
| 143 super(Page8, self).__init__( |
| 144 url=MEDIARECORDER_GITHUB_URL + canvas_capure_html, |
| 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 |