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

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: Removed var. 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
« no previous file with comments | « tools/perf/page_sets/tab_switching.json ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..c639a4cc4b23a155e740ce7d1b85c5ca161edbc5
--- /dev/null
+++ b/tools/perf/perf_tools/tab_switching_benchmark.py
@@ -0,0 +1,55 @@
+# 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.
+from perf_tools import histogram_measurement
+from telemetry.page import page_benchmark
+
+import os
+import time
tonyg 2013/03/29 20:37:35 Style nit: put system imports before telemetry imp
shatch 2013/03/29 21:40:00 Done.
+
+TAB_SWITCHING_HISTOGRAMS = [
+ {'name': 'MPArch.RWH_TabSwitchPaintDuration', 'units': ''},]
+
+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.histograms = [histogram_measurement.HistogramMeasurement(
+ h, histogram_measurement.BROWSER_HISTOGRAM)
+ for h in TAB_SWITCHING_HISTOGRAMS]
tonyg 2013/03/29 20:37:35 I know this is copy/paste from another benchmark,
shatch 2013/03/29 21:40:00 Done.
+ for h in self.histograms:
+ h.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",
+ # These pages seem to be broken
+ #"kannada.chakradeo.net", "ml.wikipedia.org"
tonyg 2013/03/29 20:37:35 I'd just omit these
shatch 2013/03/29 21:40:00 Done.
+ ]
+
+ _, filename = page.serving_dirs_and_file
+ launch_url = tab.browser.http_server.UrlOf(filename)
+
+ 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(launch_url)
tonyg 2013/03/29 20:37:35 What is the point of navigating to the launch URL
shatch 2013/03/29 21:40:00 Done.
+ tabs[i].EvaluateJavaScript('open_url("%s")' % cur_target_side_url)
+
+ for i in range(1):
+ for t in tabs:
+ t.Activate()
+ while t.EvaluateJavaScript('document.webkitHidden') != False:
tonyg 2013/03/29 20:37:35 Recommend using WaitFor() here.
shatch 2013/03/29 21:40:00 Done.
+ pass
+ time.sleep(0.1)
tonyg 2013/03/29 20:37:35 Why sleep? Is this what the old test did?
shatch 2013/03/29 21:40:00 Done.
+
+ for h in self.histograms:
+ h.GetValue(page, tab, results)
« no previous file with comments | « 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