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

Unified Diff: tools/perf/page_sets/system_health/media_stories.py

Issue 2618333006: [tools/perf] Fix JavaScript interpolation in action_runner calls (Closed)
Patch Set: fix a few more interpolations Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/perf/page_sets/system_health/loading_stories.py ('k') | tools/perf/page_sets/todomvc.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/page_sets/system_health/media_stories.py
diff --git a/tools/perf/page_sets/system_health/media_stories.py b/tools/perf/page_sets/system_health/media_stories.py
index 6a8501f92ba84dd18eb3eb8be153d992e39d2fe3..ad079e8d4b515282fcec217d1b9a326dc0bcc3a8 100644
--- a/tools/perf/page_sets/system_health/media_stories.py
+++ b/tools/perf/page_sets/system_health/media_stories.py
@@ -35,9 +35,8 @@ class _MediaStory(system_health_story.SystemHealthStory):
raise NotImplementedError
def _WaitForAndClickElementBySelector(self, action_runner, selector):
- element_function = 'document.querySelector("%s")' % selector
- action_runner.WaitForElement(element_function=element_function)
- action_runner.ClickElement(element_function=element_function)
+ action_runner.WaitForElement(selector=selector)
+ action_runner.ClickElement(selector=selector)
def _WaitForPlayTime(self, action_runner):
action_runner.Wait(self.PLAY_DURATION)
@@ -46,10 +45,9 @@ class _MediaStory(system_health_story.SystemHealthStory):
self.PLAY_DURATION - self._GetTimeInSeconds(action_runner))
def _GetTimeInSeconds(self, action_runner):
- # TODO(catapult:#3028): Fix interpolation of JavaScript values.
- time_func = (
- 'document.querySelector("%s").textContent' % self.TIME_SELECTOR)
- minutes, seconds = action_runner.EvaluateJavaScript(time_func).split(':')
+ minutes, seconds = action_runner.EvaluateJavaScript(
+ 'document.querySelector({{ selector }}).textContent',
+ selector=self.TIME_SELECTOR).split(':')
return int(minutes * 60 + seconds)
« no previous file with comments | « tools/perf/page_sets/system_health/loading_stories.py ('k') | tools/perf/page_sets/todomvc.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698