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

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

Issue 1092393002: Telemetry: Quiescent power benchmarks for Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@safari-backend
Patch Set: Fix unit test Created 5 years, 8 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
« no previous file with comments | « tools/perf/benchmarks/power.py ('k') | tools/perf/measurements/power.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 sys 5 import sys
6 import unittest 6 import unittest
7 7
8 from telemetry.core import browser_options 8 from telemetry.core import browser_options
9 from telemetry.results import page_test_results 9 from telemetry.results import page_test_results
10 from telemetry.unittest_util import simple_mock 10 from telemetry.unittest_util import simple_mock
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 results = page_test_results.PageTestResults() 220 results = page_test_results.PageTestResults()
221 results.WillRunPage(page) 221 results.WillRunPage(page)
222 cycler.WillNavigateToPage(page, tab) 222 cycler.WillNavigateToPage(page, tab)
223 cycler.ValidateAndMeasurePage(page, tab, results) 223 cycler.ValidateAndMeasurePage(page, tab, results)
224 results.DidRunPage(page) 224 results.DidRunPage(page)
225 225
226 values = results.all_page_specific_values 226 values = results.all_page_specific_values
227 227
228 # On Mac, there is an additional measurement: the number of keychain 228 # On Mac, there is an additional measurement: the number of keychain
229 # accesses. 229 # accesses.
230 value_count = 4 230 value_count = 3
231 if sys.platform == 'darwin': 231 if sys.platform == 'darwin':
232 value_count += 1 232 value_count += 1
233 self.assertEqual(value_count, len(values)) 233 self.assertEqual(value_count, len(values))
234 234
235 self.assertEqual(values[0].page, page) 235 self.assertEqual(values[0].page, page)
236 chart_name = 'cold_times' if i == 0 else 'warm_times' 236 chart_name = 'cold_times' if i == 0 else 'warm_times'
237 self.assertEqual(values[0].name, '%s.page_load_time' % chart_name) 237 self.assertEqual(values[0].name, '%s.page_load_time' % chart_name)
238 self.assertEqual(values[0].units, 'ms') 238 self.assertEqual(values[0].units, 'ms')
239 239
240 expected_values = ['gpu', 'renderer', 'browser'] 240 expected_values = ['gpu', 'browser']
241 for value, expected in zip(values[1:len(expected_values) + 1], 241 for value, expected in zip(values[1:len(expected_values) + 1],
242 expected_values): 242 expected_values):
243 self.assertEqual(value.page, page) 243 self.assertEqual(value.page, page)
244 self.assertEqual(value.name, 244 self.assertEqual(value.name,
245 'cpu_utilization.cpu_utilization_%s' % expected) 245 'cpu_utilization.cpu_utilization_%s' % expected)
246 self.assertEqual(value.units, '%') 246 self.assertEqual(value.units, '%')
247 247
248 cycler.DidNavigateToPage(page, tab) 248 cycler.DidNavigateToPage(page, tab)
249 249
250 def testLegacyPagesAvoidCrossRenderNavigation(self): 250 def testLegacyPagesAvoidCrossRenderNavigation(self):
251 # For legacy page cyclers with file URLs, verify that WillNavigateToPage 251 # For legacy page cyclers with file URLs, verify that WillNavigateToPage
252 # does an initial navigate to avoid paying for a cross-renderer navigation. 252 # does an initial navigate to avoid paying for a cross-renderer navigation.
253 cycler = self.SetUpCycler(setup_memory_module=True) 253 cycler = self.SetUpCycler(setup_memory_module=True)
254 pages = [FakePage('file://fakepage1.com'), FakePage('file://fakepage2.com')] 254 pages = [FakePage('file://fakepage1.com'), FakePage('file://fakepage2.com')]
255 tab = FakeTab() 255 tab = FakeTab()
256 256
257 self.assertEqual([], tab.navigated_urls) 257 self.assertEqual([], tab.navigated_urls)
258 for page in pages * 2: 258 for page in pages * 2:
259 cycler.WillNavigateToPage(page, tab) 259 cycler.WillNavigateToPage(page, tab)
260 self.assertEqual( 260 self.assertEqual(
261 ['http://fakeserver:99999/nonexistent.html'], tab.navigated_urls) 261 ['http://fakeserver:99999/nonexistent.html'], tab.navigated_urls)
OLDNEW
« no previous file with comments | « tools/perf/benchmarks/power.py ('k') | tools/perf/measurements/power.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698