summaryrefslogtreecommitdiffstats
path: root/tools/perf/page_sets/page_reload_cases.py
blob: 7642e8572624af9f7094540e8ec09aca46c5fbcb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.page import shared_page_state
from telemetry.page import page_set as page_set_module

from page_sets import top_pages


def _Reload(action_runner):
  # Numbers below are chosen arbitrarily. For the V8DetachedContextAgeInGC
  # the number of reloads should be high enough so that V8 could do few
  # incremeantal GCs.
  NUMBER_OF_RELOADS = 7
  WAIT_TIME = 2
  for _ in xrange(NUMBER_OF_RELOADS):
    action_runner.ReloadPage()
    action_runner.Wait(WAIT_TIME)


def _CreatePageClassWithReload(page_cls):
  class DerivedSmoothPage(page_cls):  # pylint: disable=W0232

    def RunPageInteractions(self, action_runner):
      _Reload(action_runner)
  return DerivedSmoothPage


class PageReloadCasesPageSet(page_set_module.PageSet):

  """ Pages for testing GC efficiency on page reload. """

  def __init__(self):
    super(PageReloadCasesPageSet, self).__init__(
        archive_data_file='data/top_25.json',
        bucket=page_set_module.PARTNER_BUCKET)

    shared_desktop_state = shared_page_state.SharedDesktopPageState

    self.AddUserStory(_CreatePageClassWithReload(
        top_pages.GoogleWebSearchPage)(self, shared_desktop_state))
    self.AddUserStory(_CreatePageClassWithReload(
        top_pages.GmailPage)(self, shared_desktop_state))
    self.AddUserStory(_CreatePageClassWithReload(
        top_pages.GoogleCalendarPage)(self, shared_desktop_state))
    self.AddUserStory(_CreatePageClassWithReload(
        top_pages.GoogleDocPage)(self, shared_desktop_state))
    self.AddUserStory(_CreatePageClassWithReload(
        top_pages.GooglePlusPage)(self, shared_desktop_state))
    self.AddUserStory(_CreatePageClassWithReload(
        top_pages.YoutubePage)(self, shared_desktop_state))
    self.AddUserStory(_CreatePageClassWithReload(
        top_pages.WordpressPage)(self, shared_desktop_state))
    self.AddUserStory(_CreatePageClassWithReload(
        top_pages.FacebookPage)(self, shared_desktop_state))