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 import logging | 5 import logging |
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 from page_sets.login_helpers import google_login | 11 from page_sets.login_helpers import google_login |
12 | 12 |
13 | 13 |
14 DUMP_WAIT_TIME = 3 | 14 DUMP_WAIT_TIME = 3 |
15 | 15 |
16 | 16 |
17 class BlinkMemoryMobilePage(page_module.Page): | 17 class BlinkMemoryMobilePage(page_module.Page): |
18 def __init__(self, url, page_set, name): | 18 def __init__(self, url, page_set, name): |
19 super(BlinkMemoryMobilePage, self).__init__( | 19 super(BlinkMemoryMobilePage, self).__init__( |
20 url=url, page_set=page_set, name=name, | 20 url=url, page_set=page_set, name=name, |
21 shared_page_state_class=shared_page_state.SharedMobilePageState, | 21 shared_page_state_class=shared_page_state.SharedMobilePageState, |
22 credentials_path='data/credentials.json') | 22 credentials_path='data/credentials.json') |
23 self.archive_data_file = 'data/blink_memory_mobile.json' | 23 self.archive_data_file = 'data/blink_memory_mobile.json' |
24 | 24 |
25 def _DumpMemory(self, action_runner, phase): | 25 def _DumpMemory(self, action_runner, phase): |
26 with action_runner.CreateInteraction(phase): | 26 with action_runner.CreateInteraction(phase): |
| 27 # before |
| 28 action_runner.Wait(DUMP_WAIT_TIME) |
| 29 if not action_runner.tab.browser.DumpMemory(): |
| 30 logging.error('Unable to get a memory dump for %s.', self.name) |
| 31 # after GC |
27 action_runner.Wait(DUMP_WAIT_TIME) | 32 action_runner.Wait(DUMP_WAIT_TIME) |
28 action_runner.ForceGarbageCollection() | 33 action_runner.ForceGarbageCollection() |
| 34 action_runner.Wait(DUMP_WAIT_TIME) |
| 35 if not action_runner.tab.browser.DumpMemory(): |
| 36 logging.error('Unable to get a memory dump for %s.', self.name) |
| 37 # after pressure notification |
| 38 action_runner.Wait(DUMP_WAIT_TIME) |
| 39 # action_runner.ForceGarbageCollection() |
29 action_runner.SimulateMemoryPressureNotification('critical') | 40 action_runner.SimulateMemoryPressureNotification('critical') |
30 action_runner.Wait(DUMP_WAIT_TIME) | 41 action_runner.Wait(DUMP_WAIT_TIME) |
31 if not action_runner.tab.browser.DumpMemory(): | 42 if not action_runner.tab.browser.DumpMemory(): |
32 logging.error('Unable to get a memory dump for %s.', self.name) | 43 logging.error('Unable to get a memory dump for %s.', self.name) |
33 | 44 |
34 def RunPageInteractions(self, action_runner): | 45 def RunPageInteractions(self, action_runner): |
35 action_runner.ScrollPage() | 46 action_runner.ScrollPage() |
36 self._DumpMemory(action_runner, 'scrolled') | 47 self._DumpMemory(action_runner, 'scrolled') |
37 | 48 |
38 | 49 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 # Why: Key products. | 139 # Why: Key products. |
129 self.AddStory(GmailPage(page_set=self)) | 140 self.AddStory(GmailPage(page_set=self)) |
130 self.AddStory(BlinkMemoryMobilePage( | 141 self.AddStory(BlinkMemoryMobilePage( |
131 'http://googlewebmastercentral.blogspot.com/2015/04/rolling-out-mobile-f
riendly-update.html?m=1', | 142 'http://googlewebmastercentral.blogspot.com/2015/04/rolling-out-mobile-f
riendly-update.html?m=1', |
132 page_set=self, | 143 page_set=self, |
133 name='Blogger')) | 144 name='Blogger')) |
134 self.AddStory(BlinkMemoryMobilePage( | 145 self.AddStory(BlinkMemoryMobilePage( |
135 'https://plus.google.com/app/basic/110031535020051778989/posts?source=ap
ppromo', | 146 'https://plus.google.com/app/basic/110031535020051778989/posts?source=ap
ppromo', |
136 page_set=self, | 147 page_set=self, |
137 name='GooglePlus')) | 148 name='GooglePlus')) |
OLD | NEW |