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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/common/net/buildbot/buildbot_mock.py

Issue 1953463002: Empty webkitpy/common/net/buildbot/__init__.py and update imports. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove the net/buildbot/ subdirectory; move the files into net/ and fix pylint warnings Created 4 years, 7 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
(Empty)
1 # Copyright (C) 2011 Google Inc. All rights reserved.
2 #
3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are
5 # met:
6 #
7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer
11 # in the documentation and/or other materials provided with the
12 # distribution.
13 # * Neither the name of Google Inc. nor the names of its
14 # contributors may be used to endorse or promote products derived from
15 # this software without specific prior written permission.
16 #
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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.
28
29 import logging
30
31 from webkitpy.common.net.layouttestresults import LayoutTestResults
32 from webkitpy.common.net import layouttestresults_unittest
33
34 _log = logging.getLogger(__name__)
35
36
37 class MockBuild(object):
38
39 def __init__(self, build_number, revision, is_green):
40 self._number = build_number
41 self._revision = revision
42 self._is_green = is_green
43
44
45 class MockBuilder(object):
46
47 def __init__(self, name):
48 self._name = name
49
50 def name(self):
51 return self._name
52
53 def build(self, build_number):
54 return MockBuild(build_number=build_number, revision=1234, is_green=Fals e)
55
56 def results_url(self):
57 return "http://example.com/builders/%s/results" % self.name()
58
59 def accumulated_results_url(self):
60 return "http://example.com/f/builders/%s/results/layout-test-results" % self.name()
61
62 def latest_layout_test_results_url(self):
63 return self.accumulated_results_url()
64
65 def latest_layout_test_results(self):
66 return LayoutTestResults.results_from_string(layouttestresults_unittest. LayoutTestResultsTest.example_full_results_json)
67
68
69 class MockBuildBot(object):
70
71 def __init__(self):
72 self._mock_builder1_status = {
73 "name": "Builder1",
74 "is_green": True,
75 "activity": "building",
76 }
77 self._mock_builder2_status = {
78 "name": "Builder2",
79 "is_green": True,
80 "activity": "idle",
81 }
82
83 def builder_with_name(self, name):
84 return MockBuilder(name)
85
86 def builder_statuses(self):
87 return [
88 self._mock_builder1_status,
89 self._mock_builder2_status,
90 ]
91
92 def light_tree_on_fire(self):
93 self._mock_builder2_status["is_green"] = False
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698