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 |
11 # in the documentation and/or other materials provided with the | 11 # in the documentation and/or other materials provided with the |
12 # distribution. | 12 # distribution. |
13 # * Neither the name of Google Inc. nor the names of its | 13 # * Neither the name of Google Inc. nor the names of its |
14 # contributors may be used to endorse or promote products derived from | 14 # contributors may be used to endorse or promote products derived from |
15 # this software without specific prior written permission. | 15 # this software without specific prior written permission. |
16 # | 16 # |
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
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 import logging | 29 from webkitpy.common.net.buildbot import BuildBot |
30 | |
31 from webkitpy.common.net.layouttestresults import LayoutTestResults | 30 from webkitpy.common.net.layouttestresults import LayoutTestResults |
32 from webkitpy.common.net import layouttestresults_unittest | 31 from webkitpy.common.net.layouttestresults_unittest import LayoutTestResultsTest |
33 | |
34 _log = logging.getLogger(__name__) | |
35 | 32 |
36 | 33 |
37 class MockBuild(object): | 34 class MockBuildBot(BuildBot): |
38 | |
39 def __init__(self, builder, build_number): | |
40 self._builder = builder | |
41 self._number = build_number | |
42 | |
43 def results_url(self): | |
44 return "%s/%s" % (self._builder.results_url(), self._number) | |
45 | |
46 | |
47 class MockBuilder(object): | |
48 | |
49 def __init__(self, builder_name): | |
50 self._name = builder_name | |
51 | |
52 def name(self): | |
53 return self._name | |
54 | |
55 def build(self, build_number): | |
56 return MockBuild(self, build_number=build_number) | |
57 | |
58 def results_url(self): | |
59 return "http://example.com/builders/%s/results" % self.name() | |
60 | |
61 def latest_layout_test_results_url(self): | |
62 return "http://example.com/f/builders/%s/results/layout-test-results" %
self.name() | |
63 | |
64 def latest_layout_test_results(self): | |
65 return self.fetch_layout_test_results(self.latest_layout_test_results_ur
l()) | |
66 | 35 |
67 def fetch_layout_test_results(self, _): | 36 def fetch_layout_test_results(self, _): |
68 return LayoutTestResults.results_from_string(layouttestresults_unittest.
LayoutTestResultsTest.example_full_results_json) | 37 return LayoutTestResults.results_from_string(LayoutTestResultsTest.examp
le_full_results_json) |
69 | |
70 | |
71 class MockBuildBot(object): | |
72 | |
73 def builder_with_name(self, builder_name): | |
74 return MockBuilder(builder_name) | |
OLD | NEW |