| 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 function minutesAgo(minutes) | |
| 29 { | |
| 30 var time = new Date(); | |
| 31 time.setMinutes(time.getMinutes() - minutes); | |
| 32 return time; | |
| 33 } | |
| 34 | |
| 35 function Cycler(items, repeat) | |
| 36 { | |
| 37 this._index = 0; | |
| 38 this._repeat = repeat || 1; | |
| 39 this._repeated = 0; | |
| 40 this._items = items; | |
| 41 } | |
| 42 | |
| 43 Cycler.prototype = { | |
| 44 _updateRepeat: function() | |
| 45 { | |
| 46 if (++this._repeated >= this._repeat) { | |
| 47 this._repeated = this._repeat; | |
| 48 return false; | |
| 49 } | |
| 50 return true; | |
| 51 }, | |
| 52 _updateIndex: function() | |
| 53 { | |
| 54 if (this._updateRepeat()) | |
| 55 return; | |
| 56 if (++this._index >= this._items.length) | |
| 57 this._index = 0; | |
| 58 }, | |
| 59 cycle: function() | |
| 60 { | |
| 61 var result = this._items[this._index]; | |
| 62 this._updateIndex(); | |
| 63 return result; | |
| 64 } | |
| 65 } | |
| 66 | |
| 67 var people = new Cycler([ | |
| 68 'Eustace Bagge', | |
| 69 'Dick Dastardly', | |
| 70 'Major Glory', | |
| 71 'Barney Rubble', | |
| 72 'Bunny Bravo', | |
| 73 'Race Bannon', | |
| 74 ]); | |
| 75 | |
| 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 .
.. ' | |
| 84 ]); | |
| 85 | |
| 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' | |
| 97 ]); | |
| 98 | |
| 99 var builders = new Cycler(Object.keys(config.currentBuilders()), 3); | |
| 100 | |
| 101 var expectations = new Cycler([ | |
| 102 'TEXT', | |
| 103 'IMAGE+TEXT', | |
| 104 'TIMEOUT', | |
| 105 'CRASH' | |
| 106 ], 4); | |
| 107 | |
| 108 function createResultNodesByBuilder(builderFailureCount) | |
| 109 { | |
| 110 var result = {}; | |
| 111 for(var i = 0; i < builderFailureCount; ++i) | |
| 112 result[builders.cycle()] = { actual: expectations.cycle() }; | |
| 113 return result; | |
| 114 } | |
| 115 | |
| 116 var currentRevision = 66666; | |
| 117 var currentMinutesAgo = 0; | |
| 118 | |
| 119 function createFailingTestsSummary(commitDataCount, failureAnalysisCount, builde
rFailureCount) | |
| 120 { | |
| 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() | |
| 129 }); | |
| 130 for (var i = 0; i < failureAnalysisCount; ++i) | |
| 131 failingTestsSummary.addFailureAnalysis({ | |
| 132 testName: testNames.cycle(), | |
| 133 resultNodesByBuilder: createResultNodesByBuilder(builderFailureCount
) | |
| 134 }); | |
| 135 return failingTestsSummary; | |
| 136 } | |
| 137 | |
| 138 function createBuildersFailing(failingBuilderCount) | |
| 139 { | |
| 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 | |
| 146 } | |
| 147 | |
| 148 $(document).ready(function() { | |
| 149 | |
| 150 var actions = new ui.notifications.Stream(); | |
| 151 document.body.insertBefore(actions, document.body.firstChild); | |
| 152 | |
| 153 // FIXME: This should be an Action object. | |
| 154 var button = document.body.insertBefore(document.createElement('button'), do
cument.body.firstChild); | |
| 155 button.textContent = 'update'; | |
| 156 | |
| 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)); | |
| 162 }); | |
| 163 | |
| 164 })(); | |
| OLD | NEW |