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

Unified Diff: tools/perf/perf_tools/tab_switching_benchmark.py

Issue 13328004: Telemetry tab_switching_test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes from review. Created 7 years, 9 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/perf_tools/tab_switching_benchmark.py
diff --git a/tools/perf/perf_tools/tab_switching_benchmark.py b/tools/perf/perf_tools/tab_switching_benchmark.py
new file mode 100644
index 0000000000000000000000000000000000000000..ad1f8486e6269a30a3a4f97fd2d21204187fce12
--- /dev/null
+++ b/tools/perf/perf_tools/tab_switching_benchmark.py
@@ -0,0 +1,48 @@
+# Copyright (c) 2013 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 os
+
+from perf_tools import histogram_measurement
+from telemetry.core import util
+from telemetry.page import page_benchmark
+
+TAB_SWITCHING_HISTOGRAMS = [
+ {'name': 'MPArch.RWH_TabSwitchPaintDuration', 'units': ''},]
tonyg 2013/03/29 22:14:17 This is unused now
shatch 2013/03/29 22:59:12 Done.
+
+class TabSwitchingBenchmark(page_benchmark.PageBenchmark):
+ def CustomizeBrowserOptions(self, options):
+ options.AppendExtraBrowserArg('--dom-automation')
+ options.AppendExtraBrowserArg('--reduce-security-for-dom-automation-tests')
+
+ def WillNavigateToPage(self, page, tab):
+ # pylint: disable=W0201
+ self.histogram = histogram_measurement.HistogramMeasurement(
+ {'name': 'MPArch.RWH_TabSwitchPaintDuration', 'units': ''},
+ histogram_measurement.BROWSER_HISTOGRAM)
+
+ self.histogram.Start(page, tab)
+
+ def MeasurePage(self, page, tab, results):
+ page_path = os.path.join('..', '..', '..', 'data', 'tab_switching')
+ tab_urls = [
+ "espn.go.com", "bugzilla.mozilla.org", "news.cnet.com", "www.amazon.com",
+ "allegro.pl", "www.bbc.co.uk", "126.com", "www.altavista.com",
+ ]
+
+ tabs = [tab] + [tab.browser.tabs.New() for i in xrange(len(tab_urls) - 1)]
+
+ for i in xrange(len(tabs)):
+ cur_filename = os.path.join(page_path, tab_urls[i], 'index.html')
+ cur_target_side_url = tab.browser.http_server.UrlOf(cur_filename)
+
+ tabs[i].Navigate(cur_target_side_url)
+
+ for i in range(1):
+ for t in tabs:
+ t.Activate()
+ def _IsDone():
+ return bool(not t.EvaluateJavaScript('document.webkitHidden'))
tonyg 2013/03/29 22:14:17 Either the bool is unnecessary or the not is in th
shatch 2013/03/29 22:59:12 Done.
+ util.WaitFor(_IsDone, 500, poll_interval=5)
+
+ self.histogram.GetValue(page, tab, results)
« tools/perf/page_sets/tab_switching.json ('K') | « tools/perf/page_sets/tab_switching.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698