| 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 module("ui"); | |
| 29 | |
| 30 var kExampleResultsByTest = { | |
| 31 "scrollbars/custom-scrollbar-with-incomplete-style.html": { | |
| 32 "Mock Builder": { | |
| 33 "expected": "IMAGE", | |
| 34 "actual": "CRASH" | |
| 35 }, | |
| 36 "Mock Linux": { | |
| 37 "expected": "TEXT", | |
| 38 "actual": "CRASH" | |
| 39 } | |
| 40 }, | |
| 41 "userscripts/another-test.html": { | |
| 42 "Mock Builder": { | |
| 43 "expected": "PASS", | |
| 44 "actual": "TEXT" | |
| 45 } | |
| 46 } | |
| 47 } | |
| 48 | |
| 49 test("ui.onebar", 2, function() { | |
| 50 if (window.location.hash) { | |
| 51 window.location.hash = ''; | |
| 52 } | |
| 53 | |
| 54 onebar = new ui.onebar(); | |
| 55 onebar.attach(); | |
| 56 equal(onebar.innerHTML, | |
| 57 '<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-hea
der ui-corner-all">' + | |
| 58 '<li class="ui-state-default ui-corner-top ui-tabs-selected ui-state
-active"><a href="#unexpected">Unexpected Failures</a></li>' + | |
| 59 '<li class="ui-state-default ui-corner-top ui-state-disabled"><a hre
f="#results">Results</a></li>' + | |
| 60 '</ul>' + | |
| 61 '<div id="link-handling"><input type="checkbox" id="new-window-for-links
"><label for="new-window-for-links">Open links in new window</label></div>' + | |
| 62 '<div id="unexpected" class="ui-tabs-panel ui-widget-content ui-corner-b
ottom"></div>' + | |
| 63 '<div id="results" class="ui-tabs-panel ui-widget-content ui-corner-bott
om ui-tabs-hide"></div>'); | |
| 64 | |
| 65 onebar.select('unexpected'); | |
| 66 equal(window.location.hash, '#unexpected'); | |
| 67 | |
| 68 onebar.remove(); | |
| 69 }); | |
| 70 | |
| 71 // FIXME: These three results.* tests should be moved ot ui/results_unittests.js
. | |
| 72 test("results.ResultsGrid", 8, function() { | |
| 73 var grid = new ui.results.ResultsGrid() | |
| 74 grid.addResults([ | |
| 75 'http://example.com/foo-bar-diff.txt', | |
| 76 'http://example.com/foo-bar-expected.png', | |
| 77 'http://example.com/foo-bar-actual.png', | |
| 78 'http://example.com/foo-bar-diff.png', | |
| 79 ]); | |
| 80 | |
| 81 var comparisons = grid.querySelectorAll("ct-results-comparison"); | |
| 82 | |
| 83 equal(comparisons[0].type, "text"); | |
| 84 equal(comparisons[0].actualUrl, ""); | |
| 85 equal(comparisons[0].expectedUrl, ""); | |
| 86 equal(comparisons[0].diffUrl, "http://example.com/foo-bar-diff.txt"); | |
| 87 | |
| 88 equal(comparisons[1].type, "image"); | |
| 89 equal(comparisons[1].actualUrl, "http://example.com/foo-bar-actual.png"); | |
| 90 equal(comparisons[1].expectedUrl, "http://example.com/foo-bar-expected.png")
; | |
| 91 equal(comparisons[1].diffUrl, "http://example.com/foo-bar-diff.png"); | |
| 92 }); | |
| 93 | |
| 94 test("results.ResultsGrid (crashlog)", 1, function() { | |
| 95 var grid = new ui.results.ResultsGrid() | |
| 96 grid.addResults(['http://example.com/layout-test-results/foo-bar-crash-log.t
xt']); | |
| 97 equal(grid.innerHTML, '<ct-test-output></ct-test-output>'); | |
| 98 }); | |
| 99 | |
| 100 test("results.ResultsGrid (empty)", 1, function() { | |
| 101 var grid = new ui.results.ResultsGrid() | |
| 102 grid.addResults([]); | |
| 103 equal(grid.innerHTML, 'No results to display.'); | |
| 104 }); | |
| 105 | |
| 106 var openTreeJson = { | |
| 107 "username": "erg@chromium.org", | |
| 108 "date": "2013-10-14 20:22:00.887390", | |
| 109 "message": "Tree is open", | |
| 110 "can_commit_freely": true, | |
| 111 "general_state": "open" | |
| 112 }; | |
| 113 | |
| 114 asyncTest("TreeStatus", 2, function() { | |
| 115 var simulator = new NetworkSimulator(); | |
| 116 | |
| 117 simulator.json = function(url) | |
| 118 { | |
| 119 return Promise.resolve(openTreeJson); | |
| 120 }; | |
| 121 | |
| 122 var treestatus; | |
| 123 simulator.runTest(function() { | |
| 124 treeStatus = new ui.TreeStatus(); | |
| 125 }).then(function() { | |
| 126 equal(treeStatus.innerHTML, '<div> blink status: <span>OPEN</span></div>
<div> chromium status: <span>OPEN</span></div>'); | |
| 127 start(); | |
| 128 }); | |
| 129 }); | |
| 130 | |
| 131 function generateRoll(fromRevision, toRevision) | |
| 132 { | |
| 133 return { | |
| 134 "results": [ | |
| 135 {"messages":[], "base_url":"svn://svn.chromium.org/chrome/trunk/src"
, "subject":"Blink roll " + fromRevision + ":" + toRevision, "closed":false, "is
sue":1000} | |
| 136 ] | |
| 137 }; | |
| 138 } | |
| 139 | |
| 140 asyncTest("RevisionDetailsSmallRoll", 2, function() { | |
| 141 var rollFromRevision = 540; | |
| 142 var rollToRevision = 550; | |
| 143 var simulator = new NetworkSimulator(); | |
| 144 simulator.json = function(url) | |
| 145 { | |
| 146 return Promise.resolve(generateRoll(rollFromRevision, rollToRevision)); | |
| 147 } | |
| 148 | |
| 149 simulator.get = function (url) | |
| 150 { | |
| 151 return Promise.resolve(rollFromRevision); | |
| 152 } | |
| 153 | |
| 154 model.state.resultsByBuilder = { | |
| 155 "Linux": { | |
| 156 "blink_revision": "554", | |
| 157 } | |
| 158 }; | |
| 159 model.state.recentCommits = [ | |
| 160 { | |
| 161 "revision": "555", | |
| 162 }]; | |
| 163 | |
| 164 var revisionDetails; | |
| 165 simulator.runTest(function() { | |
| 166 revisionDetails = ui.revisionDetails(); | |
| 167 }).then(function() { | |
| 168 equal(revisionDetails.innerHTML, | |
| 169 'Latest revision processed by every bot: ' + | |
| 170 '<details>' + | |
| 171 '<summary>' + | |
| 172 '<a href="http://src.chromium.org/viewvc/blink?view=rev&
amp;revision=554">554' + | |
| 173 '<span id="revisionPopUp">' + | |
| 174 '<table>' + | |
| 175 '<tr>' + | |
| 176 '<td><a href="http://build.chromium.org/
p/chromium.webkit/waterfall?builder=Linux">Linux</a></td>' + | |
| 177 '<td>554</td>' + | |
| 178 '</tr>' + | |
| 179 '</table>' + | |
| 180 '</span>' + | |
| 181 '</a>' + | |
| 182 '</summary>' + | |
| 183 '<table>' + | |
| 184 '<tr>' + | |
| 185 '<td><a href="http://build.chromium.org/p/chromium.w
ebkit/waterfall?builder=Linux">Linux</a></td>' + | |
| 186 '<td>554</td>' + | |
| 187 '</tr>' + | |
| 188 '</table>' + | |
| 189 '</details>' + | |
| 190 ', trunk is at <a href="http://src.chromium.org/viewvc/blink?vie
w=rev&revision=555">555</a>'); | |
| 191 start(); | |
| 192 }); | |
| 193 }); | |
| 194 | |
| 195 asyncTest("RevisionDetailsMediumRoll", 2, function() { | |
| 196 var rollFromRevision = 500; | |
| 197 var rollToRevision = 550; | |
| 198 var simulator = new NetworkSimulator(); | |
| 199 simulator.json = function(url) | |
| 200 { | |
| 201 return Promise.resolve(generateRoll(rollFromRevision, rollToRevision)); | |
| 202 } | |
| 203 | |
| 204 simulator.get = function (url) | |
| 205 { | |
| 206 return Promise.resolve(rollFromRevision); | |
| 207 } | |
| 208 | |
| 209 model.state.resultsByBuilder = { | |
| 210 "Linux": { | |
| 211 "blink_revision": "554", | |
| 212 } | |
| 213 }; | |
| 214 model.state.recentCommits = [ | |
| 215 { | |
| 216 "revision": "555", | |
| 217 }]; | |
| 218 | |
| 219 var revisionDetails; | |
| 220 simulator.runTest(function() { | |
| 221 revisionDetails = ui.revisionDetails(); | |
| 222 }).then(function() { | |
| 223 equal(revisionDetails.innerHTML, | |
| 224 'Latest revision processed by every bot: ' + | |
| 225 '<details>' + | |
| 226 '<summary>' + | |
| 227 '<a href="http://src.chromium.org/viewvc/blink?view=rev&
amp;revision=554">554' + | |
| 228 '<span id="revisionPopUp">' + | |
| 229 '<table>' + | |
| 230 '<tr>' + | |
| 231 '<td><a href="http://build.chromium.org/
p/chromium.webkit/waterfall?builder=Linux">Linux</a></td>' + | |
| 232 '<td>554</td>' + | |
| 233 '</tr>' + | |
| 234 '</table>' + | |
| 235 '</span>' + | |
| 236 '</a>' + | |
| 237 '</summary>' + | |
| 238 '<table>' + | |
| 239 '<tr>' + | |
| 240 '<td><a href="http://build.chromium.org/p/chromium.w
ebkit/waterfall?builder=Linux">Linux</a></td>' + | |
| 241 '<td>554</td>' + | |
| 242 '</tr>' + | |
| 243 '</table>' + | |
| 244 '</details>' + | |
| 245 ', trunk is at <a href="http://src.chromium.org/viewvc/blink?vie
w=rev&revision=555">555</a>'); | |
| 246 start(); | |
| 247 }); | |
| 248 }); | |
| 249 | |
| 250 asyncTest("RevisionDetailsBigRoll", 2, function() { | |
| 251 var rollFromRevision = 440; | |
| 252 var rollToRevision = 550; | |
| 253 var simulator = new NetworkSimulator(); | |
| 254 simulator.json = function(url) | |
| 255 { | |
| 256 return Promise.resolve(generateRoll(rollFromRevision, rollToRevision)); | |
| 257 } | |
| 258 | |
| 259 simulator.get = function (url) | |
| 260 { | |
| 261 return Promise.resolve(rollFromRevision); | |
| 262 } | |
| 263 | |
| 264 model.state.resultsByBuilder = { | |
| 265 "Linux": { | |
| 266 "blink_revision": "554", | |
| 267 } | |
| 268 }; | |
| 269 model.state.recentCommits = [ | |
| 270 { | |
| 271 "revision": "555", | |
| 272 }]; | |
| 273 | |
| 274 var revisionDetails; | |
| 275 simulator.runTest(function() { | |
| 276 revisionDetails = ui.revisionDetails(); | |
| 277 }).then(function() { | |
| 278 equal(revisionDetails.innerHTML, | |
| 279 'Latest revision processed by every bot: ' + | |
| 280 '<details>' + | |
| 281 '<summary>' + | |
| 282 '<a href="http://src.chromium.org/viewvc/blink?view=rev&
amp;revision=554">554' + | |
| 283 '<span id="revisionPopUp">' + | |
| 284 '<table>' + | |
| 285 '<tr>' + | |
| 286 '<td><a href="http://build.chromium.org/
p/chromium.webkit/waterfall?builder=Linux">Linux</a></td>' + | |
| 287 '<td>554</td>' + | |
| 288 '</tr>' + | |
| 289 '</table>' + | |
| 290 '</span>' + | |
| 291 '</a>' + | |
| 292 '</summary>' + | |
| 293 '<table>' + | |
| 294 '<tr>' + | |
| 295 '<td><a href="http://build.chromium.org/p/chromium.w
ebkit/waterfall?builder=Linux">Linux</a></td>' + | |
| 296 '<td>554</td>' + | |
| 297 '</tr>' + | |
| 298 '</table>' + | |
| 299 '</details>' + | |
| 300 ', trunk is at <a href="http://src.chromium.org/viewvc/blink?vie
w=rev&revision=555">555</a>'); | |
| 301 start(); | |
| 302 }); | |
| 303 }); | |
| 304 | |
| 305 })(); | |
| OLD | NEW |