2 * Copyright (C) 2011 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
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.
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.
29 var g_revisionHint = null;
31 var g_updateTimerId = 0;
32 var g_buildersFailing = null;
34 var g_unexpectedFailuresController = null;
35 var g_failuresController = null;
37 var g_nonLayoutTestFailureBuilders = null;
39 function updatePartyTime()
41 if (!g_unexpectedFailuresController.length() && !g_nonLayoutTestFailureBuilders.hasFailures())
42 $('#onebar').addClass('partytime');
44 $('#onebar').removeClass('partytime');
47 function updateTreeStatus()
49 var oldTreeStatus = document.querySelector('.treestatus');
50 oldTreeStatus.remove();
52 var newTreeStatus = new ui.TreeStatus();
53 document.querySelector('.topbar').appendChild(newTreeStatus);
59 g_revisionHint.dismiss();
61 var gtestIframe = document.querySelector('#chromium-gtests iframe');
63 gtestIframe.src = gtestIframe.src;
65 // FIXME: This should be a button with a progress element.
66 var numberOfTestsAnalyzed = 0;
67 var updating = new ui.notifications.Info('Loading commit data ...');
71 builders.buildersFailingNonLayoutTests(function(failuresList) {
72 g_nonLayoutTestFailureBuilders.update(failuresList);
76 base.callInParallel([model.updateRecentCommits, model.updateResultsByBuilder], function() {
77 if (g_failuresController)
78 g_failuresController.update();
80 updating.update('Analyzing test failures ...');
82 model.analyzeUnexpectedFailures(function(failureAnalysis) {
83 updating.update('Analyzing test failures ... ' + ++numberOfTestsAnalyzed + ' tests analyzed.');
84 g_unexpectedFailuresController.update(failureAnalysis);
87 g_unexpectedFailuresController.purge();
89 Object.keys(config.currentBuilders()).forEach(function(builderName) {
90 if (!model.state.resultsByBuilder[builderName])
91 g_info.add(new ui.notifications.Info('Could not find test results for ' + builderName + ' in the last ' + config.kBuildNumberLimit + ' runs.'));
96 g_revisionHint = new ui.notifications.Info('');
97 g_revisionHint.updateWithNode(new ui.revisionDetails());
98 g_info.add(g_revisionHint);
103 $(document).ready(function() {
104 g_updateTimerId = window.setInterval(update, config.kUpdateFrequency);
106 window.setInterval(updateTreeStatus, config.kTreeStatusUpdateFrequency);
108 pixelzoomer.installEventListeners();
110 onebar = new ui.onebar();
113 // FIXME: This doesn't belong here.
114 var onebarController = {
115 showResults: function(resultsView)
117 var resultsContainer = onebar.results();
118 $(resultsContainer).empty().append(resultsView);
119 onebar.select('results');
123 var unexpectedFailuresView = new ui.notifications.Stream();
124 g_unexpectedFailuresController = new controllers.UnexpectedFailures(model.state, unexpectedFailuresView, onebarController);
126 g_info = new ui.notifications.Stream();
127 g_nonLayoutTestFailureBuilders = new controllers.FailingBuilders(g_info);
129 var unexpected = onebar.unexpected();
130 var topBar = document.createElement('div');
131 topBar.className = 'topbar';
132 unexpected.appendChild(topBar);
134 // FIXME: This should be an Action object.
135 var updateButton = document.body.insertBefore(document.createElement('button'), document.body.firstChild);
136 updateButton.addEventListener("click", update);
137 updateButton.textContent = 'update';
138 topBar.appendChild(updateButton);
140 var treeStatus = new ui.TreeStatus();
141 topBar.appendChild(treeStatus);
143 unexpected.appendChild(g_info);
144 unexpected.appendChild(unexpectedFailuresView);
146 var expected = onebar.expected();
148 var failuresView = new ui.failures.List();
149 g_failuresController = new controllers.ExpectedFailures(model.state, failuresView, onebarController);
150 expected.appendChild(failuresView);