OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | |
3 * | |
4 * Redistribution and use in source and binary forms, with or without | |
5 * modification, are permitted provided that the following conditions | |
6 * are met: | |
7 * 1. Redistributions of source code must retain the above copyright | |
8 * notice, this list of conditions and the following disclaimer. | |
9 * 2. Redistributions in binary form must reproduce the above copyright | |
10 * notice, this list of conditions and the following disclaimer in the | |
11 * documentation and/or other materials provided with the distribution. | |
12 * | |
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
23 * THE POSSIBILITY OF SUCH DAMAGE. | |
24 */ | |
25 | |
26 (function() { | |
27 | |
28 var g_info = null; | |
29 var g_revisionHint = null; | |
30 | |
31 var g_updateTimerId = 0; | |
32 var g_buildersFailing = null; | |
33 | |
34 var g_unexpectedFailuresController = null; | |
35 var g_failuresController = null; | |
36 | |
37 var g_nonLayoutTestFailureBuilders = null; | |
38 | |
39 function updatePartyTime() | |
40 { | |
41 if (!g_unexpectedFailuresController.length() && !g_nonLayoutTestFailureBuild
ers.hasFailures()) | |
42 $('#onebar').addClass('partytime'); | |
43 else | |
44 $('#onebar').removeClass('partytime'); | |
45 } | |
46 | |
47 function update() | |
48 { | |
49 if (g_revisionHint) | |
50 g_revisionHint.dismiss(); | |
51 | |
52 var gtestIframe = document.querySelector('#chromium-gtests iframe'); | |
53 if (gtestIframe) | |
54 gtestIframe.src = gtestIframe.src; | |
55 | |
56 // FIXME: This should be a button with a progress element. | |
57 var numberOfTestsAnalyzed = 0; | |
58 var updating = new ui.notifications.Info('Loading commit data ...'); | |
59 | |
60 g_info.add(updating); | |
61 | |
62 builders.buildersFailingNonLayoutTests(function(failuresList) { | |
63 g_nonLayoutTestFailureBuilders.update(failuresList); | |
64 updatePartyTime(); | |
65 }); | |
66 | |
67 base.callInParallel([model.updateRecentCommits, model.updateResultsByBuilder
], function() { | |
68 if (g_failuresController) | |
69 g_failuresController.update(); | |
70 | |
71 updating.update('Analyzing test failures ...'); | |
72 | |
73 model.analyzeUnexpectedFailures(function(failureAnalysis) { | |
74 updating.update('Analyzing test failures ... ' + ++numberOfTestsAnal
yzed + ' tests analyzed.'); | |
75 g_unexpectedFailuresController.update(failureAnalysis); | |
76 }, function() { | |
77 updatePartyTime(); | |
78 g_unexpectedFailuresController.purge(); | |
79 | |
80 Object.keys(config.currentBuilders()).forEach(function(builderName)
{ | |
81 if (!model.state.resultsByBuilder[builderName]) | |
82 g_info.add(new ui.notifications.Info('Could not find test re
sults for ' + builderName + ' in the last ' + config.kBuildNumberLimit + ' runs.
')); | |
83 }); | |
84 | |
85 updating.dismiss(); | |
86 | |
87 g_revisionHint = new ui.notifications.Info(''); | |
88 | |
89 var latestRevisionSpan = document.createElement('span'); | |
90 latestRevisionSpan.appendChild(document.createTextNode('Latest revis
ion processed by every bot: ')); | |
91 | |
92 var latestRevision = model.latestRevisionWithNoBuildersInFlight(); | |
93 latestRevisionSpan.appendChild(base.createLinkNode(trac.changesetURL
(latestRevision), latestRevision)); | |
94 | |
95 var totRevision = model.latestRevision(); | |
96 latestRevisionSpan.appendChild(document.createTextNode(' (trunk is a
t ')); | |
97 latestRevisionSpan.appendChild(base.createLinkNode(trac.changesetURL
(totRevision), totRevision)); | |
98 latestRevisionSpan.appendChild(document.createTextNode(')')); | |
99 | |
100 g_revisionHint.updateWithNode(latestRevisionSpan); | |
101 | |
102 g_info.add(g_revisionHint); | |
103 }); | |
104 }); | |
105 } | |
106 | |
107 $(document).ready(function() { | |
108 g_updateTimerId = window.setInterval(update, config.kUpdateFrequency); | |
109 | |
110 pixelzoomer.installEventListeners(); | |
111 | |
112 onebar = new ui.onebar(); | |
113 onebar.attach(); | |
114 | |
115 // FIXME: This doesn't belong here. | |
116 var onebarController = { | |
117 showResults: function(resultsView) | |
118 { | |
119 var resultsContainer = onebar.results(); | |
120 $(resultsContainer).empty().append(resultsView); | |
121 onebar.select('results'); | |
122 } | |
123 }; | |
124 | |
125 var unexpectedFailuresView = new ui.notifications.Stream(); | |
126 g_unexpectedFailuresController = new controllers.UnexpectedFailures(model.st
ate, unexpectedFailuresView, onebarController); | |
127 | |
128 g_info = new ui.notifications.Stream(); | |
129 g_nonLayoutTestFailureBuilders = new controllers.FailingBuilders(g_info, 'No
n-layout test failures'); | |
130 | |
131 // FIXME: This should be an Action object. | |
132 var updateButton = document.body.insertBefore(document.createElement('button
'), document.body.firstChild); | |
133 updateButton.addEventListener("click", update); | |
134 updateButton.textContent = 'update'; | |
135 | |
136 var unexpected = onebar.unexpected(); | |
137 unexpected.appendChild(updateButton); | |
138 unexpected.appendChild(g_info); | |
139 unexpected.appendChild(unexpectedFailuresView); | |
140 | |
141 var expected = onebar.expected(); | |
142 if (expected) { | |
143 var failuresView = new ui.failures.List(); | |
144 g_failuresController = new controllers.ExpectedFailures(model.state, fai
luresView, onebarController); | |
145 expected.appendChild(failuresView); | |
146 } | |
147 | |
148 onebar.perf().appendChild(new ui.perf.View()); | |
149 | |
150 update(); | |
151 }); | |
152 | |
153 })(); | |
OLD | NEW |