OLD | NEW |
1 # Copyright (C) 2011 Google Inc. All rights reserved. | 1 # Copyright (C) 2011 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 13 matching lines...) Expand all Loading... |
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 | 28 |
29 from webkitpy.common.net.buildbot import BuildBot | 29 from webkitpy.common.net.buildbot import BuildBot |
30 from webkitpy.common.net.layouttestresults import LayoutTestResults | 30 from webkitpy.common.net.layouttestresults import LayoutTestResults |
31 from webkitpy.common.net.layouttestresults_unittest import LayoutTestResultsTest | 31 from webkitpy.common.net.layouttestresults_unittest import LayoutTestResultsTest |
32 | 32 |
33 | 33 |
| 34 # TODO(qyearsley): Instead of canned results from another module, other unit |
| 35 # tests may be a little easier to understand if this returned None by default |
| 36 # when there are no canned results to return. |
34 class MockBuildBot(BuildBot): | 37 class MockBuildBot(BuildBot): |
35 | 38 |
36 def __init__(self): | 39 def __init__(self): |
37 super(MockBuildBot, self).__init__() | 40 super(MockBuildBot, self).__init__() |
38 # Dict of Build to canned LayoutTestResults. | 41 # Dict of Build to canned LayoutTestResults. |
39 self._canned_results = {} | 42 self._canned_results = {} |
40 | 43 |
41 def fetch_layout_test_results(self, _): | 44 def fetch_layout_test_results(self, _): |
42 return LayoutTestResults.results_from_string(LayoutTestResultsTest.examp
le_full_results_json) | 45 return LayoutTestResults.results_from_string(LayoutTestResultsTest.examp
le_full_results_json) |
43 | 46 |
44 def set_results(self, build, results): | 47 def set_results(self, build, results): |
45 self._canned_results[build] = results | 48 self._canned_results[build] = results |
46 | 49 |
47 def fetch_results(self, build): | 50 def fetch_results(self, build): |
48 return self._canned_results.get( | 51 return self._canned_results.get( |
49 build, | 52 build, |
50 LayoutTestResults.results_from_string(LayoutTestResultsTest.example_
full_results_json)) | 53 LayoutTestResults.results_from_string(LayoutTestResultsTest.example_
full_results_json)) |
OLD | NEW |