Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: chrome/test/media_router/telemetry/benchmarks/pagesets/media_router_perf_pages.py

Issue 2166433003: Implement a more stable way to check if the dialog is fully loaded before choose the sink, instead … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/test/media_router/telemetry/benchmarks/pagesets/media_router_page.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 timeout=30) 85 timeout=30)
86 self.CloseExistingRoute(action_runner, sink_name) 86 self.CloseExistingRoute(action_runner, sink_name)
87 87
88 # Start session 88 # Start session
89 action_runner.TapElement(selector='#start_session_button') 89 action_runner.TapElement(selector='#start_session_button')
90 self._WaitForResult( 90 self._WaitForResult(
91 action_runner, 91 action_runner,
92 lambda: len(action_runner.tab.browser.tabs) >= 2, 92 lambda: len(action_runner.tab.browser.tabs) >= 2,
93 'MR dialog never showed up.') 93 'MR dialog never showed up.')
94 94
95 # Wait for 2s to make sure the dialog is fully loaded.
96 action_runner.Wait(2)
97 for tab in action_runner.tab.browser.tabs: 95 for tab in action_runner.tab.browser.tabs:
98 # Choose sink 96 # Choose sink
99 if tab.url == 'chrome://media-router/': 97 if tab.url == 'chrome://media-router/':
98 self.WaitUntilDialogLoaded(action_runner, tab)
100 self.ChooseSink(tab, sink_name) 99 self.ChooseSink(tab, sink_name)
101 100
102 self._WaitForResult( 101 self._WaitForResult(
103 action_runner, 102 action_runner,
104 lambda: action_runner.EvaluateJavaScript('currentSession'), 103 lambda: action_runner.EvaluateJavaScript('currentSession'),
105 'Failed to start session', 104 'Failed to start session',
106 timeout=10) 105 timeout=10)
107 106
108 # Load Media 107 # Load Media
109 self.ExecuteAsyncJavaScript( 108 self.ExecuteAsyncJavaScript(
110 action_runner, 109 action_runner,
111 'loadMedia("%s");' % utils.GetInternalVideoURL(), 110 'loadMedia("%s");' % utils.GetInternalVideoURL(),
112 lambda: action_runner.EvaluateJavaScript('currentMedia'), 111 lambda: action_runner.EvaluateJavaScript('currentMedia'),
113 'Failed to load media', 112 'Failed to load media',
114 timeout=120) 113 timeout=120)
115 114
116 action_runner.Wait(5) 115 action_runner.Wait(5)
117 action_runner.ExecuteJavaScript('collectPerfData();') 116 action_runner.ExecuteJavaScript('collectPerfData();')
118 action_runner.Wait(SESSION_TIME) 117 action_runner.Wait(SESSION_TIME)
119 # Stop session 118 # Stop session
120 self.ExecuteAsyncJavaScript( 119 self.ExecuteAsyncJavaScript(
121 action_runner, 120 action_runner,
122 'stopSession();', 121 'stopSession();',
123 lambda: not action_runner.EvaluateJavaScript('currentSession'), 122 lambda: not action_runner.EvaluateJavaScript('currentSession'),
124 'Failed to stop session') 123 'Failed to stop session',
124 timeout=30)
125 125
126 126
127 class CastMirroringPage(media_router_page.CastPage): 127 class CastMirroringPage(media_router_page.CastPage):
128 """Cast page to mirror a tab to Chromecast device.""" 128 """Cast page to mirror a tab to Chromecast device."""
129 129
130 def __init__(self, page_set): 130 def __init__(self, page_set):
131 super(CastMirroringPage, self).__init__( 131 super(CastMirroringPage, self).__init__(
132 page_set=page_set, 132 page_set=page_set,
133 url='file://mirroring.html', 133 url='file://mirroring.html',
134 shared_page_state_class=SharedState) 134 shared_page_state_class=SharedState)
135 135
136 def RunPageInteractions(self, action_runner): 136 def RunPageInteractions(self, action_runner):
137 sink_name = self._GetDeviceName() 137 sink_name = self._GetDeviceName()
138 # Wait for 5s after Chrome is opened in order to get consistent results. 138 # Wait for 5s after Chrome is opened in order to get consistent results.
139 action_runner.Wait(5) 139 action_runner.Wait(5)
140 with action_runner.CreateInteraction('mirroring'): 140 with action_runner.CreateInteraction('mirroring'):
141 self.CloseExistingRoute(action_runner, sink_name) 141 self.CloseExistingRoute(action_runner, sink_name)
142 142
143 # Start session 143 # Start session
144 action_runner.TapElement(selector='#start_session_button') 144 action_runner.TapElement(selector='#start_session_button')
145 self._WaitForResult( 145 self._WaitForResult(
146 action_runner, 146 action_runner,
147 lambda: len(action_runner.tab.browser.tabs) >= 2, 147 lambda: len(action_runner.tab.browser.tabs) >= 2,
148 'MR dialog never showed up.') 148 'MR dialog never showed up.')
149 149
150 # Wait for 2s to make sure the dialog is fully loaded.
151 action_runner.Wait(2)
152 for tab in action_runner.tab.browser.tabs: 150 for tab in action_runner.tab.browser.tabs:
153 # Choose sink 151 # Choose sink
154 if tab.url == 'chrome://media-router/': 152 if tab.url == 'chrome://media-router/':
153 self.WaitUntilDialogLoaded(action_runner, tab)
155 self.ChooseSink(tab, sink_name) 154 self.ChooseSink(tab, sink_name)
156 155
157 # Wait for 5s to make sure the route is created. 156 # Wait for 5s to make sure the route is created.
158 action_runner.Wait(5) 157 action_runner.Wait(5)
159 action_runner.TapElement(selector='#start_session_button') 158 action_runner.TapElement(selector='#start_session_button')
160 action_runner.Wait(2) 159 action_runner.Wait(2)
161 for tab in action_runner.tab.browser.tabs: 160 for tab in action_runner.tab.browser.tabs:
162 if tab.url == 'chrome://media-router/': 161 if tab.url == 'chrome://media-router/':
163 if not self.CheckIfExistingRoute(tab, sink_name): 162 if not self.CheckIfExistingRoute(tab, sink_name):
164 raise page.page_test.Failure('Failed to start mirroring session.') 163 raise page.page_test.Failure('Failed to start mirroring session.')
(...skipping 22 matching lines...) Expand all
187 self.AddStory(CastMirroringPage(self)) 186 self.AddStory(CastMirroringPage(self))
188 187
189 188
190 class CPUMemoryPageSet(story.StorySet): 189 class CPUMemoryPageSet(story.StorySet):
191 """Pageset to get baseline CPU and memory usage.""" 190 """Pageset to get baseline CPU and memory usage."""
192 191
193 def __init__(self): 192 def __init__(self):
194 super(CPUMemoryPageSet, self).__init__( 193 super(CPUMemoryPageSet, self).__init__(
195 cloud_storage_bucket=story.PARTNER_BUCKET) 194 cloud_storage_bucket=story.PARTNER_BUCKET)
196 self.AddStory(CastIdlePage(self)) 195 self.AddStory(CastIdlePage(self))
OLDNEW
« no previous file with comments | « chrome/test/media_router/telemetry/benchmarks/pagesets/media_router_page.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698