def ValidateAndMeasurePage(self, page, tab, results): """Record the ending histogram for the tab switching metric.""" last_histogram = cros_utils.GetTabSwitchHistogramRetry(tab.browser) total_diff_histogram = histogram_util.SubtractHistogram( last_histogram, self._first_histogram) display_name = 'MPArch_RWH_TabSwitchPaintDuration' results.AddSummaryValue( histogram.HistogramValue(None, display_name, 'ms', raw_value_json=total_diff_histogram, important=False))
def RunPageInteractions(self, action_runner): """Tab switching to each tabs.""" url_list = self.URL_LIST * self._tabset_repeat browser = action_runner.tab.browser total_tab_count = len(url_list) live_tab_count = len(browser.tabs) if live_tab_count != total_tab_count: logging.warning('live tab: %d, tab discarded: %d', live_tab_count, total_tab_count - live_tab_count) with cros_utils.KeyboardEmulator(self._cros_remote) as keyboard: for i in range(total_tab_count): prev_histogram = cros_utils.GetTabSwitchHistogramRetry(browser) keyboard.SwitchTab() cros_utils.WaitTabSwitching(browser, prev_histogram) if i % 10 == 0: print 'switching tab:', i
def DidNavigateToPage(self, page, tab): """Record the starting histogram.""" self._first_histogram = cros_utils.GetTabSwitchHistogramRetry( tab.browser)