exclude PluginsFieldTrialTest.NoPrefLeftBehind from valgrind bot
[chromium-blink-merge.git] / tools / perf / page_sets / idle_multi_tab_cases.py
bloba057425d85962bfabddecea53b8f2168b63e9503
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.
5 import os
7 from telemetry.page import shared_page_state
8 from telemetry import story
10 from page_sets import google_pages
12 def _SpawnTab(action_runner):
13 return action_runner.EvaluateJavaScript('__telemetry_spawn_tab()')
16 def _CloseTab(action_runner, tab):
17 action_runner.EvaluateJavaScript('__telemetry_close_tab(' + str(tab) + ')')
20 def _CreateIdleMultiTabPageClass(base_page_cls, base_js):
21 class DerivedIdleMultiTabPage(base_page_cls): # pylint: disable=W0232
23 def RunPageInteractions(self, action_runner):
24 MAX_TABS = 4
25 action_runner.ExecuteJavaScript(base_js)
26 tabs = {}
27 # Slowly open tabs.
28 for tab in xrange(MAX_TABS):
29 tabs[tab] = _SpawnTab(action_runner)
30 action_runner.Wait(1)
31 action_runner.Wait(40)
32 # Slowly close tabs.
33 for tab in xrange(MAX_TABS):
34 _CloseTab(action_runner, tabs[tab])
35 action_runner.Wait(1)
36 action_runner.Wait(40)
37 return DerivedIdleMultiTabPage
40 class IdleMultiTabCasesPageSet(story.StorySet):
42 """ Pages for testing GC efficiency on idle pages. """
44 def __init__(self):
45 super(IdleMultiTabCasesPageSet, self).__init__(
46 archive_data_file='data/idle_multi_tab_cases.json',
47 cloud_storage_bucket=story.PARTNER_BUCKET)
48 with open(os.path.join(os.path.dirname(__file__),
49 'idle_multi_tab_cases.js')) as f:
50 base_js = f.read()
51 self.AddStory(
52 _CreateIdleMultiTabPageClass(google_pages.GoogleDocPage, base_js)
53 (self, shared_page_state.SharedDesktopPageState))