Change next_proto member type.
[chromium-blink-merge.git] / tools / perf / page_sets / mobile_memory.py
blob222e108982d373e2f5685cd07576c8f91447db22
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
3 # found in the LICENSE file.
4 from telemetry.page import page as page_module
5 from telemetry.page import page_set as page_set_module
8 class MobileMemoryPage(page_module.Page):
10 def __init__(self, url, page_set):
11 super(MobileMemoryPage, self).__init__(
12 url=url, page_set=page_set, credentials_path = 'data/credentials.json')
13 self.user_agent_type = 'mobile'
14 self.archive_data_file = 'data/mobile_memory.json'
17 class GmailPage(MobileMemoryPage):
19 def __init__(self, page_set):
20 super(GmailPage, self).__init__(
21 url='https://mail.google.com/mail/mu',
22 page_set=page_set)
24 self.reload_and_gc = [{'action': 'reload'},
25 {'action': 'wait',
26 'seconds': 15},
27 {'action': 'js_collect_garbage'}]
28 self.credentials = 'google'
30 def ReloadAndGc(self, action_runner):
31 action_runner.ReloadPage()
32 action_runner.Wait(15)
33 action_runner.ForceGarbageCollection()
35 def RunPageInteractions(self, action_runner):
36 for _ in xrange(3):
37 self.ReloadAndGc(action_runner)
40 class GoogleSearchPage(MobileMemoryPage):
42 """ Why: Tests usage of discardable memory """
44 def __init__(self, page_set):
45 super(GoogleSearchPage, self).__init__(
46 url='https://www.google.com/search?site=&tbm=isch&q=google',
47 page_set=page_set)
49 def RunPageInteractions(self, action_runner):
50 interaction = action_runner.BeginGestureInteraction(
51 'ScrollAction', is_smooth=True)
52 action_runner.ScrollPage()
53 interaction.End()
54 action_runner.Wait(3)
55 interaction = action_runner.BeginGestureInteraction(
56 'ScrollAction', is_smooth=True)
57 action_runner.ScrollPage()
58 interaction.End()
59 action_runner.Wait(3)
60 interaction = action_runner.BeginGestureInteraction(
61 'ScrollAction', is_smooth=True)
62 action_runner.ScrollPage()
63 interaction.End()
64 action_runner.Wait(3)
65 interaction = action_runner.BeginGestureInteraction(
66 'ScrollAction', is_smooth=True)
67 action_runner.ScrollPage()
68 interaction.End()
69 action_runner.WaitForJavaScriptCondition(
70 'document.getElementById("rg_s").childElementCount > 300')
73 class ScrollPage(MobileMemoryPage):
75 def __init__(self, url, page_set):
76 super(ScrollPage, self).__init__(url=url, page_set=page_set)
78 def RunPageInteractions(self, action_runner):
79 interaction = action_runner.BeginGestureInteraction(
80 'ScrollAction', is_smooth=True)
81 action_runner.ScrollPage()
82 interaction.End()
85 class MobileMemoryPageSet(page_set_module.PageSet):
87 """ Mobile sites with interesting memory characteristics """
89 def __init__(self):
90 super(MobileMemoryPageSet, self).__init__(
91 user_agent_type='mobile',
92 archive_data_file='data/mobile_memory.json',
93 bucket=page_set_module.PARTNER_BUCKET)
95 self.AddPage(GmailPage(self))
96 self.AddPage(GoogleSearchPage(self))
98 urls_list = [
99 # Why: Renderer process memory bloat
100 'http://techcrunch.com',
101 # pylint: disable=C0301
102 'http://techcrunch.com/2014/02/17/pixel-brings-brings-old-school-video-game-art-to-life-in-your-home/',
103 'http://techcrunch.com/2014/02/15/kickstarter-coins-2/',
104 'http://techcrunch.com/2014/02/15/was-y-combinator-worth-it/',
107 for url in urls_list:
108 self.AddPage(ScrollPage(url, self))