OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 # pylint: disable=W0401,W0614 | 4 # pylint: disable=W0401,W0614 |
5 from telemetry.page.actions.all_page_actions import * | 5 from telemetry.page.actions.all_page_actions import * |
6 from telemetry.page import page as page_module | 6 from telemetry.page import page as page_module |
7 from telemetry.page import page_set as page_set_module | 7 from telemetry.page import page_set as page_set_module |
8 | 8 |
9 | 9 |
10 class WebrtcCasesPage(page_module.Page): | 10 class WebrtcCasesPage(page_module.Page): |
11 | 11 |
12 def __init__(self, url, page_set): | 12 def __init__(self, url, page_set): |
13 super(WebrtcCasesPage, self).__init__(url=url, page_set=page_set) | 13 super(WebrtcCasesPage, self).__init__(url=url, page_set=page_set) |
14 | 14 |
15 | 15 |
16 class Page1(WebrtcCasesPage): | 16 class Page1(WebrtcCasesPage): |
17 | 17 |
18 """ Why: Simple test page only showing a local video stream """ | 18 """ Why: Simple test page only showing a local video stream """ |
19 | 19 |
20 def __init__(self, page_set): | 20 def __init__(self, page_set): |
21 super(Page1, self).__init__( | 21 super(Page1, self).__init__( |
22 url='file://webrtc/local-video.html', | 22 url='file://webrtc/local-video.html', |
23 page_set=page_set) | 23 page_set=page_set) |
24 | 24 |
25 def RunWebrtc(self, action_runner): | 25 def RunWebrtc(self, action_runner): |
26 action_runner.NavigateToPage(self) | 26 action_runner.NavigateToPage(self) |
27 action_runner.RunAction(WaitAction( | 27 action_runner.Wait(10) |
28 { | |
29 'seconds': 10 | |
30 })) | |
31 action_runner.ExecuteJavaScript('checkForErrors();') | 28 action_runner.ExecuteJavaScript('checkForErrors();') |
32 | 29 |
33 | 30 |
34 class Page2(WebrtcCasesPage): | 31 class Page2(WebrtcCasesPage): |
35 | 32 |
36 """ Why: Loopback video call using the PeerConnection API. """ | 33 """ Why: Loopback video call using the PeerConnection API. """ |
37 | 34 |
38 def __init__(self, page_set): | 35 def __init__(self, page_set): |
39 super(Page2, self).__init__( | 36 super(Page2, self).__init__( |
40 url='file://third_party/webrtc/samples/js/demos/html/pc1.html', | 37 url='file://third_party/webrtc/samples/js/demos/html/pc1.html', |
41 page_set=page_set) | 38 page_set=page_set) |
42 | 39 |
43 def RunEndure(self, action_runner): | 40 def RunEndure(self, action_runner): |
44 action_runner.RunAction(ClickElementAction( | 41 action_runner.RunAction(ClickElementAction( |
45 { | 42 { |
46 'selector': 'button[id="btn1"]' | 43 'selector': 'button[id="btn1"]' |
47 })) | 44 })) |
48 action_runner.RunAction(WaitAction( | 45 action_runner.Wait(2) |
49 { | |
50 'seconds': 2 | |
51 })) | |
52 action_runner.RunAction(ClickElementAction( | 46 action_runner.RunAction(ClickElementAction( |
53 { | 47 { |
54 'selector': 'button[id="btn2"]' | 48 'selector': 'button[id="btn2"]' |
55 })) | 49 })) |
56 action_runner.RunAction(WaitAction( | 50 action_runner.Wait(10) |
57 { | |
58 'seconds': 10 | |
59 })) | |
60 action_runner.RunAction(ClickElementAction( | 51 action_runner.RunAction(ClickElementAction( |
61 { | 52 { |
62 'selector': 'button[id="btn3"]' | 53 'selector': 'button[id="btn3"]' |
63 })) | 54 })) |
64 | 55 |
65 def RunWebrtc(self, action_runner): | 56 def RunWebrtc(self, action_runner): |
66 action_runner.RunAction(ClickElementAction( | 57 action_runner.RunAction(ClickElementAction( |
67 { | 58 { |
68 'selector': 'button[id="btn1"]' | 59 'selector': 'button[id="btn1"]' |
69 })) | 60 })) |
70 action_runner.RunAction(WaitAction( | 61 action_runner.Wait(2) |
71 { | |
72 'seconds': 2 | |
73 })) | |
74 action_runner.RunAction(ClickElementAction( | 62 action_runner.RunAction(ClickElementAction( |
75 { | 63 { |
76 'selector': 'button[id="btn2"]' | 64 'selector': 'button[id="btn2"]' |
77 })) | 65 })) |
78 action_runner.RunAction(WaitAction( | 66 action_runner.Wait(10) |
79 { | |
80 'seconds': 10 | |
81 })) | |
82 action_runner.RunAction(ClickElementAction( | 67 action_runner.RunAction(ClickElementAction( |
83 { | 68 { |
84 'selector': 'button[id="btn3"]' | 69 'selector': 'button[id="btn3"]' |
85 })) | 70 })) |
86 | 71 |
87 | 72 |
88 class WebrtcCasesPageSet(page_set_module.PageSet): | 73 class WebrtcCasesPageSet(page_set_module.PageSet): |
89 | 74 |
90 """ WebRTC tests for Real-time audio and video communication. """ | 75 """ WebRTC tests for Real-time audio and video communication. """ |
91 | 76 |
92 def __init__(self): | 77 def __init__(self): |
93 super(WebrtcCasesPageSet, self).__init__( | 78 super(WebrtcCasesPageSet, self).__init__( |
94 serving_dirs=['third_party/webrtc/samples/js']) | 79 serving_dirs=['third_party/webrtc/samples/js']) |
95 | 80 |
96 self.AddPage(Page1(self)) | 81 self.AddPage(Page1(self)) |
97 self.AddPage(Page2(self)) | 82 self.AddPage(Page2(self)) |
OLD | NEW |