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 action_runner.Wait(DUMP_WAIT_TIME) | 27 action_runner.Wait(DUMP_WAIT_TIME) |
28 action_runner.ForceGarbageCollection() | 28 #action_runner.ForceGarbageCollection() |
29 action_runner.SimulateMemoryPressureNotification('critical') | 29 #action_runner.SimulateMemoryPressureNotification('critical') |
30 action_runner.Wait(DUMP_WAIT_TIME) | 30 #action_runner.Wait(DUMP_WAIT_TIME) |
31 if not action_runner.tab.browser.DumpMemory(): | 31 if not action_runner.tab.browser.DumpMemory(): |
32 logging.error('Unable to get a memory dump for %s.', self.name) | 32 logging.error('Unable to get a memory dump for %s.', self.name) |
33 | 33 |
34 def RunPageInteractions(self, action_runner): | 34 def RunPageInteractions(self, action_runner): |
35 action_runner.ScrollPage() | 35 action_runner.ScrollPage() |
36 self._DumpMemory(action_runner, 'scrolled') | 36 self._DumpMemory(action_runner, 'scrolled') |
37 | 37 action_runner.Wait(DUMP_WAIT_TIME) |
| 38 self._DumpMemory(action_runner, 'scrolled2') |
38 | 39 |
39 class TheVergePage(BlinkMemoryMobilePage): | 40 class TheVergePage(BlinkMemoryMobilePage): |
40 COMMENT_LINK_SELECTOR = '.show_comments_link' | 41 COMMENT_LINK_SELECTOR = '.show_comments_link' |
41 | 42 |
42 def __init__(self, page_set): | 43 def __init__(self, page_set): |
43 super(TheVergePage, self).__init__( | 44 super(TheVergePage, self).__init__( |
44 'http://www.theverge.com/2015/8/11/9133883/taylor-swift-spotify-discover
-weekly-what-is-going-on', | 45 'http://www.theverge.com/2015/8/11/9133883/taylor-swift-spotify-discover
-weekly-what-is-going-on', |
45 page_set=page_set, | 46 page_set=page_set, |
46 name='TheVerge') | 47 name='TheVerge') |
47 | 48 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 # Why: Key products. | 129 # Why: Key products. |
129 self.AddStory(GmailPage(page_set=self)) | 130 self.AddStory(GmailPage(page_set=self)) |
130 self.AddStory(BlinkMemoryMobilePage( | 131 self.AddStory(BlinkMemoryMobilePage( |
131 'http://googlewebmastercentral.blogspot.com/2015/04/rolling-out-mobile-f
riendly-update.html?m=1', | 132 'http://googlewebmastercentral.blogspot.com/2015/04/rolling-out-mobile-f
riendly-update.html?m=1', |
132 page_set=self, | 133 page_set=self, |
133 name='Blogger')) | 134 name='Blogger')) |
134 self.AddStory(BlinkMemoryMobilePage( | 135 self.AddStory(BlinkMemoryMobilePage( |
135 'https://plus.google.com/app/basic/110031535020051778989/posts?source=ap
ppromo', | 136 'https://plus.google.com/app/basic/110031535020051778989/posts?source=ap
ppromo', |
136 page_set=self, | 137 page_set=self, |
137 name='GooglePlus')) | 138 name='GooglePlus')) |
OLD | NEW |