OLD | NEW |
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 # These tests access private methods in the speedindex module. | 5 # These tests access private methods in the speedindex module. |
6 # pylint: disable=W0212 | 6 # pylint: disable=W0212 |
7 | 7 |
8 import json | 8 import json |
9 import os | 9 import os |
10 import unittest | 10 import unittest |
11 | 11 |
12 from telemetry.core import bitmap | 12 from telemetry.core import bitmap |
13 from telemetry.core.backends.chrome import inspector_timeline_data | 13 from telemetry.timeline import inspector_timeline_data |
14 from telemetry.core.timeline import model | 14 from telemetry.timeline import model |
15 from metrics import speedindex | 15 from metrics import speedindex |
16 | 16 |
17 # Sample timeline data in the json format provided by devtools. | 17 # Sample timeline data in the json format provided by devtools. |
18 # The sample events will be used in several tests below. | 18 # The sample events will be used in several tests below. |
19 _TEST_DIR = os.path.join(os.path.dirname(__file__), 'unittest_data') | 19 _TEST_DIR = os.path.join(os.path.dirname(__file__), 'unittest_data') |
20 _SAMPLE_DATA = json.load(open(os.path.join(_TEST_DIR, 'sample_timeline.json'))) | 20 _SAMPLE_DATA = json.load(open(os.path.join(_TEST_DIR, 'sample_timeline.json'))) |
21 _SAMPLE_TIMELINE_DATA = inspector_timeline_data.InspectorTimelineData( | 21 _SAMPLE_TIMELINE_DATA = inspector_timeline_data.InspectorTimelineData( |
22 _SAMPLE_DATA) | 22 _SAMPLE_DATA) |
23 _SAMPLE_EVENTS = model.TimelineModel( | 23 _SAMPLE_EVENTS = model.TimelineModel( |
24 timeline_data=_SAMPLE_TIMELINE_DATA).GetAllEvents() | 24 timeline_data=_SAMPLE_TIMELINE_DATA).GetAllEvents() |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 | 224 |
225 def test2ch(self): | 225 def test2ch(self): |
226 # Page: http://2ch.net/ | 226 # Page: http://2ch.net/ |
227 # This page has several paint events, including nested paint events. | 227 # This page has several paint events, including nested paint events. |
228 self._TestJsonTimelineExpectation( | 228 self._TestJsonTimelineExpectation( |
229 '2ch_repeat_timeline.json', (997, 650), 674.58) | 229 '2ch_repeat_timeline.json', (997, 650), 674.58) |
230 | 230 |
231 | 231 |
232 if __name__ == "__main__": | 232 if __name__ == "__main__": |
233 unittest.main() | 233 unittest.main() |
OLD | NEW |