Home | History | Annotate | Download | only in page_sets
      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 # pylint: disable=W0401,W0614
      5 from telemetry.page.actions.all_page_actions import *
      6 from telemetry.page import page as page_module
      7 from telemetry.page import page_set as page_set_module
      8 
      9 
     10 class WebrtcCasesPage(page_module.Page):
     11 
     12   def __init__(self, url, page_set):
     13     super(WebrtcCasesPage, self).__init__(url=url, page_set=page_set)
     14 
     15 
     16 class Page1(WebrtcCasesPage):
     17 
     18   """ Why: Simple test page only showing a local video stream """
     19 
     20   def __init__(self, page_set):
     21     super(Page1, self).__init__(
     22       url='file://webrtc/local-video.html',
     23       page_set=page_set)
     24 
     25   def RunWebrtc(self, action_runner):
     26     action_runner.NavigateToPage(self)
     27     action_runner.Wait(10)
     28     action_runner.ExecuteJavaScript('checkForErrors();')
     29 
     30 
     31 class Page2(WebrtcCasesPage):
     32 
     33   """ Why: Loopback video call using the PeerConnection API. """
     34 
     35   def __init__(self, page_set):
     36     super(Page2, self).__init__(
     37       url='file://third_party/webrtc/samples/js/demos/html/pc1.html',
     38       page_set=page_set)
     39 
     40   def RunEndure(self, action_runner):
     41     action_runner.ClickElement('button[id="btn1"]')
     42     action_runner.Wait(2)
     43     action_runner.ClickElement('button[id="btn2"]')
     44     action_runner.Wait(10)
     45     action_runner.ClickElement('button[id="btn3"]')
     46 
     47   def RunWebrtc(self, action_runner):
     48     action_runner.ClickElement('button[id="btn1"]')
     49     action_runner.Wait(2)
     50     action_runner.ClickElement('button[id="btn2"]')
     51     action_runner.Wait(10)
     52     action_runner.ClickElement('button[id="btn3"]')
     53 
     54 
     55 class WebrtcCasesPageSet(page_set_module.PageSet):
     56 
     57   """ WebRTC tests for Real-time audio and video communication. """
     58 
     59   def __init__(self):
     60     super(WebrtcCasesPageSet, self).__init__(
     61       serving_dirs=['third_party/webrtc/samples/js'])
     62 
     63     self.AddPage(Page1(self))
     64     self.AddPage(Page2(self))
     65