blob: e462cb83ac54c4fb4770dd33f7b6787df1fd7a6b [file] [log] [blame]
[email protected]e04331c2014-04-17 17:10:261# Copyright 2014 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
phoglund1d2d8d712014-10-20 11:40:504
nednguyenb82df292015-07-01 20:17:155from telemetry import story
cpaulin1531a182016-04-15 22:22:026from telemetry.page import page as page_module
[email protected]e04331c2014-04-17 17:10:267
8
mcasas3a51d5e2015-12-08 01:37:079class WebrtcPage(page_module.Page):
[email protected]e04331c2014-04-17 17:10:2610
Edward Lemurdb225962017-05-17 19:51:4011 def __init__(self, url, page_set, name, tags):
ehmaldonado78eee2ed2017-03-28 13:16:5412 assert url.startswith('file://webrtc_cases/')
mcasas3a51d5e2015-12-08 01:37:0713 super(WebrtcPage, self).__init__(
Edward Lemurdb225962017-05-17 19:51:4014 url=url, page_set=page_set, name=name, tags=tags)
phoglund1d2d8d712014-10-20 11:40:5015
[email protected]e04331c2014-04-17 17:10:2616
Edward Lemurdb225962017-05-17 19:51:4017class GetUserMedia(WebrtcPage):
cpaulin1531a182016-04-15 22:22:0218 """Why: Acquires a high definition (720p) local stream."""
[email protected]e04331c2014-04-17 17:10:2619
Edward Lemurdb225962017-05-17 19:51:4020 def __init__(self, page_set, tags):
21 super(GetUserMedia, self).__init__(
ehmaldonado78eee2ed2017-03-28 13:16:5422 url='file://webrtc_cases/resolution.html',
cpaulin1531a182016-04-15 22:22:0223 name='hd_local_stream_10s',
Edward Lemurdb225962017-05-17 19:51:4024 page_set=page_set, tags=tags)
phoglund01f80ea2014-09-25 12:28:3225
nednguyen2cdf37c2014-10-14 22:58:3526 def RunPageInteractions(self, action_runner):
phoglund01f80ea2014-09-25 12:28:3227 action_runner.ClickElement('button[id="hd"]')
28 action_runner.Wait(10)
29
[email protected]e04331c2014-04-17 17:10:2630
Edward Lemurdb225962017-05-17 19:51:4031class DataChannel(WebrtcPage):
Edward Lemureca336ec2017-06-30 20:34:5632 """Why: Transfer as much data as possible through a data channel in 10s."""
phoglundb88c29d62015-04-17 09:17:3033
Edward Lemurdb225962017-05-17 19:51:4034 def __init__(self, page_set, tags):
35 super(DataChannel, self).__init__(
ehmaldonado78eee2ed2017-03-28 13:16:5436 url='file://webrtc_cases/datatransfer.html',
Edward Lemureca336ec2017-06-30 20:34:5637 name='10s_datachannel_transfer',
Edward Lemurdb225962017-05-17 19:51:4038 page_set=page_set, tags=tags)
phoglundb88c29d62015-04-17 09:17:3039
40 def RunPageInteractions(self, action_runner):
Edward Lemureca336ec2017-06-30 20:34:5641 action_runner.ExecuteJavaScript('megsToSend.value = 100;')
phoglundb88c29d62015-04-17 09:17:3042 action_runner.ClickElement('button[id="sendTheData"]')
Edward Lemureca336ec2017-06-30 20:34:5643 action_runner.Wait(10)
phoglundb88c29d62015-04-17 09:17:3044
45
Edward Lemurdb225962017-05-17 19:51:4046class AudioCall(WebrtcPage):
47 """Why: Sets up a WebRTC audio call."""
mcasas3a51d5e2015-12-08 01:37:0748
Edward Lemurdb225962017-05-17 19:51:4049 def __init__(self, page_set, codec, tags):
50 super(AudioCall, self).__init__(
51 url='file://webrtc_cases/audio.html?codec=%s' % codec,
52 name='audio_call_%s_10s' % codec.lower(),
53 page_set=page_set, tags=tags)
54 self.codec = codec
mcasas3a51d5e2015-12-08 01:37:0755
56 def RunPageInteractions(self, action_runner):
Edward Lemurdb225962017-05-17 19:51:4057 action_runner.ExecuteJavaScript('codecSelector.value="%s";' % self.codec)
mcasas3a51d5e2015-12-08 01:37:0758 action_runner.ClickElement('button[id="callButton"]')
59 action_runner.Wait(10)
60
Edward Lemurdb225962017-05-17 19:51:4061class CanvasCapturePeerConnection(WebrtcPage):
cpaulin1531a182016-04-15 22:22:0262 """Why: Sets up a canvas capture stream connection to a peer connection."""
63
Edward Lemurdb225962017-05-17 19:51:4064 def __init__(self, page_set, tags):
65 super(CanvasCapturePeerConnection, self).__init__(
ehmaldonado78eee2ed2017-03-28 13:16:5466 url='file://webrtc_cases/canvas-capture.html',
cpaulin1531a182016-04-15 22:22:0267 name='canvas_capture_peer_connection',
Edward Lemurdb225962017-05-17 19:51:4068 page_set=page_set, tags=tags)
cpaulin1531a182016-04-15 22:22:0269
70 def RunPageInteractions(self, action_runner):
71 with action_runner.CreateInteraction('Action_Canvas_PeerConnection',
72 repeatable=False):
ehmaldonado78eee2ed2017-03-28 13:16:5473 action_runner.ClickElement('button[id="startButton"]')
cpaulin1531a182016-04-15 22:22:0274 action_runner.Wait(10)
75
76
charujain3d5fa212017-08-16 17:10:4177class VideoCodecConstraints(WebrtcPage):
78 """Why: Sets up a video codec to a peer connection."""
79
80 def __init__(self, page_set, video_codec, tags):
81 super(VideoCodecConstraints, self).__init__(
82 url='file://webrtc_cases/codec_constraints.html',
83 name='codec_constraints_%s' % video_codec.lower(),
84 page_set=page_set, tags=tags)
85 self.video_codec = video_codec
86
87 def RunPageInteractions(self, action_runner):
88 with action_runner.CreateInteraction('Action_Codec_Constraints',
89 repeatable=False):
90 action_runner.ClickElement('input[id="%s"]' % self.video_codec)
91 action_runner.ClickElement('button[id="startButton"]')
92 action_runner.ClickElement('button[id="callButton"]')
93 action_runner.Wait(20)
94 action_runner.ClickElement('button[id="hangupButton"]')
95
96
Edward Lemurdb225962017-05-17 19:51:4097class MultiplePeerConnections(WebrtcPage):
98 """Why: Sets up several peer connections in the same page."""
ehmaldonado1d381162016-11-02 09:31:0099
Edward Lemurdb225962017-05-17 19:51:40100 def __init__(self, page_set, tags):
101 super(MultiplePeerConnections, self).__init__(
ehmaldonado78eee2ed2017-03-28 13:16:54102 url='file://webrtc_cases/multiple-peerconnections.html',
ehmaldonado1d381162016-11-02 09:31:00103 name='multiple_peerconnections',
Edward Lemurdb225962017-05-17 19:51:40104 page_set=page_set, tags=tags)
ehmaldonado1d381162016-11-02 09:31:00105
106 def RunPageInteractions(self, action_runner):
107 with action_runner.CreateInteraction('Action_Create_PeerConnection',
108 repeatable=False):
ehmaldonado09f367092017-05-26 23:40:17109 # Set the number of peer connections to create to 10.
perezjud42421be2017-02-28 09:40:20110 action_runner.ExecuteJavaScript(
ehmaldonado09f367092017-05-26 23:40:17111 'document.getElementById("num-peerconnections").value=10')
perezjud42421be2017-02-28 09:40:20112 action_runner.ExecuteJavaScript(
ehmaldonado967024f2016-11-08 17:21:55113 'document.getElementById("cpuoveruse-detection").checked=false')
114 action_runner.ClickElement('button[id="start-test"]')
ehmaldonado09f367092017-05-26 23:40:17115 action_runner.Wait(20)
ehmaldonado1d381162016-11-02 09:31:00116
117
Edward Lemur702d0a72017-07-12 19:19:04118class PausePlayPeerConnections(WebrtcPage):
119 """Why: Ensures frequent pause and plays of peer connection streams work."""
120
121 def __init__(self, page_set, tags):
122 super(PausePlayPeerConnections, self).__init__(
123 url='file://webrtc_cases/pause-play.html',
124 name='pause_play_peerconnections',
125 page_set=page_set, tags=tags)
126
127 def RunPageInteractions(self, action_runner):
128 action_runner.ExecuteJavaScript(
129 'startTest({test_runtime_s}, {num_peerconnections},'
130 '{iteration_delay_ms}, "video");'.format(
131 test_runtime_s=20, num_peerconnections=10, iteration_delay_ms=20))
132 action_runner.Wait(20)
133
134
Edward Lemurdb225962017-05-17 19:51:40135class WebrtcPageSet(story.StorySet):
[email protected]e04331c2014-04-17 17:10:26136 def __init__(self):
Edward Lemurdb225962017-05-17 19:51:40137 super(WebrtcPageSet, self).__init__(
ashleymariec3c82af2017-06-14 02:21:54138 cloud_storage_bucket=story.PUBLIC_BUCKET)
[email protected]e04331c2014-04-17 17:10:26139
Edward Lemur702d0a72017-07-12 19:19:04140 self.AddStory(PausePlayPeerConnections(self, tags=['pauseplay']))
rnephewf9fab932017-05-25 17:15:09141 self.AddStory(MultiplePeerConnections(self, tags=['stress']))
Edward Lemurdb225962017-05-17 19:51:40142 self.AddStory(DataChannel(self, tags=['datachannel']))
ehmaldonado09f367092017-05-26 23:40:17143 self.AddStory(GetUserMedia(self, tags=['getusermedia']))
Edward Lemurdb225962017-05-17 19:51:40144 self.AddStory(CanvasCapturePeerConnection(self, tags=['smoothness']))
ehmaldonado09f367092017-05-26 23:40:17145 self.AddStory(AudioCall(self, 'OPUS', tags=['audio']))
146 self.AddStory(AudioCall(self, 'G772', tags=['audio']))
147 self.AddStory(AudioCall(self, 'PCMU', tags=['audio']))
148 self.AddStory(AudioCall(self, 'ISAC/1600', tags=['audio']))
charujain3d5fa212017-08-16 17:10:41149 self.AddStory(VideoCodecConstraints(self, 'H264', tags=['videoConstraints']))
150 self.AddStory(VideoCodecConstraints(self, 'VP8', tags=['videoConstraints']))
151 self.AddStory(VideoCodecConstraints(self, 'VP9', tags=['videoConstraints']))