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

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

Issue 2112133002: Greatly simplify buildbot module and remove usage of master name. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 # 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 18 matching lines...) Expand all
29 import logging 29 import logging
30 30
31 from webkitpy.common.net.layouttestresults import LayoutTestResults 31 from webkitpy.common.net.layouttestresults import LayoutTestResults
32 from webkitpy.common.net import layouttestresults_unittest 32 from webkitpy.common.net import layouttestresults_unittest
33 33
34 _log = logging.getLogger(__name__) 34 _log = logging.getLogger(__name__)
35 35
36 36
37 class MockBuild(object): 37 class MockBuild(object):
38 38
39 def __init__(self, builder, build_number, revision, is_green): 39 def __init__(self, builder, build_number):
40 self._builder = builder 40 self._builder = builder
41 self._number = build_number 41 self._number = build_number
42 self._revision = revision
wkorman 2016/07/01 19:00:20 Or specific revisions, no longer needed, or handle
qyearsley 2016/07/01 19:08:06 AFAIK, no longer needed anymore or used anymore. C
43 self._is_green = is_green
44 42
45 def results_url(self): 43 def results_url(self):
46 return "%s/%s" % (self._builder.results_url(), self._number) 44 return "%s/%s" % (self._builder.results_url(), self._number)
47 45
48 46
49 class MockBuilder(object): 47 class MockBuilder(object):
50 48
51 def __init__(self, builder_name, master_name='chromium.mock'): 49 def __init__(self, builder_name):
52 self._name = builder_name 50 self._name = builder_name
53 self._master_name = master_name
54 51
55 def name(self): 52 def name(self):
56 return self._name 53 return self._name
57 54
58 def build(self, build_number): 55 def build(self, build_number):
59 return MockBuild(self, build_number=build_number, revision=1234, is_gree n=False) 56 return MockBuild(self, build_number=build_number)
60 57
61 def results_url(self): 58 def results_url(self):
62 return "http://example.com/builders/%s/results" % self.name() 59 return "http://example.com/builders/%s/results" % self.name()
63 60
64 def accumulated_results_url(self): 61 def latest_layout_test_results_url(self):
65 return "http://example.com/f/builders/%s/results/layout-test-results" % self.name() 62 return "http://example.com/f/builders/%s/results/layout-test-results" % self.name()
66 63
67 def latest_layout_test_results_url(self):
68 return self.accumulated_results_url()
69
70 def latest_layout_test_results(self): 64 def latest_layout_test_results(self):
71 return self.fetch_layout_test_results(self.latest_layout_test_results_ur l()) 65 return self.fetch_layout_test_results(self.latest_layout_test_results_ur l())
72 66
73 def fetch_layout_test_results(self, _): 67 def fetch_layout_test_results(self, _):
74 return LayoutTestResults.results_from_string(layouttestresults_unittest. LayoutTestResultsTest.example_full_results_json) 68 return LayoutTestResults.results_from_string(layouttestresults_unittest. LayoutTestResultsTest.example_full_results_json)
75 69
76 70
77 class MockBuildBot(object): 71 class MockBuildBot(object):
78 72
79 def __init__(self): 73 def builder_with_name(self, builder_name):
80 self._mock_builder1_status = { 74 return MockBuilder(builder_name)
81 "name": "Builder1",
82 "is_green": True,
83 "activity": "building",
84 }
85 self._mock_builder2_status = {
86 "name": "Builder2",
87 "is_green": True,
88 "activity": "idle",
89 }
90
91 def builder_with_name(self, builder_name, master_name='chromium.mock'):
92 return MockBuilder(builder_name, master_name)
93
94 def builder_statuses(self):
95 return [
96 self._mock_builder1_status,
97 self._mock_builder2_status,
98 ]
99
100 def light_tree_on_fire(self):
101 self._mock_builder2_status["is_green"] = False
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698