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 14 matching lines...) Expand all Loading... |
25 {'action': 'wait', | 25 {'action': 'wait', |
26 'seconds': 15}, | 26 'seconds': 15}, |
27 {'action': 'js_collect_garbage'}] | 27 {'action': 'js_collect_garbage'}] |
28 self.credentials = 'google' | 28 self.credentials = 'google' |
29 | 29 |
30 def ReloadAndGc(self, action_runner): | 30 def ReloadAndGc(self, action_runner): |
31 action_runner.ReloadPage() | 31 action_runner.ReloadPage() |
32 action_runner.Wait(15) | 32 action_runner.Wait(15) |
33 action_runner.ForceGarbageCollection() | 33 action_runner.ForceGarbageCollection() |
34 | 34 |
35 def RunStressMemory(self, action_runner): | 35 def RunPageInteractions(self, action_runner): |
36 for _ in xrange(3): | 36 for _ in xrange(3): |
37 self.ReloadAndGc(action_runner) | 37 self.ReloadAndGc(action_runner) |
38 | 38 |
39 | 39 |
40 class GoogleSearchPage(MobileMemoryPage): | 40 class GoogleSearchPage(MobileMemoryPage): |
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 RunStressMemory(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', is_smooth=True) |
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', is_smooth=True) |
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', is_smooth=True) |
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', is_smooth=True) |
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 RunStressMemory(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', is_smooth=True) |
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 |
(...skipping 10 matching lines...) Expand all Loading... |
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.AddPage(ScrollPage(url, self)) | 108 self.AddPage(ScrollPage(url, self)) |
OLD | NEW |