ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / tools / perf / measurements / memory_multi_tab.py
blob2d344cd7e154e32b613330bd969e1522b7c2149b
1 # Copyright 2013 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 """Multi tab memory test.
7 This test is a multi tab test, but we're interested in measurements for
8 the entire test rather than each single page.
9 """
12 from metrics import memory
13 from telemetry.page import page_test
15 class MemoryMultiTab(page_test.PageTest):
16 def __init__(self):
17 super(MemoryMultiTab, self).__init__(
18 action_name_to_run='RunPageInteractions')
19 self._memory_metric = None
20 # _first_tab is used to make memory measurements
21 self._first_tab = None
23 def DidStartBrowser(self, browser):
24 self._memory_metric = memory.MemoryMetric(browser)
26 def CustomizeBrowserOptions(self, options):
27 memory.MemoryMetric.CustomizeBrowserOptions(options)
28 # Since this is a memory benchmark, we want to sample memory histograms at
29 # a high frequency.
30 options.AppendExtraBrowserArgs('--memory-metrics')
32 def TabForPage(self, page, browser):
33 return browser.tabs.New()
35 def DidNavigateToPage(self, page, tab):
36 # Start measurement on the first tab.
37 if not self._first_tab:
38 self._memory_metric.Start(page, tab)
39 self._first_tab = tab
41 def ValidateAndMeasurePage(self, page, tab, results):
42 # Finalize measurement on the last tab.
43 if len(tab.browser.tabs) == len(page.page_set.pages):
44 self._memory_metric.Stop(page, self._first_tab)
45 self._memory_metric.AddResults(self._first_tab, results)