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
3 # found in the LICENSE file.
4 from telemetry.page import page as page_module
5 from telemetry.page import page_set as page_set_module
8 class WebrtcCasesPage(page_module.Page):
10 def __init__(self, url, page_set):
11 super(WebrtcCasesPage, self).__init__(url=url, page_set=page_set)
14 class Page1(WebrtcCasesPage):
16 """ Why: Simple test page only showing a local video stream """
18 def __init__(self, page_set):
19 super(Page1, self).__init__(
20 url='file://webrtc/local-video.html',
23 def RunWebrtc(self, action_runner):
24 action_runner.NavigateToPage(self)
25 action_runner.Wait(10)
26 action_runner.ExecuteJavaScript('checkForErrors();')
29 class Page2(WebrtcCasesPage):
31 """ Why: Loopback video call using the PeerConnection API. """
33 def __init__(self, page_set):
34 super(Page2, self).__init__(
35 url='file://third_party/webrtc/samples/js/demos/html/pc1.html',
38 def RunEndure(self, action_runner):
39 action_runner.ClickElement('button[id="btn1"]')
41 action_runner.ClickElement('button[id="btn2"]')
42 action_runner.Wait(10)
43 action_runner.ClickElement('button[id="btn3"]')
45 def RunWebrtc(self, action_runner):
46 action_runner.ClickElement('button[id="btn1"]')
48 action_runner.ClickElement('button[id="btn2"]')
49 action_runner.Wait(10)
50 action_runner.ClickElement('button[id="btn3"]')
53 class WebrtcCasesPageSet(page_set_module.PageSet):
55 """ WebRTC tests for Real-time audio and video communication. """
58 super(WebrtcCasesPageSet, self).__init__(
59 serving_dirs=['third_party/webrtc/samples/js'])
61 self.AddPage(Page1(self))
62 self.AddPage(Page2(self))