Fix OOP <webview> resize and autosize.
[chromium-blink-merge.git] / tools / perf / page_sets / key_noop_cases.py
blobbe8bebebd5de11483d08109776efd2555daa470b
1 # Copyright 2015 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 from telemetry.page import page as page_module
5 from telemetry.page import shared_page_state
6 from telemetry import story
9 class NoOpPage(page_module.Page):
11 def __init__(self, url, page_set):
12 super(NoOpPage, self).__init__(
13 url=url,
14 page_set=page_set,
15 shared_page_state_class=shared_page_state.SharedMobilePageState)
17 def RunNavigateSteps(self, action_runner):
18 super(NoOpPage, self).RunNavigateSteps(action_runner)
19 # Let load activity settle.
20 action_runner.Wait(2)
22 def RunPageInteractions(self, action_runner):
23 # The default page interaction is simply waiting in an idle state.
24 with action_runner.CreateInteraction('IdleWaiting'):
25 action_runner.Wait(5)
28 class NoOpTouchScrollPage(NoOpPage):
29 def __init__(self, url, page_set):
30 super(NoOpTouchScrollPage, self).__init__(url=url, page_set=page_set)
32 def RunPageInteractions(self, action_runner):
33 # The noop touch motion should last ~5 seconds.
34 with action_runner.CreateGestureInteraction('ScrollAction'):
35 action_runner.ScrollPage(direction='down', use_touch=True,
36 speed_in_pixels_per_second=300, distance=1500)
39 class KeyNoOpCasesPageSet(story.StorySet):
41 """ Key no-op cases """
43 def __init__(self):
44 super(KeyNoOpCasesPageSet, self).__init__()
46 # Why: An infinite rAF loop which does not modify the page should incur
47 # minimal activity.
48 self.AddStory(NoOpPage('file://key_noop_cases/no_op_raf.html', self))
50 # Why: An inifinite setTimeout loop which does not modify the page should
51 # incur minimal activity.
52 self.AddStory(NoOpPage('file://key_noop_cases/no_op_settimeout.html', self))
54 # Why: Scrolling an empty, unscrollable page should have no expensive side
55 # effects, as overscroll is suppressed in such cases.
56 self.AddStory(NoOpTouchScrollPage(
57 'file://key_noop_cases/no_op_scroll.html', self))
59 # Why: Feeding a stream of touch events to a no-op handler should be cheap.
60 self.AddStory(NoOpTouchScrollPage(
61 'file://key_noop_cases/no_op_touch_handler.html', self))