[Android WebViewShell] Add inclusion test for webview exposed stable interfaces.
[chromium-blink-merge.git] / tools / perf / page_sets / mobile_memory.py
blob5cded3bd6e175025575e69d296e83dc32a12937e
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 shared_page_state
6 from telemetry import story
9 class MobileMemoryPage(page_module.Page):
11 def __init__(self, url, page_set):
12 super(MobileMemoryPage, self).__init__(
13 url=url, page_set=page_set, credentials_path = 'data/credentials.json',
14 shared_page_state_class=shared_page_state.SharedMobilePageState)
15 self.archive_data_file = 'data/mobile_memory.json'
18 class GmailPage(MobileMemoryPage):
20 def __init__(self, page_set):
21 super(GmailPage, self).__init__(
22 url='https://mail.google.com/mail/mu',
23 page_set=page_set)
25 self.reload_and_gc = [{'action': 'reload'},
26 {'action': 'wait',
27 'seconds': 15},
28 {'action': 'js_collect_garbage'}]
29 self.credentials = 'google'
31 def ReloadAndGc(self, action_runner):
32 action_runner.ReloadPage()
33 action_runner.Wait(15)
34 action_runner.ForceGarbageCollection()
36 def RunPageInteractions(self, action_runner):
37 for _ in xrange(3):
38 self.ReloadAndGc(action_runner)
41 class GoogleSearchPage(MobileMemoryPage):
43 """ Why: Tests usage of discardable memory """
45 def __init__(self, page_set):
46 super(GoogleSearchPage, self).__init__(
47 url='https://www.google.com/search?site=&tbm=isch&q=google',
48 page_set=page_set)
50 def RunPageInteractions(self, action_runner):
51 with action_runner.CreateGestureInteraction('ScrollAction'):
52 action_runner.ScrollPage()
53 action_runner.Wait(3)
54 with action_runner.CreateGestureInteraction('ScrollAction'):
55 action_runner.ScrollPage()
56 action_runner.Wait(3)
57 with action_runner.CreateGestureInteraction('ScrollAction'):
58 action_runner.ScrollPage()
59 action_runner.Wait(3)
60 with action_runner.CreateGestureInteraction('ScrollAction'):
61 action_runner.ScrollPage()
62 action_runner.WaitForJavaScriptCondition(
63 'document.getElementById("rg_s").childElementCount > 300')
66 class ScrollPage(MobileMemoryPage):
68 def __init__(self, url, page_set):
69 super(ScrollPage, self).__init__(url=url, page_set=page_set)
71 def RunPageInteractions(self, action_runner):
72 with action_runner.CreateGestureInteraction('ScrollAction'):
73 action_runner.ScrollPage()
76 class MobileMemoryPageSet(story.StorySet):
78 """ Mobile sites with interesting memory characteristics """
80 def __init__(self):
81 super(MobileMemoryPageSet, self).__init__(
82 archive_data_file='data/mobile_memory.json',
83 cloud_storage_bucket=story.PARTNER_BUCKET)
85 self.AddStory(GmailPage(self))
86 self.AddStory(GoogleSearchPage(self))
88 urls_list = [
89 # Why: Renderer process memory bloat
90 'http://techcrunch.com',
91 # pylint: disable=C0301
92 'http://techcrunch.com/2014/02/17/pixel-brings-brings-old-school-video-game-art-to-life-in-your-home/',
93 'http://techcrunch.com/2014/02/15/kickstarter-coins-2/',
94 'http://techcrunch.com/2014/02/15/was-y-combinator-worth-it/',
97 for url in urls_list:
98 self.AddStory(ScrollPage(url, self))