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

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

Issue 1839193004: Run auto-formatter (autopep8) on webkitpy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 8 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 17 matching lines...) Expand all
28 28
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 def __init__(self, build_number, revision, is_green): 39 def __init__(self, build_number, revision, is_green):
39 self._number = build_number 40 self._number = build_number
40 self._revision = revision 41 self._revision = revision
41 self._is_green = is_green 42 self._is_green = is_green
42 43
44
43 class MockBuilder(object): 45 class MockBuilder(object):
46
44 def __init__(self, name): 47 def __init__(self, name):
45 self._name = name 48 self._name = name
46 49
47 def name(self): 50 def name(self):
48 return self._name 51 return self._name
49 52
50 def build(self, build_number): 53 def build(self, build_number):
51 return MockBuild(build_number=build_number, revision=1234, is_green=Fals e) 54 return MockBuild(build_number=build_number, revision=1234, is_green=Fals e)
52 55
53 def results_url(self): 56 def results_url(self):
54 return "http://example.com/builders/%s/results" % self.name() 57 return "http://example.com/builders/%s/results" % self.name()
55 58
56 def accumulated_results_url(self): 59 def accumulated_results_url(self):
57 return "http://example.com/f/builders/%s/results/layout-test-results" % self.name() 60 return "http://example.com/f/builders/%s/results/layout-test-results" % self.name()
58 61
59 def latest_layout_test_results_url(self): 62 def latest_layout_test_results_url(self):
60 return self.accumulated_results_url() 63 return self.accumulated_results_url()
61 64
62 def latest_layout_test_results(self): 65 def latest_layout_test_results(self):
63 return LayoutTestResults.results_from_string(layouttestresults_unittest. LayoutTestResultsTest.example_full_results_json) 66 return LayoutTestResults.results_from_string(layouttestresults_unittest. LayoutTestResultsTest.example_full_results_json)
64 67
68
65 class MockBuildBot(object): 69 class MockBuildBot(object):
70
66 def __init__(self): 71 def __init__(self):
67 self._mock_builder1_status = { 72 self._mock_builder1_status = {
68 "name": "Builder1", 73 "name": "Builder1",
69 "is_green": True, 74 "is_green": True,
70 "activity": "building", 75 "activity": "building",
71 } 76 }
72 self._mock_builder2_status = { 77 self._mock_builder2_status = {
73 "name": "Builder2", 78 "name": "Builder2",
74 "is_green": True, 79 "is_green": True,
75 "activity": "idle", 80 "activity": "idle",
76 } 81 }
77 82
78 def builder_with_name(self, name): 83 def builder_with_name(self, name):
79 return MockBuilder(name) 84 return MockBuilder(name)
80 85
81 def builder_statuses(self): 86 def builder_statuses(self):
82 return [ 87 return [
83 self._mock_builder1_status, 88 self._mock_builder1_status,
84 self._mock_builder2_status, 89 self._mock_builder2_status,
85 ] 90 ]
86 91
87 def light_tree_on_fire(self): 92 def light_tree_on_fire(self):
88 self._mock_builder2_status["is_green"] = False 93 self._mock_builder2_status["is_green"] = False
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698