Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: gm/rebaseline_server/results_test.py

Issue 197213033: rebaseline_server: serve JSON from static file, rather than generating it live (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 """ 3 """
4 Copyright 2013 Google Inc. 4 Copyright 2013 Google Inc.
5 5
6 Use of this source code is governed by a BSD-style license that can be 6 Use of this source code is governed by a BSD-style license that can be
7 found in the LICENSE file. 7 found in the LICENSE file.
8 8
9 Test results.py 9 Test results.py
10 10
(...skipping 16 matching lines...) Expand all
27 import gm_json # must import results first, so that gm_json will be in sys.path 27 import gm_json # must import results first, so that gm_json will be in sys.path
28 28
29 29
30 class ResultsTest(base_unittest.TestCase): 30 class ResultsTest(base_unittest.TestCase):
31 31
32 def test_gm(self): 32 def test_gm(self):
33 """Process results of a GM run with the Results object.""" 33 """Process results of a GM run with the Results object."""
34 results_obj = results.Results( 34 results_obj = results.Results(
35 actuals_root=os.path.join(self._input_dir, 'gm-actuals'), 35 actuals_root=os.path.join(self._input_dir, 'gm-actuals'),
36 expected_root=os.path.join(self._input_dir, 'gm-expectations'), 36 expected_root=os.path.join(self._input_dir, 'gm-expectations'),
37 generated_images_root=self._temp_dir) 37 generated_images_root=self._temp_dir,
38 diff_base_url='/static/generated-images')
38 results_obj.get_timestamp = mock_get_timestamp 39 results_obj.get_timestamp = mock_get_timestamp
39 gm_json.WriteToFile( 40 gm_json.WriteToFile(
40 results_obj.get_packaged_results_of_type( 41 results_obj.get_packaged_results_of_type(
41 results.KEY__HEADER__RESULTS_ALL), 42 results.KEY__HEADER__RESULTS_ALL),
42 os.path.join(self._output_dir_actual, 'gm.json')) 43 os.path.join(self._output_dir_actual, 'gm.json'))
43 44
44 45
45 def mock_get_timestamp(): 46 def mock_get_timestamp():
46 """Mock version of Results.get_timestamp() for testing.""" 47 """Mock version of Results.get_timestamp() for testing."""
47 return 12345678 48 return 12345678
48 49
49 50
50 def main(): 51 def main():
51 base_unittest.main(ResultsTest) 52 base_unittest.main(ResultsTest)
52 53
53 54
54 if __name__ == '__main__': 55 if __name__ == '__main__':
55 main() 56 main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698