| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 from telemetry.page import page as page_module | 4 from telemetry.page import page as page_module |
| 5 from telemetry.page import page_set as page_set_module | 5 from telemetry.page import page_set as page_set_module |
| 6 | 6 |
| 7 | 7 |
| 8 class MobileMemoryPage(page_module.Page): | 8 class MobileMemoryPage(page_module.Page): |
| 9 | 9 |
| 10 def __init__(self, url, page_set): | 10 def __init__(self, url, page_set): |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 """ Why: Tests usage of discardable memory """ | 42 """ Why: Tests usage of discardable memory """ |
| 43 | 43 |
| 44 def __init__(self, page_set): | 44 def __init__(self, page_set): |
| 45 super(GoogleSearchPage, self).__init__( | 45 super(GoogleSearchPage, self).__init__( |
| 46 url='https://www.google.com/search?site=&tbm=isch&q=google', | 46 url='https://www.google.com/search?site=&tbm=isch&q=google', |
| 47 page_set=page_set) | 47 page_set=page_set) |
| 48 | 48 |
| 49 def RunPageInteractions(self, action_runner): | 49 def RunPageInteractions(self, action_runner): |
| 50 interaction = action_runner.BeginGestureInteraction( | 50 interaction = action_runner.BeginGestureInteraction( |
| 51 'ScrollAction', is_smooth=True) | 51 'ScrollAction') |
| 52 action_runner.ScrollPage() | 52 action_runner.ScrollPage() |
| 53 interaction.End() | 53 interaction.End() |
| 54 action_runner.Wait(3) | 54 action_runner.Wait(3) |
| 55 interaction = action_runner.BeginGestureInteraction( | 55 interaction = action_runner.BeginGestureInteraction( |
| 56 'ScrollAction', is_smooth=True) | 56 'ScrollAction') |
| 57 action_runner.ScrollPage() | 57 action_runner.ScrollPage() |
| 58 interaction.End() | 58 interaction.End() |
| 59 action_runner.Wait(3) | 59 action_runner.Wait(3) |
| 60 interaction = action_runner.BeginGestureInteraction( | 60 interaction = action_runner.BeginGestureInteraction( |
| 61 'ScrollAction', is_smooth=True) | 61 'ScrollAction') |
| 62 action_runner.ScrollPage() | 62 action_runner.ScrollPage() |
| 63 interaction.End() | 63 interaction.End() |
| 64 action_runner.Wait(3) | 64 action_runner.Wait(3) |
| 65 interaction = action_runner.BeginGestureInteraction( | 65 interaction = action_runner.BeginGestureInteraction( |
| 66 'ScrollAction', is_smooth=True) | 66 'ScrollAction') |
| 67 action_runner.ScrollPage() | 67 action_runner.ScrollPage() |
| 68 interaction.End() | 68 interaction.End() |
| 69 action_runner.WaitForJavaScriptCondition( | 69 action_runner.WaitForJavaScriptCondition( |
| 70 'document.getElementById("rg_s").childElementCount > 300') | 70 'document.getElementById("rg_s").childElementCount > 300') |
| 71 | 71 |
| 72 | 72 |
| 73 class ScrollPage(MobileMemoryPage): | 73 class ScrollPage(MobileMemoryPage): |
| 74 | 74 |
| 75 def __init__(self, url, page_set): | 75 def __init__(self, url, page_set): |
| 76 super(ScrollPage, self).__init__(url=url, page_set=page_set) | 76 super(ScrollPage, self).__init__(url=url, page_set=page_set) |
| 77 | 77 |
| 78 def RunPageInteractions(self, action_runner): | 78 def RunPageInteractions(self, action_runner): |
| 79 interaction = action_runner.BeginGestureInteraction( | 79 interaction = action_runner.BeginGestureInteraction( |
| 80 'ScrollAction', is_smooth=True) | 80 'ScrollAction') |
| 81 action_runner.ScrollPage() | 81 action_runner.ScrollPage() |
| 82 interaction.End() | 82 interaction.End() |
| 83 | 83 |
| 84 | 84 |
| 85 class MobileMemoryPageSet(page_set_module.PageSet): | 85 class MobileMemoryPageSet(page_set_module.PageSet): |
| 86 | 86 |
| 87 """ Mobile sites with interesting memory characteristics """ | 87 """ Mobile sites with interesting memory characteristics """ |
| 88 | 88 |
| 89 def __init__(self): | 89 def __init__(self): |
| 90 super(MobileMemoryPageSet, self).__init__( | 90 super(MobileMemoryPageSet, self).__init__( |
| 91 user_agent_type='mobile', | 91 user_agent_type='mobile', |
| 92 archive_data_file='data/mobile_memory.json', | 92 archive_data_file='data/mobile_memory.json', |
| 93 bucket=page_set_module.PARTNER_BUCKET) | 93 bucket=page_set_module.PARTNER_BUCKET) |
| 94 | 94 |
| 95 self.AddUserStory(GmailPage(self)) | 95 self.AddUserStory(GmailPage(self)) |
| 96 self.AddUserStory(GoogleSearchPage(self)) | 96 self.AddUserStory(GoogleSearchPage(self)) |
| 97 | 97 |
| 98 urls_list = [ | 98 urls_list = [ |
| 99 # Why: Renderer process memory bloat | 99 # Why: Renderer process memory bloat |
| 100 'http://techcrunch.com', | 100 'http://techcrunch.com', |
| 101 # pylint: disable=C0301 | 101 # pylint: disable=C0301 |
| 102 'http://techcrunch.com/2014/02/17/pixel-brings-brings-old-school-video-gam
e-art-to-life-in-your-home/', | 102 'http://techcrunch.com/2014/02/17/pixel-brings-brings-old-school-video-gam
e-art-to-life-in-your-home/', |
| 103 'http://techcrunch.com/2014/02/15/kickstarter-coins-2/', | 103 'http://techcrunch.com/2014/02/15/kickstarter-coins-2/', |
| 104 'http://techcrunch.com/2014/02/15/was-y-combinator-worth-it/', | 104 'http://techcrunch.com/2014/02/15/was-y-combinator-worth-it/', |
| 105 ] | 105 ] |
| 106 | 106 |
| 107 for url in urls_list: | 107 for url in urls_list: |
| 108 self.AddUserStory(ScrollPage(url, self)) | 108 self.AddUserStory(ScrollPage(url, self)) |
| OLD | NEW |