| OLD | NEW |
| (Empty) |
| 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 | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 from telemetry import page | |
| 6 from telemetry import story | |
| 7 from telemetry.page import shared_page_state | |
| 8 from telemetry.core import exceptions | |
| 9 | |
| 10 | |
| 11 class CastPage(page.Page): | |
| 12 | |
| 13 def __init__(self, page_set): | |
| 14 super(CastPage, self).__init__( | |
| 15 url='file://basic_test.html', | |
| 16 page_set=page_set) | |
| 17 | |
| 18 def RunPageInteractions(self, action_runner): | |
| 19 with action_runner.CreateInteraction('LaunchDialog'): | |
| 20 # Wait for 5s after Chrome is opened in order to get consistent results. | |
| 21 action_runner.Wait(5) | |
| 22 action_runner.TapElement(selector='#start_session_button') | |
| 23 action_runner.Wait(5) | |
| 24 for tab in action_runner.tab.browser.tabs: | |
| 25 # Close media router dialog | |
| 26 if tab.url == 'chrome://media-router/': | |
| 27 try: | |
| 28 tab.ExecuteJavaScript( | |
| 29 'window.document.getElementById("media-router-container").' + | |
| 30 'shadowRoot.getElementById("container-header").shadowRoot.' + | |
| 31 'getElementById("close-button").click();') | |
| 32 except exceptions.DevtoolsTargetCrashException: | |
| 33 # Ignore the crash exception, this exception is caused by the js | |
| 34 # code which closes the dialog, it is expected. | |
| 35 pass | |
| 36 | |
| 37 | |
| 38 class MediaRouterPageSet(story.StorySet): | |
| 39 | |
| 40 def __init__(self): | |
| 41 super(MediaRouterPageSet, self).__init__( | |
| 42 cloud_storage_bucket=story.PARTNER_BUCKET) | |
| 43 self.AddStory(CastPage(self)) | |
| OLD | NEW |