| 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 # pylint: disable=W0401,W0614 | 4 # pylint: disable=W0401,W0614 |
| 5 from telemetry.page.actions.all_page_actions import * | 5 from telemetry.page.actions.all_page_actions import * |
| 6 from telemetry.page import page as page_module | 6 from telemetry.page import page as page_module |
| 7 from telemetry.page import page_set as page_set_module | 7 from telemetry.page import page_set as page_set_module |
| 8 | 8 |
| 9 | 9 |
| 10 class MobileMemoryPage(page_module.Page): | 10 class MobileMemoryPage(page_module.Page): |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 page_set=page_set) | 24 page_set=page_set) |
| 25 | 25 |
| 26 self.reload_and_gc = [{'action': 'reload'}, | 26 self.reload_and_gc = [{'action': 'reload'}, |
| 27 {'action': 'wait', | 27 {'action': 'wait', |
| 28 'seconds': 15}, | 28 'seconds': 15}, |
| 29 {'action': 'js_collect_garbage'}] | 29 {'action': 'js_collect_garbage'}] |
| 30 self.credentials = 'google' | 30 self.credentials = 'google' |
| 31 | 31 |
| 32 def ReloadAndGc(self, action_runner): | 32 def ReloadAndGc(self, action_runner): |
| 33 action_runner.RunAction(ReloadAction()) | 33 action_runner.RunAction(ReloadAction()) |
| 34 action_runner.RunAction(WaitAction( | 34 action_runner.Wait(15) |
| 35 { | |
| 36 'seconds': 15 | |
| 37 })) | |
| 38 action_runner.RunAction(JsCollectGarbageAction()) | 35 action_runner.RunAction(JsCollectGarbageAction()) |
| 39 | 36 |
| 40 def RunStressMemory(self, action_runner): | 37 def RunStressMemory(self, action_runner): |
| 41 for _ in xrange(3): | 38 for _ in xrange(3): |
| 42 self.ReloadAndGc(action_runner) | 39 self.ReloadAndGc(action_runner) |
| 43 | 40 |
| 44 | 41 |
| 45 class GoogleSearchPage(MobileMemoryPage): | 42 class GoogleSearchPage(MobileMemoryPage): |
| 46 | 43 |
| 47 """ Why: Tests usage of discardable memory """ | 44 """ Why: Tests usage of discardable memory """ |
| 48 | 45 |
| 49 def __init__(self, page_set): | 46 def __init__(self, page_set): |
| 50 super(GoogleSearchPage, self).__init__( | 47 super(GoogleSearchPage, self).__init__( |
| 51 url='https://www.google.com/search?site=&tbm=isch&q=google', | 48 url='https://www.google.com/search?site=&tbm=isch&q=google', |
| 52 page_set=page_set) | 49 page_set=page_set) |
| 53 | 50 |
| 54 def RunStressMemory(self, action_runner): | 51 def RunStressMemory(self, action_runner): |
| 55 action_runner.RunAction(ScrollAction()) | 52 action_runner.RunAction(ScrollAction()) |
| 56 action_runner.RunAction(WaitAction( | 53 action_runner.Wait(3) |
| 57 { | |
| 58 'seconds': 3 | |
| 59 })) | |
| 60 action_runner.RunAction(ScrollAction()) | 54 action_runner.RunAction(ScrollAction()) |
| 61 action_runner.RunAction(WaitAction( | 55 action_runner.Wait(3) |
| 62 { | |
| 63 'seconds': 3 | |
| 64 })) | |
| 65 action_runner.RunAction(ScrollAction()) | 56 action_runner.RunAction(ScrollAction()) |
| 66 action_runner.RunAction(WaitAction( | 57 action_runner.Wait(3) |
| 67 { | |
| 68 'seconds': 3 | |
| 69 })) | |
| 70 action_runner.RunAction(ScrollAction()) | 58 action_runner.RunAction(ScrollAction()) |
| 71 action_runner.RunAction(WaitAction( | 59 action_runner.WaitForJavaScriptCondition( |
| 72 { | 60 'document.getElementById("rg_s").childElementCount > 300') |
| 73 'javascript': | |
| 74 'document.getElementById("rg_s").childElementCount > 300' | |
| 75 })) | |
| 76 | 61 |
| 77 | 62 |
| 78 class ScrollPage(MobileMemoryPage): | 63 class ScrollPage(MobileMemoryPage): |
| 79 | 64 |
| 80 def __init__(self, url, page_set): | 65 def __init__(self, url, page_set): |
| 81 super(ScrollPage, self).__init__(url=url, page_set=page_set) | 66 super(ScrollPage, self).__init__(url=url, page_set=page_set) |
| 82 | 67 |
| 83 def RunStressMemory(self, action_runner): | 68 def RunStressMemory(self, action_runner): |
| 84 action_runner.RunAction(ScrollAction()) | 69 action_runner.RunAction(ScrollAction()) |
| 85 | 70 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 101 # Why: Renderer process memory bloat | 86 # Why: Renderer process memory bloat |
| 102 'http://techcrunch.com', | 87 'http://techcrunch.com', |
| 103 # pylint: disable=C0301 | 88 # pylint: disable=C0301 |
| 104 'http://techcrunch.com/2014/02/17/pixel-brings-brings-old-school-video-gam
e-art-to-life-in-your-home/', | 89 'http://techcrunch.com/2014/02/17/pixel-brings-brings-old-school-video-gam
e-art-to-life-in-your-home/', |
| 105 'http://techcrunch.com/2014/02/15/kickstarter-coins-2/', | 90 'http://techcrunch.com/2014/02/15/kickstarter-coins-2/', |
| 106 'http://techcrunch.com/2014/02/15/was-y-combinator-worth-it/', | 91 'http://techcrunch.com/2014/02/15/was-y-combinator-worth-it/', |
| 107 ] | 92 ] |
| 108 | 93 |
| 109 for url in urls_list: | 94 for url in urls_list: |
| 110 self.AddPage(ScrollPage(url, self)) | 95 self.AddPage(ScrollPage(url, self)) |
| OLD | NEW |