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

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

Issue 252923002: Get rid of PageSet.FromDict from unittests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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 | « no previous file | tools/telemetry/telemetry/page/block_page_measurement_results_unittest.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 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 os 5 import os
6 import unittest 6 import unittest
7 7
8 from measurements import timeline_based_measurement as tbm_module 8 from measurements import timeline_based_measurement as tbm_module
9 from metrics import timeline_based_metric 9 from metrics import timeline_based_metric
10 from telemetry.core import wpr_modes 10 from telemetry.core import wpr_modes
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 res = [] 70 res = []
71 if interaction.is_smooth: 71 if interaction.is_smooth:
72 res.append(FakeSmoothMetric()) 72 res.append(FakeSmoothMetric())
73 if interaction.is_loading_resources: 73 if interaction.is_loading_resources:
74 res.append(FakeLoadingMetric()) 74 res.append(FakeLoadingMetric())
75 return res 75 return res
76 76
77 metric = tbm_module._TimelineBasedMetrics( # pylint: disable=W0212 77 metric = tbm_module._TimelineBasedMetrics( # pylint: disable=W0212
78 self.model, self.renderer_thread, 78 self.model, self.renderer_thread,
79 CreateMetricsForTimelineInteractionRecord) 79 CreateMetricsForTimelineInteractionRecord)
80 ps = page_set.PageSet.FromDict({ 80 ps = page_set.PageSet(file_path=os.path.dirname(__file__))
81 "description": "hello", 81 ps.AddPageWithDefaultRunNavigate('http://www.bar.com/')
82 "archive_path": "foo.wpr", 82
83 "pages": [
84 {"url": "http://www.bar.com/"}
85 ]
86 }, os.path.dirname(__file__))
87 results.WillMeasurePage(ps.pages[0]) 83 results.WillMeasurePage(ps.pages[0])
88 metric.AddResults(results) 84 metric.AddResults(results)
89 results.DidMeasurePage() 85 results.DidMeasurePage()
90 86
91 v = results.FindAllPageSpecificValuesNamed('LogicalName1-FakeSmoothMetric') 87 v = results.FindAllPageSpecificValuesNamed('LogicalName1-FakeSmoothMetric')
92 self.assertEquals(len(v), 1) 88 self.assertEquals(len(v), 1)
93 v = results.FindAllPageSpecificValuesNamed('LogicalName2-FakeLoadingMetric') 89 v = results.FindAllPageSpecificValuesNamed('LogicalName2-FakeLoadingMetric')
94 self.assertEquals(len(v), 1) 90 self.assertEquals(len(v), 1)
95 91
96 92
(...skipping 10 matching lines...) Expand all
107 'javascript': 'window.animationDone'}) 103 'javascript': 'window.animationDone'})
108 measurement = tbm_module.TimelineBasedMeasurement() 104 measurement = tbm_module.TimelineBasedMeasurement()
109 results = self.RunMeasurement(measurement, ps, 105 results = self.RunMeasurement(measurement, ps,
110 options=self._options) 106 options=self._options)
111 self.assertEquals(0, len(results.failures)) 107 self.assertEquals(0, len(results.failures))
112 v = results.FindAllPageSpecificValuesNamed('CenterAnimation-jank') 108 v = results.FindAllPageSpecificValuesNamed('CenterAnimation-jank')
113 self.assertEquals(len(v), 1) 109 self.assertEquals(len(v), 1)
114 v = results.FindAllPageSpecificValuesNamed('DrawerAnimation-jank') 110 v = results.FindAllPageSpecificValuesNamed('DrawerAnimation-jank')
115 self.assertEquals(len(v), 1) 111 self.assertEquals(len(v), 1)
116 112
OLDNEW
« no previous file with comments | « no previous file | tools/telemetry/telemetry/page/block_page_measurement_results_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698