| 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 logging | 4 import logging |
| 5 import py_utils | 5 import py_utils |
| 6 | 6 |
| 7 from telemetry.page import page as page_module | 7 from telemetry.page import page as page_module |
| 8 from telemetry.page import shared_page_state | 8 from telemetry.page import shared_page_state |
| 9 from telemetry import story | 9 from telemetry import story |
| 10 | 10 |
| 11 _DUMP_WAIT_TIME = 3 | 11 _DUMP_WAIT_TIME = 3 |
| 12 _ITERATIONS = 10 | 12 _ITERATIONS = 10 |
| 13 | 13 |
| 14 class DesktopMemoryPage(page_module.Page): | 14 class DesktopMemoryPage(page_module.Page): |
| 15 | 15 |
| 16 def __init__(self, url, page_set): | 16 def __init__(self, url, page_set): |
| 17 super(DesktopMemoryPage, self).__init__( | 17 super(DesktopMemoryPage, self).__init__( |
| 18 url=url, page_set=page_set, | 18 url=url, page_set=page_set, |
| 19 shared_page_state_class=shared_page_state.SharedDesktopPageState) | 19 shared_page_state_class=shared_page_state.SharedDesktopPageState, |
| 20 name=url) |
| 20 | 21 |
| 21 def _DumpMemory(self, action_runner, phase): | 22 def _DumpMemory(self, action_runner, phase): |
| 22 with action_runner.CreateInteraction(phase): | 23 with action_runner.CreateInteraction(phase): |
| 23 action_runner.Wait(_DUMP_WAIT_TIME) | 24 action_runner.Wait(_DUMP_WAIT_TIME) |
| 24 action_runner.ForceGarbageCollection() | 25 action_runner.ForceGarbageCollection() |
| 25 action_runner.SimulateMemoryPressureNotification('critical') | 26 action_runner.SimulateMemoryPressureNotification('critical') |
| 26 action_runner.Wait(_DUMP_WAIT_TIME) | 27 action_runner.Wait(_DUMP_WAIT_TIME) |
| 27 action_runner.tab.browser.DumpMemory() | 28 action_runner.tab.browser.DumpMemory() |
| 28 | 29 |
| 29 def RunPageInteractions(self, action_runner): | 30 def RunPageInteractions(self, action_runner): |
| (...skipping 12 matching lines...) Expand all Loading... |
| 42 new_tab.Close() | 43 new_tab.Close() |
| 43 | 44 |
| 44 self._DumpMemory(action_runner, 'post') | 45 self._DumpMemory(action_runner, 'post') |
| 45 | 46 |
| 46 | 47 |
| 47 class DesktopMemoryPageSet(story.StorySet): | 48 class DesktopMemoryPageSet(story.StorySet): |
| 48 | 49 |
| 49 """ Desktop sites with interesting memory characteristics """ | 50 """ Desktop sites with interesting memory characteristics """ |
| 50 | 51 |
| 51 def __init__(self): | 52 def __init__(self): |
| 52 super(DesktopMemoryPageSet, self).__init__() | 53 super(DesktopMemoryPageSet, self).__init__(verify_names=True) |
| 53 | 54 |
| 54 urls_list = [ | 55 urls_list = [ |
| 55 'http://www.google.com', | 56 'http://www.google.com', |
| 56 "http://www.live.com", | 57 "http://www.live.com", |
| 57 "http://www.youtube.com", | 58 "http://www.youtube.com", |
| 58 "http://www.wikipedia.org", | 59 "http://www.wikipedia.org", |
| 59 "http://www.flickr.com/", | 60 "http://www.flickr.com/", |
| 60 "http://www.cnn.com/", | 61 "http://www.cnn.com/", |
| 61 "http://www.adobe.com/", | 62 "http://www.adobe.com/", |
| 62 "http://www.aol.com/", | 63 "http://www.aol.com/", |
| 63 "http://www.cnet.com/", | 64 "http://www.cnet.com/", |
| 64 "http://www.godaddy.com/", | 65 "http://www.godaddy.com/", |
| 65 "http://www.walmart.com/", | 66 "http://www.walmart.com/", |
| 66 "http://www.skype.com/", | 67 "http://www.skype.com/", |
| 67 ] | 68 ] |
| 68 | 69 |
| 69 for url in urls_list: | 70 for url in urls_list: |
| 70 self.AddStory(DesktopMemoryPage(url, self)) | 71 self.AddStory(DesktopMemoryPage(url, self)) |
| OLD | NEW |