Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: tools/perf/page_sets/webrtc_cases.py

Issue 2761163003: Use local pages for webrtc telemetry tests. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/perf/page_sets/webrtc_cases/datachannel.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 import story
7 from telemetry.page import page as page_module 7 from telemetry.page import page as page_module
8 8
9 9
10 WEBRTC_TEST_PAGES_URL = 'https://test.webrtc.org/manual/'
11 WEBRTC_GITHUB_SAMPLES_URL = 'https://webrtc.github.io/samples/src/content/'
12 MEDIARECORDER_GITHUB_URL = 'https://rawgit.com/cricdecyan/mediarecorder/master/'
13
14
15 class WebrtcPage(page_module.Page): 10 class WebrtcPage(page_module.Page):
16 11
17 def __init__(self, url, page_set, name): 12 def __init__(self, url, page_set, name):
nednguyen 2017/03/21 15:05:13 Add assertion that webrtc apge must be starting wi
18 super(WebrtcPage, self).__init__( 13 super(WebrtcPage, self).__init__(
19 url=url, page_set=page_set, name=name) 14 url=url, page_set=page_set, name=name)
20 15
21 with open(os.path.join(os.path.dirname(__file__), 16 with open(os.path.join(os.path.dirname(__file__),
22 'webrtc_track_peerconnections.js')) as javascript: 17 'webrtc_track_peerconnections.js')) as javascript:
23 self.script_to_evaluate_on_commit = javascript.read() 18 self.script_to_evaluate_on_commit = javascript.read()
24 19
25 20
26 class Page1(WebrtcPage): 21 class Page1(WebrtcPage):
27 """Why: Acquires a high definition (720p) local stream.""" 22 """Why: Acquires a high definition (720p) local stream."""
28 23
29 def __init__(self, page_set): 24 def __init__(self, page_set):
30 super(Page1, self).__init__( 25 super(Page1, self).__init__(
31 url=WEBRTC_GITHUB_SAMPLES_URL + 'getusermedia/resolution/', 26 url='file://webrtc_cases/getusermedia.html',
32 name='hd_local_stream_10s', 27 name='hd_local_stream_10s',
33 page_set=page_set) 28 page_set=page_set)
34 29
35 def RunPageInteractions(self, action_runner): 30 def RunPageInteractions(self, action_runner):
36 action_runner.ClickElement('button[id="hd"]') 31 action_runner.ClickElement('button[id="hd"]')
37 action_runner.Wait(10) 32 action_runner.Wait(10)
38 33
39 34
40 class Page2(WebrtcPage): 35 class Page2(WebrtcPage):
41 """Why: Sets up a local video-only WebRTC 720p call for 45 seconds.""" 36 """Why: Sets up a local video-only WebRTC 720p call for 45 seconds."""
42 37
43 def __init__(self, page_set): 38 def __init__(self, page_set):
44 super(Page2, self).__init__( 39 super(Page2, self).__init__(
45 url=WEBRTC_GITHUB_SAMPLES_URL + 'peerconnection/constraints/', 40 url='file://webrtc_cases/peerconnection.html',
46 name='720p_call_45s', 41 name='720p_call_45s',
47 page_set=page_set) 42 page_set=page_set)
48 43
49 def RunPageInteractions(self, action_runner): 44 def RunPageInteractions(self, action_runner):
50 with action_runner.CreateInteraction('Action_Create_PeerConnection', 45 with action_runner.CreateInteraction('Action_Create_PeerConnection',
51 repeatable=False): 46 repeatable=False):
52 action_runner.ExecuteJavaScript('minWidthInput.value = 1280') 47 action_runner.ExecuteJavaScript('minWidthInput.value = 1280')
53 action_runner.ExecuteJavaScript('maxWidthInput.value = 1280') 48 action_runner.ExecuteJavaScript('maxWidthInput.value = 1280')
54 action_runner.ExecuteJavaScript('minHeightInput.value = 720') 49 action_runner.ExecuteJavaScript('minHeightInput.value = 720')
55 action_runner.ExecuteJavaScript('maxHeightInput.value = 720') 50 action_runner.ExecuteJavaScript('maxHeightInput.value = 720')
56 action_runner.ClickElement('button[id="getMedia"]') 51 action_runner.ClickElement('button[id="getMedia"]')
57 action_runner.Wait(2) 52 action_runner.Wait(2)
58 action_runner.ClickElement('button[id="connect"]') 53 action_runner.ClickElement('button[id="connect"]')
59 action_runner.Wait(45) 54 action_runner.Wait(45)
60 55
61 56
62 class Page3(WebrtcPage): 57 class Page3(WebrtcPage):
63 """Why: Transfer as much data as possible through a data channel in 20s.""" 58 """Why: Transfer as much data as possible through a data channel in 20s."""
64 59
65 def __init__(self, page_set): 60 def __init__(self, page_set):
66 super(Page3, self).__init__( 61 super(Page3, self).__init__(
67 url=WEBRTC_GITHUB_SAMPLES_URL + 'datachannel/datatransfer', 62 url='file://webrtc_cases/datachannel.html',
68 name='30s_datachannel_transfer', 63 name='30s_datachannel_transfer',
69 page_set=page_set) 64 page_set=page_set)
70 65
71 def RunPageInteractions(self, action_runner): 66 def RunPageInteractions(self, action_runner):
72 # It won't have time to finish the 512 MB, but we're only interested in 67 # It won't have time to finish the 512 MB, but we're only interested in
73 # cpu + memory anyway rather than how much data we manage to transfer. 68 # cpu + memory anyway rather than how much data we manage to transfer.
74 action_runner.ExecuteJavaScript('megsToSend.value = 512;') 69 action_runner.ExecuteJavaScript('megsToSend.value = 512;')
75 action_runner.ClickElement('button[id="sendTheData"]') 70 action_runner.ClickElement('button[id="sendTheData"]')
76 action_runner.Wait(30) 71 action_runner.Wait(30)
77 72
78 73
79 class Page4(WebrtcPage): 74 class Page4(WebrtcPage):
80 """Why: Sets up a WebRTC audio call with Opus.""" 75 """Why: Sets up a WebRTC audio call with Opus."""
81 76
82 def __init__(self, page_set): 77 def __init__(self, page_set):
83 super(Page4, self).__init__( 78 super(Page4, self).__init__(
84 url=WEBRTC_GITHUB_SAMPLES_URL + 'peerconnection/audio/?codec=OPUS', 79 url='file://webrtc_cases/peerconnection_audio.html?codec=OPUS',
85 name='audio_call_opus_10s', 80 name='audio_call_opus_10s',
86 page_set=page_set) 81 page_set=page_set)
87 82
88 def RunPageInteractions(self, action_runner): 83 def RunPageInteractions(self, action_runner):
89 action_runner.ExecuteJavaScript('codecSelector.value="OPUS";') 84 action_runner.ExecuteJavaScript('codecSelector.value="OPUS";')
90 action_runner.ClickElement('button[id="callButton"]') 85 action_runner.ClickElement('button[id="callButton"]')
91 action_runner.Wait(10) 86 action_runner.Wait(10)
92 87
93 88
94 class Page5(WebrtcPage): 89 class Page5(WebrtcPage):
95 """Why: Sets up a WebRTC audio call with G722.""" 90 """Why: Sets up a WebRTC audio call with G722."""
96 91
97 def __init__(self, page_set): 92 def __init__(self, page_set):
98 super(Page5, self).__init__( 93 super(Page5, self).__init__(
99 url=WEBRTC_GITHUB_SAMPLES_URL + 'peerconnection/audio/?codec=G722', 94 url='file://webrtc_cases/peerconnection_audio.html?codec=G722',
100 name='audio_call_g722_10s', 95 name='audio_call_g722_10s',
101 page_set=page_set) 96 page_set=page_set)
102 97
103 def RunPageInteractions(self, action_runner): 98 def RunPageInteractions(self, action_runner):
104 action_runner.ExecuteJavaScript('codecSelector.value="G722";') 99 action_runner.ExecuteJavaScript('codecSelector.value="G722";')
105 action_runner.ClickElement('button[id="callButton"]') 100 action_runner.ClickElement('button[id="callButton"]')
106 action_runner.Wait(10) 101 action_runner.Wait(10)
107 102
108 103
109 class Page6(WebrtcPage): 104 class Page6(WebrtcPage):
110 """Why: Sets up a WebRTC audio call with PCMU.""" 105 """Why: Sets up a WebRTC audio call with PCMU."""
111 106
112 def __init__(self, page_set): 107 def __init__(self, page_set):
113 super(Page6, self).__init__( 108 super(Page6, self).__init__(
114 url=WEBRTC_GITHUB_SAMPLES_URL + 'peerconnection/audio/?codec=PCMU', 109 url='file://webrtc_cases/peerconnection_audio.html?codec=PCMU',
115 name='audio_call_pcmu_10s', 110 name='audio_call_pcmu_10s',
116 page_set=page_set) 111 page_set=page_set)
117 112
118 def RunPageInteractions(self, action_runner): 113 def RunPageInteractions(self, action_runner):
119 action_runner.ExecuteJavaScript('codecSelector.value="PCMU";') 114 action_runner.ExecuteJavaScript('codecSelector.value="PCMU";')
120 action_runner.ClickElement('button[id="callButton"]') 115 action_runner.ClickElement('button[id="callButton"]')
121 action_runner.Wait(10) 116 action_runner.Wait(10)
122 117
123 118
124 class Page7(WebrtcPage): 119 class Page7(WebrtcPage):
125 """Why: Sets up a WebRTC audio call with iSAC 16K.""" 120 """Why: Sets up a WebRTC audio call with iSAC 16K."""
126 121
127 def __init__(self, page_set): 122 def __init__(self, page_set):
128 super(Page7, self).__init__( 123 super(Page7, self).__init__(
129 url=WEBRTC_GITHUB_SAMPLES_URL + 'peerconnection/audio/?codec=ISAC_16K', 124 url='file://webrtc_cases/peerconnection_audio.html?codec=ISAC_16K',
130 name='audio_call_isac16k_10s', 125 name='audio_call_isac16k_10s',
131 page_set=page_set) 126 page_set=page_set)
132 127
133 def RunPageInteractions(self, action_runner): 128 def RunPageInteractions(self, action_runner):
134 action_runner.ExecuteJavaScript('codecSelector.value="ISAC/16000";') 129 action_runner.ExecuteJavaScript('codecSelector.value="ISAC/16000";')
135 action_runner.ClickElement('button[id="callButton"]') 130 action_runner.ClickElement('button[id="callButton"]')
136 action_runner.Wait(10) 131 action_runner.Wait(10)
137 132
138 133
139 class Page8(WebrtcPage): 134 class Page8(WebrtcPage):
140 """Why: Sets up a canvas capture stream connection to a peer connection.""" 135 """Why: Sets up a canvas capture stream connection to a peer connection."""
141 136
142 def __init__(self, page_set): 137 def __init__(self, page_set):
143 canvas_capure_html = 'canvascapture/canvas_capture_peerconnection.html'
144 super(Page8, self).__init__( 138 super(Page8, self).__init__(
145 url=MEDIARECORDER_GITHUB_URL + canvas_capure_html, 139 url='file://webrtc_cases/peerconnection_canvas_capture.html',
146 name='canvas_capture_peer_connection', 140 name='canvas_capture_peer_connection',
147 page_set=page_set) 141 page_set=page_set)
148 142
149 def RunPageInteractions(self, action_runner): 143 def RunPageInteractions(self, action_runner):
150 with action_runner.CreateInteraction('Action_Canvas_PeerConnection', 144 with action_runner.CreateInteraction('Action_Canvas_PeerConnection',
151 repeatable=False): 145 repeatable=False):
152 action_runner.WaitForJavaScriptCondition('typeof draw !== "undefined"') 146 action_runner.ClickElement('button[id="startButton"]')
nednguyen 2017/03/21 15:05:14 why are you changing the action to run on the page
153 action_runner.ExecuteJavaScript('draw();')
154 action_runner.ExecuteJavaScript('doCanvasCaptureAndPeerConnection();')
155 action_runner.Wait(10) 147 action_runner.Wait(10)
156 148
157 149
158 class Page9(WebrtcPage): 150 class Page9(WebrtcPage):
159 """Why: Sets up several peerconnections in the same page.""" 151 """Why: Sets up several peerconnections in the same page."""
160 152
161 def __init__(self, page_set): 153 def __init__(self, page_set):
162 super(Page9, self).__init__( 154 super(Page9, self).__init__(
163 url= WEBRTC_TEST_PAGES_URL + 'multiple-peerconnections/', 155 url='file://webrtc_cases/peerconnection_multiple.html',
164 name='multiple_peerconnections', 156 name='multiple_peerconnections',
165 page_set=page_set) 157 page_set=page_set)
166 158
167 def RunPageInteractions(self, action_runner): 159 def RunPageInteractions(self, action_runner):
168 with action_runner.CreateInteraction('Action_Create_PeerConnection', 160 with action_runner.CreateInteraction('Action_Create_PeerConnection',
169 repeatable=False): 161 repeatable=False):
170 # Set the number of peer connections to create to 15. 162 # Set the number of peer connections to create to 15.
171 action_runner.ExecuteJavaScript( 163 action_runner.ExecuteJavaScript(
172 'document.getElementById("num-peerconnections").value=15') 164 'document.getElementById("num-peerconnections").value=15')
173 action_runner.ExecuteJavaScript( 165 action_runner.ExecuteJavaScript(
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 class WebrtcRenderingPageSet(story.StorySet): 229 class WebrtcRenderingPageSet(story.StorySet):
238 """WebRTC tests for video rendering.""" 230 """WebRTC tests for video rendering."""
239 231
240 def __init__(self): 232 def __init__(self):
241 super(WebrtcRenderingPageSet, self).__init__( 233 super(WebrtcRenderingPageSet, self).__init__(
242 archive_data_file='data/webrtc_smoothness_cases.json', 234 archive_data_file='data/webrtc_smoothness_cases.json',
243 cloud_storage_bucket=story.PARTNER_BUCKET) 235 cloud_storage_bucket=story.PARTNER_BUCKET)
244 236
245 self.AddStory(Page2(self)) 237 self.AddStory(Page2(self))
246 self.AddStory(Page8(self)) 238 self.AddStory(Page8(self))
OLDNEW
« no previous file with comments | « no previous file | tools/perf/page_sets/webrtc_cases/datachannel.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698