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 metrics import speedindex | |
13 from telemetry.image_processing import histogram | 12 from telemetry.image_processing import histogram |
14 from telemetry.image_processing import rgba_color | 13 from telemetry.image_processing import rgba_color |
15 | 14 |
| 15 from metrics import speedindex |
| 16 |
16 | 17 |
17 class FakeImageUtil(object): | 18 class FakeImageUtil(object): |
18 # pylint: disable=W0613 | 19 # pylint: disable=W0613 |
19 def GetColorHistogram(self, image, ignore_color=None, tolerance=None): | 20 def GetColorHistogram(self, image, ignore_color=None, tolerance=None): |
20 return image.ColorHistogram() | 21 return image.ColorHistogram() |
21 | 22 |
22 | 23 |
23 class FakeVideo(object): | 24 class FakeVideo(object): |
24 def __init__(self, frames): | 25 def __init__(self, frames): |
25 self._frames = frames | 26 self._frames = frames |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 self.assertEqual(time_completeness[2], (0.2, 0.0)) | 113 self.assertEqual(time_completeness[2], (0.2, 0.0)) |
113 self.assertEqual(time_completeness[3], (0.3, 1.0)) | 114 self.assertEqual(time_completeness[3], (0.3, 1.0)) |
114 | 115 |
115 def assertTimeCompleteness(self, time_completeness, time, completeness): | 116 def assertTimeCompleteness(self, time_completeness, time, completeness): |
116 self.assertEqual(time_completeness[0], time) | 117 self.assertEqual(time_completeness[0], time) |
117 self.assertAlmostEqual(time_completeness[1], completeness) | 118 self.assertAlmostEqual(time_completeness[1], completeness) |
118 | 119 |
119 | 120 |
120 if __name__ == "__main__": | 121 if __name__ == "__main__": |
121 unittest.main() | 122 unittest.main() |
OLD | NEW |