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.
28 function minutesAgo(minutes)
30 var time = new Date();
31 time.setMinutes(time.getMinutes() - minutes);
35 function Cycler(items, repeat)
38 this._repeat = repeat || 1;
44 _updateRepeat: function()
46 if (++this._repeated >= this._repeat) {
47 this._repeated = this._repeat;
52 _updateIndex: function()
54 if (this._updateRepeat())
56 if (++this._index >= this._items.length)
61 var result = this._items[this._index];
67 var people = new Cycler([
76 var bugTitles = new Cycler([
77 'Unreviewed. Chromium rebaselines for r93794. * ...',
78 'Fix build when GCC 4.2 is not installed. * ... ',
79 '[Qt] Unreviewed gardening. * platform/qt/Skipped: Skip new tests until ...',
80 'garden-o-matic needs a way to report where and how tests are failing in ... ',
81 'REGRESSION(r90971): Fix an assertion failure with textarea placeholder. ...',
82 'Incorrect layout of :before and :after content, with display table, ...',
83 ' JSHTMLImageElement (and associated Node) is abandoned when image load is ... '
86 var testNames = new Cycler([
87 'fast/ruby/text-emphasis.html',
88 'plugins/destroy-during-npp-new.html',
89 'tables/mozilla/bugs/bug60749.html',
90 'tables/mozilla/bugs/bug51727.html',
91 'tables/mozilla/bugs/bug33855.html',
92 'tables/mozilla/bugs/bug52506.htm',
93 'tables/mozilla/bugs/bug18359.html',
94 'tables/mozilla/bugs/bug46368-1.html',
95 'tables/mozilla/bugs/bug46368-2.html',
96 'tables/mozilla/bugs/bug52505.html'
99 var builders = new Cycler(Object.keys(config.builders), 3);
101 var expectations = new Cycler([
108 function createResultNodesByBuilder(builderFailureCount)
111 for(var i = 0; i < builderFailureCount; ++i)
112 result[builders.cycle()] = { actual: expectations.cycle() };
116 var currentRevision = 66666;
117 var currentMinutesAgo = 0;
119 function createFailingTestsSummary(commitDataCount, failureAnalysisCount, builderFailureCount)
121 var failingTestsSummary = new ui.notifications.FailingTestsSummary();
122 for (var i = 0; i < commitDataCount; ++i)
123 failingTestsSummary.addCommitData({
124 time: minutesAgo(currentMinutesAgo++),
125 revision: currentRevision++,
126 summary: bugTitles.cycle(),
127 author: people.cycle(),
128 reviewer: people.cycle()
130 for (var i = 0; i < failureAnalysisCount; ++i)
131 failingTestsSummary.addFailureAnalysis({
132 testName: testNames.cycle(),
133 resultNodesByBuilder: createResultNodesByBuilder(builderFailureCount)
135 return failingTestsSummary;
138 function createBuildersFailing(failingBuilderCount)
140 var buildersFailing = new ui.notifications.BuildersFailing();
141 builderNameList = [];
142 for (var i = 0; i < failingBuilderCount; ++i)
143 builderNameList.push(builders.cycle());
144 buildersFailing.setFailingBuilders(builderNameList);
145 return buildersFailing
148 $(document).ready(function() {
150 var actions = new ui.notifications.Stream();
151 document.body.insertBefore(actions, document.body.firstChild);
153 // FIXME: This should be an Action object.
154 var button = document.body.insertBefore(document.createElement('button'), document.body.firstChild);
155 button.textContent = 'update';
157 actions.add(createFailingTestsSummary(3, 4, 1));
158 actions.add(createFailingTestsSummary(3, 1, 3));
159 actions.add(createFailingTestsSummary(1, 20, 1));
160 actions.add(createBuildersFailing(1));
161 actions.add(createBuildersFailing(8));