Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: tools/perf/page_sets/blink_memory_mobile.py

Issue 1266833004: telemetry: Add a page set for blink's memory usage measurement (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Timeline based Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 # found in the LICENSE file.
4
5 import logging
6
7 from telemetry.page import page as page_module
8 from telemetry.page import shared_page_state
9 from telemetry import story
10
11 from page_sets.login_helpers import google_login
12
13
14 class BlinkMemoryMobilePage(page_module.Page):
15 def __init__(self, url, page_set, name):
16 super(BlinkMemoryMobilePage, self).__init__(
17 url=url, page_set=page_set, name=name,
18 shared_page_state_class=shared_page_state.SharedMobilePageState,
19 credentials_path='data/credentials.json')
20 self.archive_data_file = 'data/blink_memory_mobile.json'
21
22 def _DumpMemory(self, action_runner, phase):
23 with action_runner.CreateInteraction(phase):
24 if not action_runner.tab.browser.DumpMemory():
25 logging.error('Unable to get a memory dump for %s.', self.name)
26
27 def RunPageInteractions(self, action_runner):
28 action_runner.ScrollPage()
perezju 2015/08/28 12:54:32 Not for this CL, but after running this benchmark
bashi 2015/08/31 23:47:28 Thanks for the suggestion. Added gc and delays (li
29 self._DumpMemory(action_runner, 'scrolled')
30
31
32 class TheVergePage(BlinkMemoryMobilePage):
33 COMMENT_LINK_SELECTOR = '.show_comments_link'
34
35 def __init__(self, page_set):
36 super(TheVergePage, self).__init__(
37 # pylint: disable=line-too-long
Sami 2015/08/28 11:32:22 Looks like the linter rule update landed already s
bashi 2015/08/31 23:47:28 Done.
38 url='http://www.theverge.com/2015/8/11/9133883/taylor-swift-spotify-disc over-weekly-what-is-going-on',
39 page_set=page_set,
40 name='TheVerge')
41
42 def RunPageInteractions(self, action_runner):
43 action_runner.WaitForElement(selector=TheVergePage.COMMENT_LINK_SELECTOR)
44 action_runner.ExecuteJavaScript(
45 'window.location.hash = "comments"')
46 action_runner.TapElement(
47 selector=TheVergePage.COMMENT_LINK_SELECTOR)
48 action_runner.WaitForJavaScriptCondition(
49 'window.Chorus.Comments.collection.length > 0')
50 super(TheVergePage, self).RunPageInteractions(action_runner)
51
52
53 class FacebookPage(BlinkMemoryMobilePage):
54 def __init__(self, page_set):
55 super(FacebookPage, self).__init__(
56 url='https://facebook.com/barackobama',
57 page_set=page_set,
58 name='Facebook')
59
60 def RunNavigateSteps(self, action_runner):
61 super(FacebookPage, self).RunNavigateSteps(action_runner)
62 action_runner.WaitForJavaScriptCondition(
63 'document.getElementById("u_0_c") !== null &&'
64 'document.body.scrollHeight > window.innerHeight')
65
66
67 class GmailPage(BlinkMemoryMobilePage):
68 def __init__(self, page_set):
69 super(GmailPage, self).__init__(
70 url='https://mail.google.com/mail/',
71 page_set=page_set,
72 name='Gmail')
73
74 def RunNavigateSteps(self, action_runner):
75 google_login.LoginGoogleAccount(action_runner, 'google',
76 self.credentials_path)
77 super(GmailPage, self).RunNavigateSteps(action_runner)
78 action_runner.WaitForNavigate()
Sami 2015/08/28 11:32:22 Could you add a comment here about the multiple re
bashi 2015/08/31 23:47:28 Done.
79 action_runner.WaitForElement(selector='#apploadingdiv')
80 action_runner.WaitForJavaScriptCondition(
81 'document.querySelector("#apploadingdiv").style.opacity == "0"')
82
83
84 class BlinkMemoryMobilePageSet(story.StorySet):
85 """Key mobile sites for Blink memory reduction."""
86
87 def __init__(self):
88 super(BlinkMemoryMobilePageSet, self).__init__(
89 archive_data_file='data/blink_memory_mobile.json',
90 cloud_storage_bucket=story.PARTNER_BUCKET)
91
92 # Why: High rate of Blink's memory consumption rate.
93 self.AddStory(BlinkMemoryMobilePage(
94 url='https://www.pinterest.com',
95 page_set=self,
96 name='Pinterest'))
97 self.AddStory(FacebookPage(self))
98 # TODO(bashi): Enable TheVergePage. http://crbug.com/522381
99 # self.AddStory(TheVergePage(self))
100
101 # Why: High rate of Blink's memory comsumption rate on low-RAM devices.
102 self.AddStory(BlinkMemoryMobilePage(
103 url='http://en.m.wikipedia.org/wiki/Wikipedia',
104 page_set=self,
105 name='Wikipedia (1 tab) - delayed scroll start',))
106 self.AddStory(BlinkMemoryMobilePage(
107 url='http://www.reddit.com/r/programming/comments/1g96ve',
108 page_set=self,
109 name='Reddit'))
110 self.AddStory(BlinkMemoryMobilePage(
111 # pylint: disable=line-too-long
112 url='https://en.blog.wordpress.com/2012/09/04/freshly-pressed-editors-pi cks-for-august-2012/',
113 page_set=self,
114 name='Wordpress'))
115
116 # Why: Renderer memory usage is high.
117 self.AddStory(BlinkMemoryMobilePage(
118 url='http://worldjournal.com/',
119 page_set=self,
120 name='Worldjournal'))
121
122 # Why: Key products.
123 self.AddStory(GmailPage(page_set=self))
124 self.AddStory(BlinkMemoryMobilePage(
125 # pylint: disable=line-too-long
126 url='http://googlewebmastercentral.blogspot.com/2015/04/rolling-out-mobi le-friendly-update.html?m=1',
127 page_set=self,
128 name='Blogger'))
129 self.AddStory(BlinkMemoryMobilePage(
130 # pylint: disable=line-too-long
131 url='https://plus.google.com/app/basic/110031535020051778989/posts?sourc e=apppromo',
132 page_set=self,
133 name='GooglePlus'))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698