| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 | 4 |
| 5 from telemetry import story | 5 from telemetry import story |
| 6 | 6 |
| 7 from page_sets import google_pages | 7 from page_sets import google_pages |
| 8 | 8 |
| 9 STARTUP_TIME_IN_SECONDS = 2 |
| 9 IDLE_TIME_IN_SECONDS = 100 | 10 IDLE_TIME_IN_SECONDS = 100 |
| 10 | 11 |
| 11 def _CreateIdlePageClass(base_page_cls): | 12 def _CreateIdlePageClass(base_page_cls): |
| 12 class DerivedIdlePage(base_page_cls): # pylint: disable=no-init | 13 class DerivedIdlePage(base_page_cls): # pylint: disable=no-init |
| 13 def RunPageInteractions(self, action_runner): | 14 def RunPageInteractions(self, action_runner): |
| 14 action_runner.Wait(IDLE_TIME_IN_SECONDS) | 15 action_runner.Wait(STARTUP_TIME_IN_SECONDS) |
| 16 with action_runner.CreateInteraction('Begin'): |
| 17 action_runner.tab.browser.DumpMemory() |
| 18 with action_runner.CreateInteraction('Idle'): |
| 19 action_runner.Wait(IDLE_TIME_IN_SECONDS) |
| 20 with action_runner.CreateInteraction('End'): |
| 21 action_runner.tab.browser.DumpMemory() |
| 15 return DerivedIdlePage | 22 return DerivedIdlePage |
| 16 | 23 |
| 17 | 24 |
| 18 def _CreateIdleBackgroundPageClass(base_page_cls): | 25 def _CreateIdleBackgroundPageClass(base_page_cls): |
| 19 class DerivedIdlePage(base_page_cls): # pylint: disable=no-init | 26 class DerivedIdlePage(base_page_cls): # pylint: disable=no-init |
| 20 def RunPageInteractions(self, action_runner): | 27 def RunPageInteractions(self, action_runner): |
| 21 action_runner.tab.browser.tabs.New() | 28 action_runner.tab.browser.tabs.New() |
| 22 action_runner.Wait(IDLE_TIME_IN_SECONDS) | 29 action_runner.Wait(IDLE_TIME_IN_SECONDS) |
| 23 return DerivedIdlePage | 30 return DerivedIdlePage |
| 24 | 31 |
| 25 | 32 |
| 26 class LongRunningIdleGmailPageSet(story.StorySet): | 33 class LongRunningIdleGmailPageSet(story.StorySet): |
| 27 def __init__(self): | 34 def __init__(self): |
| 28 super(LongRunningIdleGmailPageSet, self).__init__( | 35 super(LongRunningIdleGmailPageSet, self).__init__( |
| 29 archive_data_file='data/long_running_idle_gmail_page.json', | 36 archive_data_file='data/long_running_idle_gmail_page.json', |
| 30 cloud_storage_bucket=story.PARTNER_BUCKET) | 37 cloud_storage_bucket=story.PARTNER_BUCKET) |
| 31 self.AddStory( | 38 self.AddStory( |
| 32 _CreateIdlePageClass(google_pages.GmailPage)(self)) | 39 _CreateIdlePageClass(google_pages.GmailPage)(self)) |
| 33 | 40 |
| 34 | 41 |
| 35 class LongRunningIdleGmailBackgroundPageSet(story.StorySet): | 42 class LongRunningIdleGmailBackgroundPageSet(story.StorySet): |
| 36 def __init__(self): | 43 def __init__(self): |
| 37 # Reuse the wpr of foreground gmail. | 44 # Reuse the wpr of foreground gmail. |
| 38 super(LongRunningIdleGmailBackgroundPageSet, self).__init__( | 45 super(LongRunningIdleGmailBackgroundPageSet, self).__init__( |
| 39 archive_data_file='data/long_running_idle_gmail_page.json', | 46 archive_data_file='data/long_running_idle_gmail_page.json', |
| 40 cloud_storage_bucket=story.PARTNER_BUCKET) | 47 cloud_storage_bucket=story.PARTNER_BUCKET) |
| 41 self.AddStory( | 48 self.AddStory( |
| 42 _CreateIdleBackgroundPageClass(google_pages.GmailPage)(self)) | 49 _CreateIdleBackgroundPageClass(google_pages.GmailPage)(self)) |
| OLD | NEW |