OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Dummy module that pretends to be imagediffdb.py for write_json_summary_test. | 6 """Dummy module that pretends to be imagediffdb.py for write_json_summary_test. |
7 | 7 |
8 imagediffdb.py here refers to | 8 imagediffdb.py here refers to |
9 https://code.google.com/p/skia/source/browse/trunk/gm/rebaseline_server/imagedif
fdb.py | 9 https://code.google.com/p/skia/source/browse/trunk/gm/rebaseline_server/imagedif
fdb.py |
| 10 |
| 11 TODO(rmistry): As noted in https://codereview.chromium.org/183763025 , |
| 12 it would be good for us to add lots of assertions about how this mock gets |
| 13 called during unittests. |
10 """ | 14 """ |
11 | 15 |
12 | 16 |
13 class DiffRecord(object): | 17 class DiffRecord(object): |
14 | 18 |
15 def __init__(self, storage_root, expected_image_url, expected_image_locator, | 19 def __init__(self, storage_root=None, expected_image_url=None, |
16 actual_image_url, actual_image_locator, expected_images_subdir, | 20 expected_image_locator=None, actual_image_url=None, |
17 actual_images_subdir): | 21 actual_image_locator=None, expected_images_subdir=None, |
| 22 actual_images_subdir=None): |
18 pass | 23 pass |
19 | 24 |
20 def get_num_pixels_differing(self): | 25 def get_num_pixels_differing(self): |
21 return 1 | 26 return 1 |
22 | 27 |
23 def get_percent_pixels_differing(self): | 28 def get_percent_pixels_differing(self): |
24 return 2 | 29 return 2 |
25 | 30 |
26 def get_weighted_diff_measure(self): | 31 def get_weighted_diff_measure(self): |
27 return 3 | 32 return 3 |
28 | 33 |
29 def get_max_diff_per_channel(self): | 34 def get_max_diff_per_channel(self): |
30 return 4 | 35 return 4 |
31 | 36 |
| 37 def get_perceptual_difference(self): |
| 38 return 5 |
| 39 |
| 40 |
| 41 class ImageDiffDB(object): |
| 42 |
| 43 def __init__(self, storage_root): |
| 44 pass |
| 45 |
| 46 def add_image_pair(self, expected_image_url, expected_image_locator, |
| 47 actual_image_url, actual_image_locator): |
| 48 pass |
| 49 |
| 50 def get_diff_record(self, expected_image_locator, actual_image_locator): |
| 51 return DiffRecord() |
OLD | NEW |