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 from telemetry
.page
import page_set
as page_set_module
5 from telemetry
.page
import shared_page_state
7 from page_sets
import top_pages
10 def _Reload(action_runner
):
11 # Numbers below are chosen arbitrarily. For the V8DetachedContextAgeInGC
12 # the number of reloads should be high enough so that V8 could do few
16 for _
in xrange(NUMBER_OF_RELOADS
):
17 action_runner
.ReloadPage()
18 action_runner
.Wait(WAIT_TIME
)
21 def _CreatePageClassWithReload(page_cls
):
22 class DerivedSmoothPage(page_cls
): # pylint: disable=W0232
24 def RunPageInteractions(self
, action_runner
):
25 _Reload(action_runner
)
26 return DerivedSmoothPage
29 class PageReloadCasesPageSet(page_set_module
.PageSet
):
31 """ Pages for testing GC efficiency on page reload. """
34 super(PageReloadCasesPageSet
, self
).__init
__(
35 archive_data_file
='data/top_25.json',
36 bucket
=page_set_module
.PARTNER_BUCKET
)
38 shared_desktop_state
= shared_page_state
.SharedDesktopPageState
40 self
.AddUserStory(_CreatePageClassWithReload(
41 top_pages
.GoogleWebSearchPage
)(self
, shared_desktop_state
))
42 self
.AddUserStory(_CreatePageClassWithReload(
43 top_pages
.GmailPage
)(self
, shared_desktop_state
))
44 self
.AddUserStory(_CreatePageClassWithReload(
45 top_pages
.GoogleCalendarPage
)(self
, shared_desktop_state
))
46 self
.AddUserStory(_CreatePageClassWithReload(
47 top_pages
.GoogleDocPage
)(self
, shared_desktop_state
))
48 self
.AddUserStory(_CreatePageClassWithReload(
49 top_pages
.GooglePlusPage
)(self
, shared_desktop_state
))
50 self
.AddUserStory(_CreatePageClassWithReload(
51 top_pages
.YoutubePage
)(self
, shared_desktop_state
))
52 self
.AddUserStory(_CreatePageClassWithReload(
53 top_pages
.WordpressPage
)(self
, shared_desktop_state
))
54 self
.AddUserStory(_CreatePageClassWithReload(
55 top_pages
.FacebookPage
)(self
, shared_desktop_state
))