| Index: tools/perf/page_sets/idle_platform.py
|
| diff --git a/tools/perf/page_sets/idle_platform.py b/tools/perf/page_sets/idle_platform.py
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..b6fffd48a0cb0e930fca9f3439e9bf48202aa75c
|
| --- /dev/null
|
| +++ b/tools/perf/page_sets/idle_platform.py
|
| @@ -0,0 +1,41 @@
|
| +# Copyright 2017 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.
|
| +import time
|
| +
|
| +from telemetry.page import shared_page_state
|
| +from telemetry import story
|
| +
|
| +
|
| +class _IdleSharedState(shared_page_state.SharedPageState):
|
| + def __init__(self, test, finder_options, story_set):
|
| + super(_IdleSharedState, self).__init__(test, finder_options, story_set)
|
| + self._current_story = None
|
| +
|
| + def WillRunStory(self, current_story):
|
| + self._current_story = current_story
|
| + assert self.platform.tracing_controller.is_tracing_running
|
| +
|
| + def RunStory(self, _):
|
| + self._current_story.Run(self)
|
| +
|
| + def DidRunStory(self, _):
|
| + self._current_story = None
|
| +
|
| +
|
| +class _IdleStory(story.Story):
|
| + def __init__(self, name, duration):
|
| + super(_IdleStory, self).__init__(
|
| + shared_state_class=_IdleSharedState, name=name)
|
| + self._duration = duration
|
| +
|
| + def Run(self, shared_state):
|
| + time.sleep(self._duration)
|
| +
|
| +
|
| +class IdleStorySet(story.StorySet):
|
| + def __init__(self):
|
| + super(IdleStorySet, self).__init__()
|
| + self.AddStory(_IdleStory('IdleStory_10s', 10))
|
| + self.AddStory(_IdleStory('IdleStory_60s', 60))
|
| + self.AddStory(_IdleStory('IdleStory_120s', 120))
|
|
|