Commit 61a28216 authored by nednguyen's avatar nednguyen Committed by Commit Bot

[system_health] Fix the lack of memory dump triggers on some user stories

Some system health stories have been overriding RunPageInteractions method directly
without implementing memory dump triggering.

This fixes those stories by changing them to override _DidLoadStory. It also add
tests to avoid mistakes like these in the future.

Review-Url: https://codereview.chromium.org/2924163005
Cr-Commit-Position: refs/heads/master@{#477949}
parent 8ad19ec2
...@@ -8,6 +8,7 @@ import unittest ...@@ -8,6 +8,7 @@ import unittest
from benchmarks import system_health as system_health_benchmark from benchmarks import system_health as system_health_benchmark
from core import path_util from core import path_util
from page_sets.system_health import system_health_stories from page_sets.system_health import system_health_stories
from page_sets.system_health import system_health_story
from telemetry import benchmark as benchmark_module from telemetry import benchmark as benchmark_module
from telemetry.core import discover from telemetry.core import discover
...@@ -44,3 +45,21 @@ class TestSystemHealthBenchmarks(unittest.TestCase): ...@@ -44,3 +45,21 @@ class TestSystemHealthBenchmarks(unittest.TestCase):
b().CreateStorySet(None), b().CreateStorySet(None),
system_health_stories.SystemHealthStorySet, system_health_stories.SystemHealthStorySet,
'%r does not use SystemHealthStorySet' % b) '%r does not use SystemHealthStorySet' % b)
class TestSystemHealthStories(unittest.TestCase):
def testNoOverrideRunPageInteractions(self):
desktop_stories = (
system_health_stories.DesktopSystemHealthStorySet().stories)
mobile_stories = (
system_health_stories.MobileSystemHealthStorySet().stories)
for s in desktop_stories + mobile_stories:
# Long running stories has their own way of collecting memory dumps,
# so they explicitly override RunPageInteractions method.
if s.name.startswith('long_running:'):
continue
self.assertEquals(s.__class__.RunPageInteractions,
system_health_story.SystemHealthStory.RunPageInteractions,
'Story %s overrides RunPageInteractions. Override _DidLoadDocument '
'instead' % s.name)
...@@ -19,7 +19,7 @@ class _MediaStory(system_health_story.SystemHealthStory): ...@@ -19,7 +19,7 @@ class _MediaStory(system_health_story.SystemHealthStory):
STOP_SELECTOR = NotImplemented STOP_SELECTOR = NotImplemented
TIME_SELECTOR = NotImplemented TIME_SELECTOR = NotImplemented
def RunPageInteractions(self, action_runner): def _DidLoadDocument(self, action_runner):
self._NavigateToMedia(action_runner) self._NavigateToMedia(action_runner)
# Play Media. # Play Media.
if self.PLAY_SELECTOR: if self.PLAY_SELECTOR:
......
...@@ -36,7 +36,7 @@ class MultiTabStory(system_health_story.SystemHealthStory): ...@@ -36,7 +36,7 @@ class MultiTabStory(system_health_story.SystemHealthStory):
logging.warning('WaitForNetworkQuiescence() timeout, url[%d]: %s' logging.warning('WaitForNetworkQuiescence() timeout, url[%d]: %s'
% (i, url)) % (i, url))
def RunPageInteractions(self, action_runner): def _DidLoadDocument(self, action_runner):
for tab in action_runner.tab.browser.tabs: for tab in action_runner.tab.browser.tabs:
tab.Activate() tab.Activate()
tab.WaitForFrameToBeDisplayed() tab.WaitForFrameToBeDisplayed()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment