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

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

Issue 165193002: [Telemetry] Fix --cold-load-percent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unittest Created 6 years, 10 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 | Annotate | Revision Log
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 import unittest 4 import unittest
5 5
6 from measurements import page_cycler 6 from measurements import page_cycler
7 from telemetry.core import browser_options 7 from telemetry.core import browser_options
8 from telemetry.page import page_measurement_results 8 from telemetry.page import page_measurement_results
9 from telemetry.unittest import simple_mock 9 from telemetry.unittest import simple_mock
10 10
(...skipping 20 matching lines...) Expand all
31 31
32 # Used to mock loading a page. 32 # Used to mock loading a page.
33 class FakePage(object): 33 class FakePage(object):
34 def __init__(self, url): 34 def __init__(self, url):
35 self.url = url 35 self.url = url
36 36
37 # Used to mock a browser tab. 37 # Used to mock a browser tab.
38 class FakeTab(object): 38 class FakeTab(object):
39 def __init__(self): 39 def __init__(self):
40 self.clear_cache_calls = 0 40 self.clear_cache_calls = 0
41 def ClearCache(self): 41 def ClearCache(self, force=False):
42 assert force
42 self.clear_cache_calls += 1 43 self.clear_cache_calls += 1
43 def EvaluateJavaScript(self, _): 44 def EvaluateJavaScript(self, _):
44 return 1 45 return 1
45 def WaitForJavaScriptExpression(self, _, __): 46 def WaitForJavaScriptExpression(self, _, __):
46 pass 47 pass
47 48
48 class PageCyclerUnitTest(unittest.TestCase): 49 class PageCyclerUnitTest(unittest.TestCase):
49 50
50 # TODO(tonyg): Remove this backfill when we can assume python 2.7 everywhere. 51 # TODO(tonyg): Remove this backfill when we can assume python 2.7 everywhere.
51 def assertIn(self, first, second, _=None): 52 def assertIn(self, first, second, _=None):
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 values = results.page_specific_values_for_current_page 151 values = results.page_specific_values_for_current_page
151 results.DidMeasurePage() 152 results.DidMeasurePage()
152 153
153 self.assertEqual(1, len(values)) 154 self.assertEqual(1, len(values))
154 self.assertEqual(values[0].page, page) 155 self.assertEqual(values[0].page, page)
155 156
156 chart_name = 'cold_times' if i == 0 else 'warm_times' 157 chart_name = 'cold_times' if i == 0 else 'warm_times'
157 self.assertEqual(values[0].name, '%s.page_load_time' % chart_name) 158 self.assertEqual(values[0].name, '%s.page_load_time' % chart_name)
158 159
159 cycler.DidNavigateToPage(page, tab) 160 cycler.DidNavigateToPage(page, tab)
OLDNEW
« no previous file with comments | « tools/perf/measurements/page_cycler.py ('k') | tools/telemetry/telemetry/core/backends/chrome/chrome_browser_backend.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698