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