| 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 import os | 4 import os |
| 5 | 5 |
| 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 WEBRTC_GITHUB_SAMPLES_URL = 'http://webrtc.github.io/samples/src/content/' |
| 11 |
| 12 |
| 10 class WebrtcCasesPage(page_module.Page): | 13 class WebrtcCasesPage(page_module.Page): |
| 11 | 14 |
| 12 def __init__(self, url, page_set): | 15 def __init__(self, url, page_set): |
| 13 super(WebrtcCasesPage, self).__init__(url=url, page_set=page_set) | 16 super(WebrtcCasesPage, self).__init__(url=url, page_set=page_set) |
| 14 | 17 |
| 15 with open(os.path.join(os.path.dirname(__file__), | 18 with open(os.path.join(os.path.dirname(__file__), |
| 16 'webrtc_track_peerconnections.js')) as javascript: | 19 'webrtc_track_peerconnections.js')) as javascript: |
| 17 self.script_to_evaluate_on_commit = javascript.read() | 20 self.script_to_evaluate_on_commit = javascript.read() |
| 18 | 21 |
| 19 | 22 |
| 20 class Page1(WebrtcCasesPage): | 23 class Page1(WebrtcCasesPage): |
| 21 | 24 |
| 22 """ Why: Acquires a vga local stream. """ | 25 """ Why: Acquires a vga local stream. """ |
| 23 | 26 |
| 24 def __init__(self, page_set): | 27 def __init__(self, page_set): |
| 25 super(Page1, self).__init__( | 28 super(Page1, self).__init__( |
| 26 url=('http://googlechrome.github.io/webrtc/samples/web/content/' | 29 url=WEBRTC_GITHUB_SAMPLES_URL + 'getusermedia/gum/', |
| 27 'getusermedia/gum/'), | |
| 28 page_set=page_set) | 30 page_set=page_set) |
| 29 | 31 |
| 30 def RunPageInteractions(self, action_runner): | 32 def RunPageInteractions(self, action_runner): |
| 31 action_runner.Wait(10) | 33 action_runner.Wait(10) |
| 32 | 34 |
| 33 | 35 |
| 34 class Page2(WebrtcCasesPage): | 36 class Page2(WebrtcCasesPage): |
| 35 | 37 |
| 36 """ Why: Sets up a local WebRTC call. """ | 38 """ Why: Sets up a local WebRTC call. """ |
| 37 | 39 |
| 38 def __init__(self, page_set): | 40 def __init__(self, page_set): |
| 39 super(Page2, self).__init__( | 41 super(Page2, self).__init__( |
| 40 url=('http://googlechrome.github.io/webrtc/samples/web/content/' | 42 url=WEBRTC_GITHUB_SAMPLES_URL + 'peerconnection/pc1/', |
| 41 'peerconnection/pc1/'), | |
| 42 page_set=page_set) | 43 page_set=page_set) |
| 43 | 44 |
| 44 def RunPageInteractions(self, action_runner): | 45 def RunPageInteractions(self, action_runner): |
| 45 action_runner.ClickElement('button[id="startButton"]') | 46 action_runner.ClickElement('button[id="startButton"]') |
| 46 action_runner.Wait(2) | 47 action_runner.Wait(2) |
| 47 action_runner.ClickElement('button[id="callButton"]') | 48 action_runner.ClickElement('button[id="callButton"]') |
| 48 action_runner.Wait(10) | 49 action_runner.Wait(10) |
| 49 action_runner.ClickElement('button[id="hangupButton"]') | 50 action_runner.ClickElement('button[id="hangupButton"]') |
| 50 | 51 |
| 51 | 52 |
| 52 class Page3(WebrtcCasesPage): | 53 class Page3(WebrtcCasesPage): |
| 53 | 54 |
| 54 """ Why: Acquires a high definition local stream. """ | 55 """ Why: Acquires a high definition local stream. """ |
| 55 | 56 |
| 56 def __init__(self, page_set): | 57 def __init__(self, page_set): |
| 57 super(Page3, self).__init__( | 58 super(Page3, self).__init__( |
| 58 url=('http://googlechrome.github.io/webrtc/samples/web/content/' | 59 url=WEBRTC_GITHUB_SAMPLES_URL + 'getusermedia/resolution/', |
| 59 'getusermedia/resolution/'), | |
| 60 page_set=page_set) | 60 page_set=page_set) |
| 61 | 61 |
| 62 def RunPageInteractions(self, action_runner): | 62 def RunPageInteractions(self, action_runner): |
| 63 action_runner.ClickElement('button[id="hd"]') | 63 action_runner.ClickElement('button[id="hd"]') |
| 64 action_runner.Wait(10) | 64 action_runner.Wait(10) |
| 65 | 65 |
| 66 | 66 |
| 67 class Page4(WebrtcCasesPage): | 67 class Page4(WebrtcCasesPage): |
| 68 | 68 |
| 69 """ Why: Sets up a WebRTC audio call with Opus. """ | 69 """ Why: Sets up a WebRTC audio call with Opus. """ |
| 70 | 70 |
| 71 def __init__(self, page_set): | 71 def __init__(self, page_set): |
| 72 super(Page4, self).__init__( | 72 super(Page4, self).__init__( |
| 73 url=('http://googlechrome.github.io/webrtc/samples/web/content/' | 73 url=WEBRTC_GITHUB_SAMPLES_URL + 'peerconnection/audio/?codec=OPUS', |
| 74 'peerconnection/audio/?codec=OPUS'), | |
| 75 page_set=page_set) | 74 page_set=page_set) |
| 76 | 75 |
| 77 def RunPageInteractions(self, action_runner): | 76 def RunPageInteractions(self, action_runner): |
| 78 action_runner.ExecuteJavaScript('codecSelector.value="OPUS";') | 77 action_runner.ExecuteJavaScript('codecSelector.value="OPUS";') |
| 79 action_runner.ClickElement('button[id="callButton"]') | 78 action_runner.ClickElement('button[id="callButton"]') |
| 80 action_runner.Wait(10) | 79 action_runner.Wait(10) |
| 81 | 80 |
| 82 | 81 |
| 83 class Page5(WebrtcCasesPage): | 82 class Page5(WebrtcCasesPage): |
| 84 | 83 |
| 85 """ Why: Sets up a WebRTC audio call with G722. """ | 84 """ Why: Sets up a WebRTC audio call with G722. """ |
| 86 | 85 |
| 87 def __init__(self, page_set): | 86 def __init__(self, page_set): |
| 88 super(Page5, self).__init__( | 87 super(Page5, self).__init__( |
| 89 url=('http://googlechrome.github.io/webrtc/samples/web/content/' | 88 url=WEBRTC_GITHUB_SAMPLES_URL + 'peerconnection/audio/?codec=G722', |
| 90 'peerconnection/audio/?codec=G722'), | |
| 91 page_set=page_set) | 89 page_set=page_set) |
| 92 | 90 |
| 93 def RunPageInteractions(self, action_runner): | 91 def RunPageInteractions(self, action_runner): |
| 94 action_runner.ExecuteJavaScript('codecSelector.value="G722";') | 92 action_runner.ExecuteJavaScript('codecSelector.value="G722";') |
| 95 action_runner.ClickElement('button[id="callButton"]') | 93 action_runner.ClickElement('button[id="callButton"]') |
| 96 action_runner.Wait(10) | 94 action_runner.Wait(10) |
| 97 | 95 |
| 98 | 96 |
| 99 class Page6(WebrtcCasesPage): | 97 class Page6(WebrtcCasesPage): |
| 100 | 98 |
| 101 """ Why: Sets up a WebRTC audio call with PCMU. """ | 99 """ Why: Sets up a WebRTC audio call with PCMU. """ |
| 102 | 100 |
| 103 def __init__(self, page_set): | 101 def __init__(self, page_set): |
| 104 super(Page6, self).__init__( | 102 super(Page6, self).__init__( |
| 105 url=('http://googlechrome.github.io/webrtc/samples/web/content/' | 103 url=WEBRTC_GITHUB_SAMPLES_URL + 'peerconnection/audio/?codec=PCMU', |
| 106 'peerconnection/audio/?codec=PCMU'), | |
| 107 page_set=page_set) | 104 page_set=page_set) |
| 108 | 105 |
| 109 def RunPageInteractions(self, action_runner): | 106 def RunPageInteractions(self, action_runner): |
| 110 action_runner.ExecuteJavaScript('codecSelector.value="PCMU";') | 107 action_runner.ExecuteJavaScript('codecSelector.value="PCMU";') |
| 111 action_runner.ClickElement('button[id="callButton"]') | 108 action_runner.ClickElement('button[id="callButton"]') |
| 112 action_runner.Wait(10) | 109 action_runner.Wait(10) |
| 113 | 110 |
| 114 | 111 |
| 115 class Page7(WebrtcCasesPage): | 112 class Page7(WebrtcCasesPage): |
| 116 | 113 |
| 117 """ Why: Sets up a WebRTC audio call with iSAC 16K. """ | 114 """ Why: Sets up a WebRTC audio call with iSAC 16K. """ |
| 118 | 115 |
| 119 def __init__(self, page_set): | 116 def __init__(self, page_set): |
| 120 super(Page7, self).__init__( | 117 super(Page7, self).__init__( |
| 121 url=('http://googlechrome.github.io/webrtc/samples/web/content/' | 118 url=WEBRTC_GITHUB_SAMPLES_URL + 'peerconnection/audio/?codec=ISAC_16K', |
| 122 'peerconnection/audio/?codec=ISAC_16K'), | |
| 123 page_set=page_set) | 119 page_set=page_set) |
| 124 | 120 |
| 125 def RunPageInteractions(self, action_runner): | 121 def RunPageInteractions(self, action_runner): |
| 126 action_runner.ExecuteJavaScript('codecSelector.value="ISAC/16000";') | 122 action_runner.ExecuteJavaScript('codecSelector.value="ISAC/16000";') |
| 127 action_runner.ClickElement('button[id="callButton"]') | 123 action_runner.ClickElement('button[id="callButton"]') |
| 128 action_runner.Wait(10) | 124 action_runner.Wait(10) |
| 129 | 125 |
| 130 | 126 |
| 127 class Page8(WebrtcCasesPage): |
| 128 |
| 129 """ Why: Sets up a WebRTC 1080p call for 45 seconds. """ |
| 130 |
| 131 def __init__(self, page_set): |
| 132 super(Page8, self).__init__( |
| 133 url=WEBRTC_GITHUB_SAMPLES_URL + 'peerconnection/constraints/', |
| 134 page_set=page_set) |
| 135 |
| 136 def RunPageInteractions(self, action_runner): |
| 137 action_runner.ExecuteJavaScript('minWidthInput.value = 1920') |
| 138 action_runner.ExecuteJavaScript('maxWidthInput.value = 1920') |
| 139 action_runner.ExecuteJavaScript('minHeightInput.value = 1080') |
| 140 action_runner.ExecuteJavaScript('maxHeightInput.value = 1080') |
| 141 action_runner.ClickElement('button[id="getMedia"]') |
| 142 action_runner.Wait(2) |
| 143 action_runner.ClickElement('button[id="connect"]') |
| 144 action_runner.Wait(45) |
| 145 |
| 131 class WebrtcCasesPageSet(page_set_module.PageSet): | 146 class WebrtcCasesPageSet(page_set_module.PageSet): |
| 132 | 147 |
| 133 """ WebRTC tests for Real-time audio and video communication. """ | 148 """ WebRTC tests for Real-time audio and video communication. """ |
| 134 | 149 |
| 135 def __init__(self): | 150 def __init__(self): |
| 136 super(WebrtcCasesPageSet, self).__init__( | 151 super(WebrtcCasesPageSet, self).__init__( |
| 137 archive_data_file='data/webrtc_cases.json', | 152 archive_data_file='data/webrtc_cases.json', |
| 138 bucket=page_set_module.PUBLIC_BUCKET) | 153 bucket=page_set_module.PUBLIC_BUCKET) |
| 139 | 154 |
| 140 self.AddUserStory(Page1(self)) | 155 self.AddUserStory(Page1(self)) |
| 141 self.AddUserStory(Page2(self)) | 156 self.AddUserStory(Page2(self)) |
| 142 self.AddUserStory(Page3(self)) | 157 self.AddUserStory(Page3(self)) |
| 143 self.AddUserStory(Page1(self)) | 158 self.AddUserStory(Page1(self)) |
| 144 self.AddUserStory(Page2(self)) | 159 self.AddUserStory(Page2(self)) |
| 145 self.AddUserStory(Page3(self)) | 160 self.AddUserStory(Page3(self)) |
| 146 self.AddUserStory(Page4(self)) | 161 self.AddUserStory(Page4(self)) |
| 147 self.AddUserStory(Page5(self)) | 162 self.AddUserStory(Page5(self)) |
| 148 self.AddUserStory(Page6(self)) | 163 self.AddUserStory(Page6(self)) |
| 149 self.AddUserStory(Page7(self)) | 164 self.AddUserStory(Page7(self)) |
| 165 self.AddUserStory(Page8(self)) |
| OLD | NEW |