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

Side by Side Diff: tools/perf/measurements/session_restore.py

Issue 808893002: [Telemetry] Remove session_restore's use of PageTest.CanRunForPage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unittest Created 5 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 unified diff | Download patch
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 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 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import collections 5 import collections
6 6
7 from measurements import startup 7 from measurements import startup
8 from metrics import cpu 8 from metrics import cpu
9 from metrics import startup_metric 9 from metrics import startup_metric
10 from telemetry.core import util 10 from telemetry.core import util
(...skipping 24 matching lines...) Expand all
35 def TabForPage(self, page, browser): 35 def TabForPage(self, page, browser):
36 # Detect that the session restore has completed. 36 # Detect that the session restore has completed.
37 util.WaitFor(lambda: browser.tabs and 37 util.WaitFor(lambda: browser.tabs and
38 histogram_util.GetHistogramCount( 38 histogram_util.GetHistogramCount(
39 histogram_util.BROWSER_HISTOGRAM, 39 histogram_util.BROWSER_HISTOGRAM,
40 'SessionRestore.AllTabsLoaded', 40 'SessionRestore.AllTabsLoaded',
41 browser.foreground_tab), 41 browser.foreground_tab),
42 60) 42 60)
43 return browser.foreground_tab 43 return browser.foreground_tab
44 44
45 def CanRunForPage(self, page):
46 # No matter how many pages in the pageset, just perform one test iteration.
47 return page.page_set.pages.index(page) == 0
48
49 def RunNavigateSteps(self, page, tab): 45 def RunNavigateSteps(self, page, tab):
50 # Overriden so that no page navigation occurs. 46 # Overridden so that no page navigation occurs.
51 pass 47 pass
52 48
53 def ValidatePageSet(self, page_set): 49 def ValidatePageSet(self, page_set):
54 wpr_archive_names_to_page_urls = collections.defaultdict(list) 50 wpr_archive_names_to_page_urls = collections.defaultdict(list)
55 # Construct the map from pages' wpr archive names to pages' urls. 51 # Construct the map from pages' wpr archive names to pages' urls.
56 for page in page_set: 52 for page in page_set:
57 if page.is_local: 53 if page.is_local:
58 continue 54 continue
59 wpr_archive_name = page_set.WprFilePathForUserStory(page) 55 wpr_archive_name = page_set.WprFilePathForUserStory(page)
60 wpr_archive_names_to_page_urls[wpr_archive_name].append(page.url) 56 wpr_archive_names_to_page_urls[wpr_archive_name].append(page.url)
61 57
62 # Reject any pageset that contains more than one WPR archive. 58 # Reject any pageset that contains more than one WPR archive.
63 if len(wpr_archive_names_to_page_urls.keys()) > 1: 59 if len(wpr_archive_names_to_page_urls.keys()) > 1:
64 raise Exception("Invalid pageset: more than 1 WPR archive found.: " + 60 raise Exception("Invalid pageset: more than 1 WPR archive found.: " +
65 repr(wpr_archive_names_to_page_urls)) 61 repr(wpr_archive_names_to_page_urls))
66 62
67 def DidStartBrowser(self, browser): 63 def DidStartBrowser(self, browser):
68 self._cpu_metric = cpu.CpuMetric(browser) 64 self._cpu_metric = cpu.CpuMetric(browser)
69 self._cpu_metric.Start(None, None) 65 self._cpu_metric.Start(None, None)
70 66
71 def ValidateAndMeasurePage(self, page, tab, results): 67 def ValidateAndMeasurePage(self, page, tab, results):
72 tab.WaitForDocumentReadyStateToBeComplete() 68 tab.WaitForDocumentReadyStateToBeComplete()
73 super(SessionRestore, self).ValidateAndMeasurePage(page, tab, results) 69 super(SessionRestore, self).ValidateAndMeasurePage(page, tab, results)
74 70
75 # Record CPU usage from browser start to when the foreground page is loaded. 71 # Record CPU usage from browser start to when the foreground page is loaded.
76 self._cpu_metric.Stop(None, None) 72 self._cpu_metric.Stop(None, None)
77 self._cpu_metric.AddResults(tab, results, 'cpu_utilization') 73 self._cpu_metric.AddResults(tab, results, 'cpu_utilization')
78 74
79 # TODO(jeremy): Measure time to load - first, last and frontmost tab here. 75 # TODO(jeremy): Measure time to load - first, last and frontmost tab here.
OLDNEW
« no previous file with comments | « tools/perf/benchmarks/session_restore.py ('k') | tools/telemetry/telemetry/user_story/user_story_set.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698