| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 | 4 |
| 5 import utils | 5 import utils |
| 6 | 6 |
| 7 from telemetry import page | 7 from telemetry import page |
| 8 from telemetry import story | 8 from telemetry import story |
| 9 from benchmarks.pagesets import media_router_page | 9 from benchmarks.pagesets import media_router_page |
| 10 from telemetry.core import exceptions | 10 from telemetry.core import exceptions |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 action_runner.Wait(5) | 119 action_runner.Wait(5) |
| 120 action_runner.ExecuteJavaScript('collectPerfData();') | 120 action_runner.ExecuteJavaScript('collectPerfData();') |
| 121 action_runner.Wait(SESSION_TIME) | 121 action_runner.Wait(SESSION_TIME) |
| 122 # Stop session | 122 # Stop session |
| 123 self.ExecuteAsyncJavaScript( | 123 self.ExecuteAsyncJavaScript( |
| 124 action_runner, | 124 action_runner, |
| 125 'stopSession();', | 125 'stopSession();', |
| 126 lambda: not action_runner.EvaluateJavaScript('currentSession'), | 126 lambda: not action_runner.EvaluateJavaScript('currentSession'), |
| 127 'Failed to stop session', | 127 'Failed to stop session', |
| 128 timeout=30) | 128 timeout=60, retry=3) |
| 129 | 129 |
| 130 | 130 |
| 131 class CastMirroringPage(media_router_page.CastPage): | 131 class CastMirroringPage(media_router_page.CastPage): |
| 132 """Cast page to mirror a tab to Chromecast device.""" | 132 """Cast page to mirror a tab to Chromecast device.""" |
| 133 | 133 |
| 134 def __init__(self, page_set): | 134 def __init__(self, page_set): |
| 135 super(CastMirroringPage, self).__init__( | 135 super(CastMirroringPage, self).__init__( |
| 136 page_set=page_set, | 136 page_set=page_set, |
| 137 url='file://mirroring.html', | 137 url='file://mirroring.html', |
| 138 shared_page_state_class=SharedState) | 138 shared_page_state_class=SharedState) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 162 action_runner.TapElement(selector='#start_session_button') | 162 action_runner.TapElement(selector='#start_session_button') |
| 163 self._WaitForResult( | 163 self._WaitForResult( |
| 164 action_runner, | 164 action_runner, |
| 165 lambda: len(action_runner.tab.browser.tabs) >= 2, | 165 lambda: len(action_runner.tab.browser.tabs) >= 2, |
| 166 'MR dialog never showed up.') | 166 'MR dialog never showed up.') |
| 167 | 167 |
| 168 for tab in action_runner.tab.browser.tabs: | 168 for tab in action_runner.tab.browser.tabs: |
| 169 if tab.url == 'chrome://media-router/': | 169 if tab.url == 'chrome://media-router/': |
| 170 self.WaitUntilDialogLoaded(action_runner, tab) | 170 self.WaitUntilDialogLoaded(action_runner, tab) |
| 171 if not self.CheckIfExistingRoute(tab, sink_name): | 171 if not self.CheckIfExistingRoute(tab, sink_name): |
| 172 raise page.page_test.Failure('Failed to start mirroring session.') | 172 raise RuntimeError('Failed to start mirroring session.') |
| 173 action_runner.ExecuteJavaScript('collectPerfData();') | 173 action_runner.ExecuteJavaScript('collectPerfData();') |
| 174 action_runner.Wait(SESSION_TIME) | 174 action_runner.Wait(SESSION_TIME) |
| 175 self.CloseExistingRoute(action_runner, sink_name) | 175 self.CloseExistingRoute(action_runner, sink_name) |
| 176 | 176 |
| 177 | 177 |
| 178 class MediaRouterDialogPageSet(story.StorySet): | 178 class MediaRouterDialogPageSet(story.StorySet): |
| 179 """Pageset for media router dialog latency tests.""" | 179 """Pageset for media router dialog latency tests.""" |
| 180 | 180 |
| 181 def __init__(self): | 181 def __init__(self): |
| 182 super(MediaRouterDialogPageSet, self).__init__( | 182 super(MediaRouterDialogPageSet, self).__init__( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 195 self.AddStory(CastMirroringPage(self)) | 195 self.AddStory(CastMirroringPage(self)) |
| 196 | 196 |
| 197 | 197 |
| 198 class CPUMemoryPageSet(story.StorySet): | 198 class CPUMemoryPageSet(story.StorySet): |
| 199 """Pageset to get baseline CPU and memory usage.""" | 199 """Pageset to get baseline CPU and memory usage.""" |
| 200 | 200 |
| 201 def __init__(self): | 201 def __init__(self): |
| 202 super(CPUMemoryPageSet, self).__init__( | 202 super(CPUMemoryPageSet, self).__init__( |
| 203 cloud_storage_bucket=story.PARTNER_BUCKET) | 203 cloud_storage_bucket=story.PARTNER_BUCKET) |
| 204 self.AddStory(CastIdlePage(self)) | 204 self.AddStory(CastIdlePage(self)) |
| OLD | NEW |