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