Commit 8539dc17 authored by Taylor Brandstetter's avatar Taylor Brandstetter Committed by Commit Bot

Add measurement for total data transferred in ten seconds.

Note that this required making WebrtcPage inherit from PressStory.

Bug: chromium:1033483
Change-Id: I98972369b9349c06203da27c6bfc0f62294cb006
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2148277Reviewed-by: default avatarHarald Alvestrand <hta@chromium.org>
Reviewed-by: default avatarBrian Sheedy <bsheedy@chromium.org>
Commit-Queue: Harald Alvestrand <hta@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811983}
parent 920741ee
...@@ -2,12 +2,11 @@ ...@@ -2,12 +2,11 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
from core import perf_benchmark
import page_sets import page_sets
from telemetry import benchmark from telemetry import benchmark
from telemetry.timeline import chrome_trace_category_filter from telemetry.timeline import chrome_trace_category_filter
from telemetry.web_perf import timeline_based_measurement from telemetry.web_perf import timeline_based_measurement
from benchmarks import press
@benchmark.Info(emails=['qiangchen@chromium.org', # For smoothness metrics @benchmark.Info(emails=['qiangchen@chromium.org', # For smoothness metrics
...@@ -15,7 +14,7 @@ from telemetry.web_perf import timeline_based_measurement ...@@ -15,7 +14,7 @@ from telemetry.web_perf import timeline_based_measurement
'phoglund@chromium.org'], 'phoglund@chromium.org'],
component='Blink>WebRTC', component='Blink>WebRTC',
documentation_url='http://bit.ly/webrtc-benchmark') documentation_url='http://bit.ly/webrtc-benchmark')
class WebrtcPerfBenchmark(perf_benchmark.PerfBenchmark): class WebrtcPerfBenchmark(press._PressBenchmark): # pylint: disable=protected-access
"""Base class for WebRTC metrics for real-time communications tests.""" """Base class for WebRTC metrics for real-time communications tests."""
page_set = page_sets.WebrtcPageSet page_set = page_sets.WebrtcPageSet
......
...@@ -2,16 +2,17 @@ ...@@ -2,16 +2,17 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
from page_sets import press_story
from telemetry import story from telemetry import story
from telemetry.page import page as page_module
class WebrtcPage(page_module.Page): class WebrtcPage(press_story.PressStory):
def __init__(self, url, page_set, name, tags): def __init__(self, url, page_set, name, tags):
assert url.startswith('file://webrtc_cases/') assert url.startswith('file://webrtc_cases/')
super(WebrtcPage, self).__init__( self.URL = url
url=url, page_set=page_set, name=name, tags=tags) self.NAME = name
super(WebrtcPage, self).__init__(page_set, tags=tags)
class GetUserMedia(WebrtcPage): class GetUserMedia(WebrtcPage):
...@@ -23,7 +24,7 @@ class GetUserMedia(WebrtcPage): ...@@ -23,7 +24,7 @@ class GetUserMedia(WebrtcPage):
name='hd_local_stream_10s', name='hd_local_stream_10s',
page_set=page_set, tags=tags) page_set=page_set, tags=tags)
def RunPageInteractions(self, action_runner): def ExecuteTest(self, action_runner):
action_runner.ClickElement('button[id="hd"]') action_runner.ClickElement('button[id="hd"]')
action_runner.Wait(10) action_runner.Wait(10)
...@@ -37,11 +38,18 @@ class DataChannel(WebrtcPage): ...@@ -37,11 +38,18 @@ class DataChannel(WebrtcPage):
name='10s_datachannel_transfer', name='10s_datachannel_transfer',
page_set=page_set, tags=tags) page_set=page_set, tags=tags)
def RunPageInteractions(self, action_runner): def ExecuteTest(self, action_runner):
action_runner.ExecuteJavaScript('megsToSend.value = 100;') action_runner.ExecuteJavaScript('megsToSend.value = 100;')
action_runner.ClickElement('button[id="sendTheData"]') action_runner.ClickElement('button[id="sendTheData"]')
action_runner.Wait(10) action_runner.Wait(10)
def ParseTestResults(self, action_runner):
self.AddJavaScriptMeasurement(
'data_transferred',
'bytes',
'receiveProgress.value',
description='Amount of data transferred by data channel in 10 seconds')
class AudioCall(WebrtcPage): class AudioCall(WebrtcPage):
"""Why: Sets up a WebRTC audio call.""" """Why: Sets up a WebRTC audio call."""
...@@ -53,7 +61,7 @@ class AudioCall(WebrtcPage): ...@@ -53,7 +61,7 @@ class AudioCall(WebrtcPage):
page_set=page_set, tags=tags) page_set=page_set, tags=tags)
self.codec = codec self.codec = codec
def RunPageInteractions(self, action_runner): def ExecuteTest(self, action_runner):
action_runner.ExecuteJavaScript('codecSelector.value="%s";' % self.codec) action_runner.ExecuteJavaScript('codecSelector.value="%s";' % self.codec)
action_runner.ClickElement('button[id="callButton"]') action_runner.ClickElement('button[id="callButton"]')
action_runner.Wait(10) action_runner.Wait(10)
...@@ -67,7 +75,7 @@ class CanvasCapturePeerConnection(WebrtcPage): ...@@ -67,7 +75,7 @@ class CanvasCapturePeerConnection(WebrtcPage):
name='canvas_capture_peer_connection', name='canvas_capture_peer_connection',
page_set=page_set, tags=tags) page_set=page_set, tags=tags)
def RunPageInteractions(self, action_runner): def ExecuteTest(self, action_runner):
with action_runner.CreateInteraction('Action_Canvas_PeerConnection', with action_runner.CreateInteraction('Action_Canvas_PeerConnection',
repeatable=False): repeatable=False):
action_runner.ClickElement('button[id="startButton"]') action_runner.ClickElement('button[id="startButton"]')
...@@ -84,7 +92,7 @@ class VideoCodecConstraints(WebrtcPage): ...@@ -84,7 +92,7 @@ class VideoCodecConstraints(WebrtcPage):
page_set=page_set, tags=tags) page_set=page_set, tags=tags)
self.video_codec = video_codec self.video_codec = video_codec
def RunPageInteractions(self, action_runner): def ExecuteTest(self, action_runner):
with action_runner.CreateInteraction('Action_Codec_Constraints', with action_runner.CreateInteraction('Action_Codec_Constraints',
repeatable=False): repeatable=False):
action_runner.ClickElement('input[id="%s"]' % self.video_codec) action_runner.ClickElement('input[id="%s"]' % self.video_codec)
...@@ -103,7 +111,7 @@ class MultiplePeerConnections(WebrtcPage): ...@@ -103,7 +111,7 @@ class MultiplePeerConnections(WebrtcPage):
name='multiple_peerconnections', name='multiple_peerconnections',
page_set=page_set, tags=tags) page_set=page_set, tags=tags)
def RunPageInteractions(self, action_runner): def ExecuteTest(self, action_runner):
with action_runner.CreateInteraction('Action_Create_PeerConnection', with action_runner.CreateInteraction('Action_Create_PeerConnection',
repeatable=False): repeatable=False):
# Set the number of peer connections to create to 10. # Set the number of peer connections to create to 10.
...@@ -124,7 +132,7 @@ class PausePlayPeerConnections(WebrtcPage): ...@@ -124,7 +132,7 @@ class PausePlayPeerConnections(WebrtcPage):
name='pause_play_peerconnections', name='pause_play_peerconnections',
page_set=page_set, tags=tags) page_set=page_set, tags=tags)
def RunPageInteractions(self, action_runner): def ExecuteTest(self, action_runner):
action_runner.ExecuteJavaScript( action_runner.ExecuteJavaScript(
'startTest({test_runtime_s}, {num_peerconnections},' 'startTest({test_runtime_s}, {num_peerconnections},'
'{iteration_delay_ms}, "video");'.format( '{iteration_delay_ms}, "video");'.format(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment