Delete chrome.mediaGalleriesPrivate because the functionality unique to it has since...
[chromium-blink-merge.git] / tools / perf / page_sets / webrtc_cases.py
blob1bd0f9cceb34f39320676d39caf599d7d99403df
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 import os
6 from telemetry.page import page as page_module
7 from telemetry.page import page_set as page_set_module
10 class WebrtcCasesPage(page_module.Page):
12 def __init__(self, url, page_set):
13 super(WebrtcCasesPage, self).__init__(url=url, page_set=page_set)
15 with open(os.path.join(os.path.dirname(__file__),
16 'webrtc_track_peerconnections.js')) as javascript:
17 self.script_to_evaluate_on_commit = javascript.read()
20 class Page1(WebrtcCasesPage):
22 """ Why: Acquires a vga local stream. """
24 def __init__(self, page_set):
25 super(Page1, self).__init__(
26 url=('http://googlechrome.github.io/webrtc/samples/web/content/'
27 'getusermedia/gum/'),
28 page_set=page_set)
30 def RunPageInteractions(self, action_runner):
31 action_runner.Wait(10)
34 class Page2(WebrtcCasesPage):
36 """ Why: Sets up a local WebRTC call. """
38 def __init__(self, page_set):
39 super(Page2, self).__init__(
40 url=('http://googlechrome.github.io/webrtc/samples/web/content/'
41 'peerconnection/pc1/'),
42 page_set=page_set)
44 def RunPageInteractions(self, action_runner):
45 action_runner.ClickElement('button[id="startButton"]')
46 action_runner.Wait(2)
47 action_runner.ClickElement('button[id="callButton"]')
48 action_runner.Wait(10)
49 action_runner.ClickElement('button[id="hangupButton"]')
52 class Page3(WebrtcCasesPage):
54 """ Why: Acquires a high definition local stream. """
56 def __init__(self, page_set):
57 super(Page3, self).__init__(
58 url=('http://googlechrome.github.io/webrtc/samples/web/content/'
59 'getusermedia/resolution/'),
60 page_set=page_set)
62 def RunPageInteractions(self, action_runner):
63 action_runner.ClickElement('button[id="hd"]')
64 action_runner.Wait(10)
67 class Page4(WebrtcCasesPage):
69 """ Why: Sets up a WebRTC audio call with Opus. """
71 def __init__(self, page_set):
72 super(Page4, self).__init__(
73 url=('http://googlechrome.github.io/webrtc/samples/web/content/'
74 'peerconnection/audio/?codec=OPUS'),
75 page_set=page_set)
77 def RunPageInteractions(self, action_runner):
78 action_runner.ExecuteJavaScript('codecSelector.value="OPUS";')
79 action_runner.ClickElement('button[id="callButton"]')
80 action_runner.Wait(10)
83 class Page5(WebrtcCasesPage):
85 """ Why: Sets up a WebRTC audio call with G722. """
87 def __init__(self, page_set):
88 super(Page5, self).__init__(
89 url=('http://googlechrome.github.io/webrtc/samples/web/content/'
90 'peerconnection/audio/?codec=G722'),
91 page_set=page_set)
93 def RunPageInteractions(self, action_runner):
94 action_runner.ExecuteJavaScript('codecSelector.value="G722";')
95 action_runner.ClickElement('button[id="callButton"]')
96 action_runner.Wait(10)
99 class Page6(WebrtcCasesPage):
101 """ Why: Sets up a WebRTC audio call with PCMU. """
103 def __init__(self, page_set):
104 super(Page6, self).__init__(
105 url=('http://googlechrome.github.io/webrtc/samples/web/content/'
106 'peerconnection/audio/?codec=PCMU'),
107 page_set=page_set)
109 def RunPageInteractions(self, action_runner):
110 action_runner.ExecuteJavaScript('codecSelector.value="PCMU";')
111 action_runner.ClickElement('button[id="callButton"]')
112 action_runner.Wait(10)
115 class Page7(WebrtcCasesPage):
117 """ Why: Sets up a WebRTC audio call with iSAC 16K. """
119 def __init__(self, page_set):
120 super(Page7, self).__init__(
121 url=('http://googlechrome.github.io/webrtc/samples/web/content/'
122 'peerconnection/audio/?codec=ISAC_16K'),
123 page_set=page_set)
125 def RunPageInteractions(self, action_runner):
126 action_runner.ExecuteJavaScript('codecSelector.value="ISAC/16000";')
127 action_runner.ClickElement('button[id="callButton"]')
128 action_runner.Wait(10)
131 class WebrtcCasesPageSet(page_set_module.PageSet):
133 """ WebRTC tests for Real-time audio and video communication. """
135 def __init__(self):
136 super(WebrtcCasesPageSet, self).__init__(
137 archive_data_file='data/webrtc_cases.json',
138 bucket=page_set_module.PUBLIC_BUCKET)
140 self.AddUserStory(Page1(self))
141 self.AddUserStory(Page2(self))
142 self.AddUserStory(Page3(self))
143 self.AddUserStory(Page1(self))
144 self.AddUserStory(Page2(self))
145 self.AddUserStory(Page3(self))
146 self.AddUserStory(Page4(self))
147 self.AddUserStory(Page5(self))
148 self.AddUserStory(Page6(self))
149 self.AddUserStory(Page7(self))