blob: 7175eca113d6ac6b3cc664911530ddb0ab6f5e32 [file] [log] [blame]
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from import page as page_module
from import shared_page_state
from telemetry import story
class NoOpPage(page_module.Page):
def __init__(self, url, page_set):
super(NoOpPage, self).__init__(
def RunNavigateSteps(self, action_runner):
super(NoOpPage, self).RunNavigateSteps(action_runner)
# Let load activity settle.
def RunPageInteractions(self, action_runner):
# The default page interaction is simply waiting in an idle state.
with action_runner.CreateInteraction('IdleWaiting'):
class NoOpTouchScrollPage(NoOpPage):
def __init__(self, url, page_set):
super(NoOpTouchScrollPage, self).__init__(url=url, page_set=page_set)
def RunPageInteractions(self, action_runner):
# The noop touch motion should last ~5 seconds.
with action_runner.CreateGestureInteraction('ScrollAction'):
action_runner.ScrollPage(direction='down', use_touch=True,
speed_in_pixels_per_second=300, distance=1500)
class KeyNoOpCasesPageSet(story.StorySet):
""" Key no-op cases """
def __init__(self):
super(KeyNoOpCasesPageSet, self).__init__()
# Why: An infinite rAF loop which does not modify the page should incur
# minimal activity.
self.AddStory(NoOpPage('file://key_noop_cases/no_op_raf.html', self))
# Why: An infinite setTimeout loop which does not modify the page should
# incur minimal activity.
self.AddStory(NoOpPage('file://key_noop_cases/no_op_settimeout.html', self))
# Why: Scrolling an empty, unscrollable page should have no expensive side
# effects, as overscroll is suppressed in such cases.
'file://key_noop_cases/no_op_scroll.html', self))
# Why: Feeding a stream of touch events to a no-op handler should be cheap.
'file://key_noop_cases/no_op_touch_handler.html', self))