OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 unittest | 5 import unittest |
6 | 6 |
7 import request_track | 7 import request_track |
8 import test_utils | 8 import test_utils |
9 import user_satisfied_lens | 9 import user_satisfied_lens |
10 | 10 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 trace_creator = test_utils.TraceCreator() | 141 trace_creator = test_utils.TraceCreator() |
142 requests = [trace_creator.RequestAt(1), trace_creator.RequestAt(10), | 142 requests = [trace_creator.RequestAt(1), trace_creator.RequestAt(10), |
143 trace_creator.RequestAt(15), trace_creator.RequestAt(20)] | 143 trace_creator.RequestAt(15), trace_creator.RequestAt(20)] |
144 loading_trace = trace_creator.CreateTrace( | 144 loading_trace = trace_creator.CreateTrace( |
145 requests, | 145 requests, |
146 [{'ts': 0, 'ph': 'I', | 146 [{'ts': 0, 'ph': 'I', |
147 'cat': 'blink', | 147 'cat': 'blink', |
148 'name': 'firstPaint'}, | 148 'name': 'firstPaint'}, |
149 {'ts': 9 * self.MILLI_TO_MICRO, 'ph': 'I', | 149 {'ts': 9 * self.MILLI_TO_MICRO, 'ph': 'I', |
150 'cat': 'blink.user_timing', | 150 'cat': 'blink.user_timing', |
151 'name': 'FrameView::synchronizedPaint'}, | 151 'name': 'FrameView::paintTree'}, |
152 {'ts': 18 * self.MILLI_TO_MICRO, 'ph': 'I', | 152 {'ts': 18 * self.MILLI_TO_MICRO, 'ph': 'I', |
153 'cat': 'blink', | 153 'cat': 'blink', |
154 'name': 'FrameView::synchronizedPaint'}, | 154 'name': 'FrameView::paintTree'}, |
155 {'ts': 22 * self.MILLI_TO_MICRO, 'ph': 'I', | 155 {'ts': 22 * self.MILLI_TO_MICRO, 'ph': 'I', |
156 'cat': 'blink', | 156 'cat': 'blink', |
157 'name': 'FrameView::synchronizedPaint'}, | 157 'name': 'FrameView::paintTree'}, |
158 {'ts': 5 * self.MILLI_TO_MICRO, 'ph': 'I', | 158 {'ts': 5 * self.MILLI_TO_MICRO, 'ph': 'I', |
159 'cat': 'foobar', 'name': 'biz', | 159 'cat': 'foobar', 'name': 'biz', |
160 'args': {'counters': { | 160 'args': {'counters': { |
161 'LayoutObjectsThatHadNeverHadLayout': 10 | 161 'LayoutObjectsThatHadNeverHadLayout': 10 |
162 } } }, | 162 } } }, |
163 {'ts': 12 * self.MILLI_TO_MICRO, 'ph': 'I', | 163 {'ts': 12 * self.MILLI_TO_MICRO, 'ph': 'I', |
164 'cat': 'foobar', 'name': 'biz', | 164 'cat': 'foobar', 'name': 'biz', |
165 'args': {'counters': { | 165 'args': {'counters': { |
166 'LayoutObjectsThatHadNeverHadLayout': 12 | 166 'LayoutObjectsThatHadNeverHadLayout': 12 |
167 } } }, | 167 } } }, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 self.assertEqual(set(['0.1', '0.2']), lens.CriticalRequestIds()) | 200 self.assertEqual(set(['0.1', '0.2']), lens.CriticalRequestIds()) |
201 self.assertEqual(1, lens.PostloadTimeMsec()) | 201 self.assertEqual(1, lens.PostloadTimeMsec()) |
202 request_lens = user_satisfied_lens.RequestFingerprintLens( | 202 request_lens = user_satisfied_lens.RequestFingerprintLens( |
203 loading_trace, lens.CriticalFingerprints()) | 203 loading_trace, lens.CriticalFingerprints()) |
204 self.assertEqual(set(['0.1', '0.2']), request_lens.CriticalRequestIds()) | 204 self.assertEqual(set(['0.1', '0.2']), request_lens.CriticalRequestIds()) |
205 self.assertEqual(0, request_lens.PostloadTimeMsec()) | 205 self.assertEqual(0, request_lens.PostloadTimeMsec()) |
206 | 206 |
207 | 207 |
208 if __name__ == '__main__': | 208 if __name__ == '__main__': |
209 unittest.main() | 209 unittest.main() |
OLD | NEW |