Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Unified Diff: tools/perf/measurements/signin.py

Issue 134733019: Add perf histogram and tests for inline signin (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/perf/measurements/signin.py
diff --git a/tools/perf/measurements/signin.py b/tools/perf/measurements/signin.py
new file mode 100644
index 0000000000000000000000000000000000000000..f27342d28db5f5798b3fc2f40bebf551a4530fc6
--- /dev/null
+++ b/tools/perf/measurements/signin.py
@@ -0,0 +1,71 @@
+# Copyright 2014 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.
+
+import json
+
+from metrics import histogram_util
+from telemetry.page import page_measurement
+
+class SigninMeasurement(page_measurement.PageMeasurement):
+ HISTOGRAMS_SUFFIXES = ['PreGaiaLoadTime', 'GaiaLoadTime']
+
+ def __init__(self, restart_after_each_run = True):
+ super(SigninMeasurement, self).__init__(
+ needs_browser_restart_after_each_run=restart_after_each_run)
+ self._close_tabs_before_run = False
+ self._use_same_tab = True
+ self._pageset_repeat_iters = 0
+ self._trace_name = 'InlineUI_LoadAfterStartupDuration'
+ self._histogram_prefix = 'Signin.InlineUI.LoadAfterStartup.'
+
+ def CustomizeBrowserOptions(self, options):
+ options.AppendExtraBrowserArgs('--enable-stats-collection-bindings')
+ self._pageset_repeat_iters = options.pageset_repeat_iters
+
+ def TabForPage(self, page, browser):
+ return browser.tabs[0] if self._use_same_tab else browser.tabs.New()
+
+ def MeasurePage(self, page, tab, results):
+ total_num_tabs = 1 if self._use_same_tab else \
+ len(page.page_set.pages) * self._pageset_repeat_iters + 1
+ if len(tab.browser.tabs) != total_num_tabs:
+ return
+
+ tab.WaitForJavaScriptExpression('window.__login_ui_initialized', 5000)
+
+ for suffix in self.HISTOGRAMS_SUFFIXES:
+ load_histogram = json.loads(histogram_util.GetHistogram(
+ histogram_util.BROWSER_HISTOGRAM,
+ self._histogram_prefix + suffix, tab))
+ load_histogram_count = load_histogram['count'] \
+ if 'count' in load_histogram else 0
+ expected_histogram_count = 1 if self._use_same_tab else total_num_tabs -1
+ if load_histogram_count != expected_histogram_count:
+ raise Exception(
+ 'Unexpected number of histograms, expected:%d, actual:%d'
+ % (expected_histogram_count, load_histogram_count))
+
+ results.Add(self._trace_name + '_' + suffix, 'ms',
+ load_histogram['sum'] / load_histogram_count)
+
+
+class SigninMultiTabMeasurement(SigninMeasurement):
+ def __init__(self):
+ super(SigninMultiTabMeasurement, self).__init__(
+ restart_after_each_run=False)
+ self._use_same_tab = False
+
+
+class SigninStartUpMeasurement(SigninMeasurement):
+ def __init__(self):
+ super(SigninStartUpMeasurement, self).__init__()
+ self._trace_name = 'InlineUI_LoadOnStartupDuration'
+ self._histogram_prefix = 'Signin.InlineUI.LoadOnStartup.'
+
+ def CustomizeBrowserOptions(self, options):
+ super(SigninStartUpMeasurement, self).CustomizeBrowserOptions(options)
+ options.AppendExtraBrowserArgs('--force-signin-promo')
+
+ def RunNavigateSteps(self, page, tab):
+ pass

Powered by Google App Engine
This is Rietveld 408576698