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 copy | 5 import copy |
6 import json | 6 import json |
7 import os | 7 import os |
8 import shutil | 8 import shutil |
9 import subprocess | 9 import subprocess |
10 import tempfile | 10 import tempfile |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 return puller.CompletenessPoint(time=time, | 225 return puller.CompletenessPoint(time=time, |
226 frame_completeness=frame_completeness) | 226 frame_completeness=frame_completeness) |
227 completness_record = [ | 227 completness_record = [ |
228 point(0, 0.0), | 228 point(0, 0.0), |
229 point(120, 0.4), | 229 point(120, 0.4), |
230 point(190, 0.75), | 230 point(190, 0.75), |
231 point(280, 1.0), | 231 point(280, 1.0), |
232 point(400, 1.0), | 232 point(400, 1.0), |
233 ] | 233 ] |
234 self.assertEqual(120 + 70 * 0.6 + 90 * 0.25, | 234 self.assertEqual(120 + 70 * 0.6 + 90 * 0.25, |
235 puller.ComputeSpeedIndex(completness_record)) | 235 puller._ComputeSpeedIndex(completness_record)) |
236 | 236 |
237 completness_record = [ | 237 completness_record = [ |
238 point(70, 0.0), | 238 point(70, 0.0), |
239 point(150, 0.3), | 239 point(150, 0.3), |
240 point(210, 0.6), | 240 point(210, 0.6), |
241 point(220, 0.9), | 241 point(220, 0.9), |
242 point(240, 1.0), | 242 point(240, 1.0), |
243 ] | 243 ] |
244 self.assertEqual(80 + 60 * 0.7 + 10 * 0.4 + 20 * 0.1, | 244 self.assertEqual(80 + 60 * 0.7 + 10 * 0.4 + 20 * 0.1, |
245 puller.ComputeSpeedIndex(completness_record)) | 245 puller._ComputeSpeedIndex(completness_record)) |
246 | 246 |
247 completness_record = [ | 247 completness_record = [ |
248 point(90, 0.0), | 248 point(90, 0.0), |
249 point(200, 0.6), | 249 point(200, 0.6), |
250 point(150, 0.3), | 250 point(150, 0.3), |
251 point(230, 1.0), | 251 point(230, 1.0), |
252 ] | 252 ] |
253 with self.assertRaises(ValueError): | 253 with self.assertRaises(ValueError): |
254 puller.ComputeSpeedIndex(completness_record) | 254 puller._ComputeSpeedIndex(completness_record) |
255 | 255 |
256 | 256 |
257 if __name__ == '__main__': | 257 if __name__ == '__main__': |
258 unittest.main() | 258 unittest.main() |
OLD | NEW |