OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 19 matching lines...) Expand all Loading... |
30 // FIXME: This is duplicated from ui/results.js :(. | 30 // FIXME: This is duplicated from ui/results.js :(. |
31 function isAnyReftest(testName, resultsByTest) | 31 function isAnyReftest(testName, resultsByTest) |
32 { | 32 { |
33 return Object.keys(resultsByTest[testName]).map(function(builder) { | 33 return Object.keys(resultsByTest[testName]).map(function(builder) { |
34 return resultsByTest[testName][builder]; | 34 return resultsByTest[testName][builder]; |
35 }).some(function(resultNode) { | 35 }).some(function(resultNode) { |
36 return resultNode.reftest_type && resultNode.reftest_type.length; | 36 return resultNode.reftest_type && resultNode.reftest_type.length; |
37 }); | 37 }); |
38 } | 38 } |
39 | 39 |
40 // FIXME: Where should this function go? | |
41 function updateExpectationsWithStatusUpdates(failureInfoList) | |
42 { | |
43 var statusView = new ui.StatusArea('Expectations Update'); | |
44 var id = statusView.newId(); | |
45 | |
46 var testNames = base.uniquifyArray(failureInfoList.map(function(failureInfo)
{ return failureInfo.testName; })); | |
47 var testName = testNames.length == 1 ? testNames[0] : testNames.length + ' t
ests'; | |
48 statusView.addMessage(id, 'Updating expectations of ' + testName + '...'); | |
49 } | |
50 | |
51 controllers.ResultsDetails = base.extends(Object, { | 40 controllers.ResultsDetails = base.extends(Object, { |
52 init: function(view, resultsByTest) | 41 init: function(view, resultsByTest) |
53 { | 42 { |
54 this._view = view; | 43 this._view = view; |
55 this._resultsByTest = resultsByTest; | 44 this._resultsByTest = resultsByTest; |
56 this._view.setResultsByTest(resultsByTest); | 45 this._view.setResultsByTest(resultsByTest); |
57 | 46 |
58 this._view.firstResult(); | 47 this._view.firstResult(); |
59 | 48 |
60 $(this._view).bind('next', this.onNext.bind(this)); | 49 $(this._view).bind('next', this.onNext.bind(this)); |
61 $(this._view).bind('previous', this.onPrevious.bind(this)); | 50 $(this._view).bind('previous', this.onPrevious.bind(this)); |
62 $(this._view).bind('expectfailure', this.onUpdateExpectations.bind(this)
); | |
63 }, | 51 }, |
64 onNext: function() | 52 onNext: function() |
65 { | 53 { |
66 this._view.nextResult(); | 54 this._view.nextResult(); |
67 }, | 55 }, |
68 onPrevious: function() | 56 onPrevious: function() |
69 { | 57 { |
70 this._view.previousResult(); | 58 this._view.previousResult(); |
71 }, | 59 }, |
72 _failureInfoList: function() | 60 _failureInfoList: function() |
73 { | 61 { |
74 var testName = this._view.currentTestName(); | 62 var testName = this._view.currentTestName(); |
75 return Object.keys(this._resultsByTest[testName]).map(function(builderNa
me) { | 63 return Object.keys(this._resultsByTest[testName]).map(function(builderNa
me) { |
76 return results.failureInfoForTestAndBuilder(this._resultsByTest, tes
tName, builderName); | 64 return results.failureInfoForTestAndBuilder(this._resultsByTest, tes
tName, builderName); |
77 }.bind(this)); | 65 }.bind(this)); |
78 }, | 66 }, |
79 onUpdateExpectations: function() | |
80 { | |
81 updateExpectationsWithStatusUpdates(this._failureInfoList()); | |
82 } | |
83 }); | 67 }); |
84 | 68 |
85 var FailureStreamController = base.extends(Object, { | 69 var FailureStreamController = base.extends(Object, { |
86 _resultsFilter: null, | 70 _resultsFilter: null, |
87 _keyFor: function(failureAnalysis) { throw "Not implemented!"; }, | 71 _keyFor: function(failureAnalysis) { throw "Not implemented!"; }, |
88 _createFailureView: function(failureAnalysis) { throw "Not implemented!"; }, | 72 _createFailureView: function(failureAnalysis) { throw "Not implemented!"; }, |
89 | 73 |
90 init: function(model, view, delegate) | 74 init: function(model, view, delegate) |
91 { | 75 { |
92 this._model = model; | 76 this._model = model; |
93 this._view = view; | 77 this._view = view; |
94 this._delegate = delegate; | 78 this._delegate = delegate; |
95 this._testFailures = new base.UpdateTracker(); | 79 this._testFailures = new base.UpdateTracker(); |
96 }, | 80 }, |
97 update: function(failureAnalysis) | 81 update: function(failureAnalysis) |
98 { | 82 { |
99 var key = this._keyFor(failureAnalysis); | 83 var key = this._keyFor(failureAnalysis); |
100 var failure = this._testFailures.get(key); | 84 var failure = this._testFailures.get(key); |
101 if (!failure) { | 85 if (!failure) { |
102 failure = this._createFailureView(failureAnalysis); | 86 failure = this._createFailureView(failureAnalysis); |
103 this._view.add(failure); | 87 this._view.add(failure); |
104 $(failure).bind('examine', function() { | 88 $(failure).bind('examine', function() { |
105 this.onExamine(failure); | 89 this.onExamine(failure); |
106 }.bind(this)); | 90 }.bind(this)); |
107 $(failure).bind('expectfailure', function() { | |
108 this.onUpdateExpectations(failure); | |
109 }.bind(this)); | |
110 } | 91 } |
111 failure.addFailureAnalysis(failureAnalysis); | 92 failure.addFailureAnalysis(failureAnalysis); |
112 this._testFailures.update(key, failure); | 93 this._testFailures.update(key, failure); |
113 return failure; | 94 return failure; |
114 }, | 95 }, |
115 purge: function() { | 96 purge: function() { |
116 this._testFailures.purge(function(failure) { | 97 this._testFailures.purge(function(failure) { |
117 failure.dismiss(); | 98 failure.dismiss(); |
118 }); | 99 }); |
119 this._testFailures.forEach(function(failure) { | 100 this._testFailures.forEach(function(failure) { |
(...skipping 13 matching lines...) Expand all Loading... |
133 return testNameList.indexOf(key) != -1; | 114 return testNameList.indexOf(key) != -1; |
134 }); | 115 }); |
135 | 116 |
136 var controller = new controllers.ResultsDetails(resultsView, failuresByT
est); | 117 var controller = new controllers.ResultsDetails(resultsView, failuresByT
est); |
137 this._delegate.showResults(resultsView); | 118 this._delegate.showResults(resultsView); |
138 }, | 119 }, |
139 _toFailureInfoList: function(failures) | 120 _toFailureInfoList: function(failures) |
140 { | 121 { |
141 return base.flattenArray(failures.testNameList().map(model.unexpectedFai
lureInfoForTestName)); | 122 return base.flattenArray(failures.testNameList().map(model.unexpectedFai
lureInfoForTestName)); |
142 }, | 123 }, |
143 onUpdateExpectations: function(failures) | |
144 { | |
145 updateExpectationsWithStatusUpdates(this._toFailureInfoList(failures)); | |
146 } | |
147 }); | 124 }); |
148 | 125 |
149 controllers.UnexpectedFailures = base.extends(FailureStreamController, { | 126 controllers.UnexpectedFailures = base.extends(FailureStreamController, { |
150 _resultsFilter: results.unexpectedFailuresByTest, | 127 _resultsFilter: results.unexpectedFailuresByTest, |
151 | 128 |
152 _impliedFirstFailingRevision: function(failureAnalysis) | 129 _impliedFirstFailingRevision: function(failureAnalysis) |
153 { | 130 { |
154 return failureAnalysis.newestPassingRevision + 1; | 131 return failureAnalysis.newestPassingRevision + 1; |
155 }, | 132 }, |
156 _keyFor: function(failureAnalysis) | 133 _keyFor: function(failureAnalysis) |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 this._notification = new ui.notifications.BuildersFailing(this._mess
age); | 181 this._notification = new ui.notifications.BuildersFailing(this._mess
age); |
205 this._view.add(this._notification); | 182 this._view.add(this._notification); |
206 } | 183 } |
207 // FIXME: We should provide regression ranges for the failing builders. | 184 // FIXME: We should provide regression ranges for the failing builders. |
208 // This doesn't seem to happen often enough to worry too much about that
, however. | 185 // This doesn't seem to happen often enough to worry too much about that
, however. |
209 this._notification.setFailingBuilders(failuresList); | 186 this._notification.setFailingBuilders(failuresList); |
210 } | 187 } |
211 }); | 188 }); |
212 | 189 |
213 })(); | 190 })(); |
OLD | NEW |