| OLD | NEW |
| 1 # Copyright 2017 The Chromium Authors. All rights reserved. | 1 # Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 import time | 4 import time |
| 5 | 5 |
| 6 from telemetry.page import shared_page_state | 6 from telemetry.page import shared_page_state |
| 7 from telemetry import story | 7 from telemetry import story |
| 8 | 8 |
| 9 | 9 |
| 10 class _IdleSharedState(shared_page_state.SharedPageState): | 10 class _IdleSharedState(shared_page_state.SharedPageState): |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 def DidRunStory(self, _): | 22 def DidRunStory(self, _): |
| 23 self._current_story = None | 23 self._current_story = None |
| 24 | 24 |
| 25 | 25 |
| 26 class _IdleStory(story.Story): | 26 class _IdleStory(story.Story): |
| 27 def __init__(self, name, duration): | 27 def __init__(self, name, duration): |
| 28 super(_IdleStory, self).__init__( | 28 super(_IdleStory, self).__init__( |
| 29 shared_state_class=_IdleSharedState, name=name) | 29 shared_state_class=_IdleSharedState, name=name) |
| 30 self._duration = duration | 30 self._duration = duration |
| 31 # https://github.com/catapult-project/catapult/issues/3489 |
| 32 # Even though there is no actual url being used, it is required for |
| 33 # uploading results using the --upload-results flag. Remove url when |
| 34 # it is no longer needed. |
| 35 self._url = name |
| 31 | 36 |
| 32 def Run(self, shared_state): | 37 def Run(self, shared_state): |
| 33 time.sleep(self._duration) | 38 time.sleep(self._duration) |
| 34 | 39 |
| 40 @property |
| 41 def url(self): |
| 42 return self._url |
| 43 |
| 35 | 44 |
| 36 class IdleStorySet(story.StorySet): | 45 class IdleStorySet(story.StorySet): |
| 37 def __init__(self): | 46 def __init__(self): |
| 38 super(IdleStorySet, self).__init__() | 47 super(IdleStorySet, self).__init__() |
| 39 self.AddStory(_IdleStory('IdleStory_10s', 10)) | 48 self.AddStory(_IdleStory('IdleStory_10s', 10)) |
| 40 self.AddStory(_IdleStory('IdleStory_60s', 60)) | 49 self.AddStory(_IdleStory('IdleStory_60s', 60)) |
| 41 self.AddStory(_IdleStory('IdleStory_120s', 120)) | 50 self.AddStory(_IdleStory('IdleStory_120s', 120)) |
| OLD | NEW |