diff options
author | Ben Murdoch <benm@google.com> | 2011-05-05 14:36:32 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-05-10 15:38:30 +0100 |
commit | f05b935882198ccf7d81675736e3aeb089c5113a (patch) | |
tree | 4ea0ca838d9ef1b15cf17ddb3928efb427c7e5a1 /WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver | |
parent | 60fbdcc62bced8db2cb1fd233cc4d1e4ea17db1b (diff) | |
download | external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.zip external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.tar.gz external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.tar.bz2 |
Merge WebKit at r74534: Initial merge by git.
Change-Id: I6ccd1154fa1b19c2ec2a66878eb675738735f1eb
Diffstat (limited to 'WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver')
6 files changed, 0 insertions, 1366 deletions
diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/index.html b/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/index.html deleted file mode 100644 index 5b58301..0000000 --- a/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/index.html +++ /dev/null @@ -1,180 +0,0 @@ -<!DOCTYPE html> -<!-- - Copyright (c) 2010 Google Inc. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - * Neither the name of Google Inc. nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---> -<html> -<head> - <title>Layout Test Rebaseline Server</title> - <link rel="stylesheet" href="/main.css" type="text/css"> - <script src="/util.js"></script> - <script src="/loupe.js"></script> - <script src="/main.js"></script> - <script src="/queue.js"></script> -</head> -<body class="loading"> - -<pre id="log" style="display: none"></pre> -<div id="queue" style="display: none"> - Queue: - <select id="queue-select" size="10"></select> - <button id="remove-queue-selection">Remove selection</button> - <button id="rebaseline-queue">Rebaseline queue</button> -</div> - -<div id="header"> - <div id="controls"> - <!-- Add a dummy <select> node so that this lines up with the text on the left --> - <select style="visibility: hidden"></select> - <span id="toggle-log" class="link">Log</span> - <span class="divider">|</span> - <a href="/quitquitquit">Exit</a> - </div> - - <span id="selectors"> - <label> - Failure type: - <select id="failure-type-selector"></select> - </label> - - <label> - Directory: - <select id="directory-selector"></select> - </label> - - <label> - Test: - <select id="test-selector"></select> - </label> - </span> - - <a id="test-link" target="_blank">View test</a> - - <span id="nav-buttons"> - <button id="previous-test">«</button> - <span id="test-index"></span> of <span id="test-count"></span> - <button id="next-test">»</button> - </span> -</div> - -<table id="test-output"> - <thead id="labels"> - <tr> - <th>Expected</th> - <th>Actual</th> - <th>Diff</th> - </tr> - </thead> - <tbody id="image-outputs" style="display: none"> - <tr> - <td colspan="3"><h2>Image</h2></td> - </tr> - <tr> - <td><img id="expected-image"></td> - <td><img id="actual-image"></td> - <td> - <canvas id="diff-canvas" width="800" height="600"></canvas> - <div id="diff-checksum" style="display: none"> - <h3>Checksum mismatch</h3> - Expected: <span id="expected-checksum"></span><br> - Actual: <span id="actual-checksum"></span> - </div> - </td> - </tr> - </tbody> - <tbody id="text-outputs" style="display: none"> - <tr> - <td colspan="3"><h2>Text</h2></td> - </tr> - <tr> - <td><pre id="expected-text"></pre></td> - <td><pre id="actual-text"></pre></td> - <td><pre id="diff-text"><pre></td> - </tr> - </tbody> -</table> - -<div id="footer"> - <label>State: <span id="state"></span></label> - <label>Existing baselines: <span id="current-baselines"></span></label> - <label> - Baseline target: - <select id="baseline-target"></select> - </label> - <label> - Move current baselines to: - <select id="baseline-move-to"> - <option value="none">Nowhere (replace)</option> - </select> - </label> - - <!-- Add a dummy <button> node so that this lines up with the text on the right --> - <button style="visibility: hidden; padding-left: 0; padding-right: 0;"></button> - - <div id="action-buttons"> - <span id="toggle-queue" class="link">Queue</span> - <button id="add-to-rebaseline-queue">Add to rebaseline queue</button> - </div> -</div> - -<table id="loupe" style="display: none"> - <tr> - <td colspan="3" id="loupe-info"> - <span id="loupe-close" class="link">Close</span> - <label>Coordinate: <span id="loupe-coordinate"></span></label> - </td> - </tr> - <tr> - <td> - <div class="loupe-container"> - <canvas id="expected-loupe" width="210" height="210"></canvas> - <div class="center-highlight"></div> - </div> - </td> - <td> - <div class="loupe-container"> - <canvas id="actual-loupe" width="210" height="210"></canvas> - <div class="center-highlight"></div> - </div> - </td> - <td> - <div class="loupe-container"> - <canvas id="diff-loupe" width="210" height="210"></canvas> - <div class="center-highlight"></div> - </div> - </td> - </tr> - <tr id="loupe-colors"> - <td><label>Exp. color: <span id="expected-loupe-color"></span></label></td> - <td><label>Actual color: <span id="actual-loupe-color"></span></label></td> - <td><label>Diff color: <span id="diff-loupe-color"></span></label></td> - </tr> -</table> - -</body> -</html> diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/loupe.js b/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/loupe.js deleted file mode 100644 index 41f977a..0000000 --- a/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/loupe.js +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -var LOUPE_MAGNIFICATION_FACTOR = 10; - -function Loupe() -{ - this._node = $('loupe'); - this._currentCornerX = -1; - this._currentCornerY = -1; - - var self = this; - - function handleOutputClick(event) { self._handleOutputClick(event); } - $('expected-image').addEventListener('click', handleOutputClick); - $('actual-image').addEventListener('click', handleOutputClick); - $('diff-canvas').addEventListener('click', handleOutputClick); - - function handleLoupeClick(event) { self._handleLoupeClick(event); } - $('expected-loupe').addEventListener('click', handleLoupeClick); - $('actual-loupe').addEventListener('click', handleLoupeClick); - $('diff-loupe').addEventListener('click', handleLoupeClick); - - function hide(event) { self.hide(); } - $('loupe-close').addEventListener('click', hide); -} - -Loupe.prototype._handleOutputClick = function(event) -{ - // The -1 compensates for the border around the image/canvas. - this._showFor(event.offsetX - 1, event.offsetY - 1); -}; - -Loupe.prototype._handleLoupeClick = function(event) -{ - var deltaX = Math.floor(event.offsetX/LOUPE_MAGNIFICATION_FACTOR); - var deltaY = Math.floor(event.offsetY/LOUPE_MAGNIFICATION_FACTOR); - - this._showFor( - this._currentCornerX + deltaX, this._currentCornerY + deltaY); -} - -Loupe.prototype.hide = function() -{ - this._node.style.display = 'none'; -}; - -Loupe.prototype._showFor = function(x, y) -{ - this._fillFromImage(x, y, 'expected', $('expected-image')); - this._fillFromImage(x, y, 'actual', $('actual-image')); - this._fillFromCanvas(x, y, 'diff', $('diff-canvas')); - - this._node.style.display = ''; -}; - -Loupe.prototype._fillFromImage = function(x, y, type, sourceImage) -{ - var tempCanvas = document.createElement('canvas'); - tempCanvas.width = sourceImage.width; - tempCanvas.height = sourceImage.height; - var tempContext = tempCanvas.getContext('2d'); - - tempContext.drawImage(sourceImage, 0, 0); - - this._fillFromCanvas(x, y, type, tempCanvas); -}; - -Loupe.prototype._fillFromCanvas = function(x, y, type, canvas) -{ - var context = canvas.getContext('2d'); - var sourceImageData = - context.getImageData(0, 0, canvas.width, canvas.height); - - var targetCanvas = $(type + '-loupe'); - var targetContext = targetCanvas.getContext('2d'); - targetContext.fillStyle = 'rgba(255, 255, 255, 1)'; - targetContext.fillRect(0, 0, targetCanvas.width, targetCanvas.height); - - var sourceXOffset = (targetCanvas.width/LOUPE_MAGNIFICATION_FACTOR - 1)/2; - var sourceYOffset = (targetCanvas.height/LOUPE_MAGNIFICATION_FACTOR - 1)/2; - - function readPixelComponent(x, y, component) { - var offset = (y * sourceImageData.width + x) * 4 + component; - return sourceImageData.data[offset]; - } - - for (var i = -sourceXOffset; i <= sourceXOffset; i++) { - for (var j = -sourceYOffset; j <= sourceYOffset; j++) { - var sourceX = x + i; - var sourceY = y + j; - - var sourceR = readPixelComponent(sourceX, sourceY, 0); - var sourceG = readPixelComponent(sourceX, sourceY, 1); - var sourceB = readPixelComponent(sourceX, sourceY, 2); - var sourceA = readPixelComponent(sourceX, sourceY, 3)/255; - sourceA = Math.round(sourceA * 10)/10; - - var targetX = (i + sourceXOffset) * LOUPE_MAGNIFICATION_FACTOR; - var targetY = (j + sourceYOffset) * LOUPE_MAGNIFICATION_FACTOR; - var colorString = - sourceR + ', ' + sourceG + ', ' + sourceB + ', ' + sourceA; - targetContext.fillStyle = 'rgba(' + colorString + ')'; - targetContext.fillRect( - targetX, targetY, - LOUPE_MAGNIFICATION_FACTOR, LOUPE_MAGNIFICATION_FACTOR); - - if (i == 0 && j == 0) { - $('loupe-coordinate').textContent = sourceX + ', ' + sourceY; - $(type + '-loupe-color').textContent = colorString; - } - } - } - - this._currentCornerX = x - sourceXOffset; - this._currentCornerY = y - sourceYOffset; -}; diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/main.css b/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/main.css deleted file mode 100644 index 62afda6..0000000 --- a/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/main.css +++ /dev/null @@ -1,292 +0,0 @@ -/* - * Copyright (c) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -body { - font-size: 12px; - font-family: Helvetica, Arial, sans-serif; - padding: 0; - margin: 0; -} - -.loading { - opacity: 0.5; -} - -div { - margin: 0; -} - -a, .link { - color: #aaf; - text-decoration: underline; - cursor: pointer; -} - -.link.selected { - color: #fff; - font-weight: bold; - text-decoration: none; -} - -#log, -#queue { - padding: .25em 0 0 .25em; - position: absolute; - right: 0; - height: 200px; - overflow: auto; - background: #fff; - -webkit-box-shadow: 1px 1px 5px rgba(0, 0, 0, .5); -} - -#log { - top: 2em; - width: 500px; -} - -#queue { - bottom: 3em; - width: 400px; -} - -#queue-select { - display: block; - width: 390px; -} - -#header, -#footer { - padding: .5em 1em; - background: #333; - color: #fff; - -webkit-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.5); -} - -#header { - margin-bottom: 1em; -} - -#header .divider, -#footer .divider { - opacity: .3; - padding: 0 .5em; -} - -#header label, -#footer label { - padding-right: 1em; - color: #ccc; -} - -#test-link { - margin-right: 1em; -} - -#header label span, -#footer label span { - color: #fff; - font-weight: bold; -} - -#nav-buttons { - white-space: nowrap; -} - -#nav-buttons button { - background: #fff; - border: 0; - border-radius: 10px; -} - -#nav-buttons button:active { - -webkit-box-shadow: 0 0 5px #33f inset; - background: #aaa; -} - -#nav-buttons button[disabled] { - opacity: .5; -} - -#controls { - float: right; -} - -#test-output { - border-spacing: 0; - border-collapse: collapse; - margin: 0 auto; - width: 100%; -} - -#test-output td, -#test-output th { - padding: 0; - vertical-align: top; -} - -#image-outputs img, -#image-outputs canvas, -#image-outputs #diff-checksum { - width: 800px; - height: 600px; - border: solid 1px #ddd; - -webkit-user-select: none; - -webkit-user-drag: none; -} - -#image-outputs img, -#image-outputs canvas { - cursor: crosshair; -} - -#image-outputs img.loading, -#image-outputs canvas.loading { - opacity: .5; -} - -#image-outputs #actual-image { - margin: 0 1em; -} - -#test-output #labels th { - text-align: center; - color: #666; -} - -#text-outputs pre { - height: 600px; - width: 800px; - overflow: auto; -} - -#test-output h2 { - border-bottom: solid 1px #ccc; - font-weight: bold; - margin: 0; - background: #eee; -} - -#footer { - position: absolute; - bottom: 0; - left: 0; - right: 0; - margin-top: 1em; -} - -#state.needs_rebaseline { - color: yellow; -} - -#state.rebaseline_failed { - color: red; -} - -#state.rebaseline_succeeded { - color: green; -} - -#state.in_queue { - color: gray; -} - -#action-buttons { - float: right; -} - -#action-buttons .link { - margin-right: 1em; -} - -#footer button { - padding: 1em; -} - -#loupe { - -webkit-box-shadow: 2px 2px 5px rgba(0, 0, 0, .5); - position: absolute; - width: 634px; - top: 50%; - left: 50%; - margin-left: -151px; - margin-top: -50px; - background: #fff; - border-spacing: 0; - border-collapse: collapse; -} - -#loupe td { - padding: 0; - border: solid 1px #ccc; -} - -#loupe label { - color: #999; - padding-right: 1em; -} - -#loupe span { - color: #000; - font-weight: bold; -} - -#loupe canvas { - cursor: crosshair; -} - -#loupe #loupe-close { - float: right; -} - -#loupe #loupe-info { - background: #eee; - padding: .3em .5em; -} - -#loupe #loupe-colors td { - text-align: center; -} - -#loupe .loupe-container { - position: relative; - width: 210px; - height: 210px; -} - -#loupe .center-highlight { - position: absolute; - width: 10px; - height: 10px; - top: 50%; - left: 50%; - margin-left: -5px; - margin-top: -5px; - outline: solid 1px #999; -} diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/main.js b/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/main.js deleted file mode 100644 index 25f9146..0000000 --- a/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/main.js +++ /dev/null @@ -1,498 +0,0 @@ -/* - * Copyright (c) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -var ALL_DIRECTORY_PATH = '[all]'; - -var STATE_NEEDS_REBASELINE = 'needs_rebaseline'; -var STATE_REBASELINE_FAILED = 'rebaseline_failed'; -var STATE_REBASELINE_SUCCEEDED = 'rebaseline_succeeded'; -var STATE_IN_QUEUE = 'in_queue'; -var STATE_TO_DISPLAY_STATE = {}; -STATE_TO_DISPLAY_STATE[STATE_NEEDS_REBASELINE] = 'Needs rebaseline'; -STATE_TO_DISPLAY_STATE[STATE_REBASELINE_FAILED] = 'Rebaseline failed'; -STATE_TO_DISPLAY_STATE[STATE_REBASELINE_SUCCEEDED] = 'Rebaseline succeeded'; -STATE_TO_DISPLAY_STATE[STATE_IN_QUEUE] = 'In queue'; - -var results; -var testsByFailureType = {}; -var testsByDirectory = {}; -var selectedTests = []; -var loupe; -var queue; - -function main() -{ - $('failure-type-selector').addEventListener('change', selectFailureType); - $('directory-selector').addEventListener('change', selectDirectory); - $('test-selector').addEventListener('change', selectTest); - $('next-test').addEventListener('click', nextTest); - $('previous-test').addEventListener('click', previousTest); - - $('toggle-log').addEventListener('click', function() { toggle('log'); }); - - loupe = new Loupe(); - queue = new RebaselineQueue(); - - document.addEventListener('keydown', function(event) { - if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) { - return; - } - - switch (event.keyIdentifier) { - case 'Left': - event.preventDefault(); - previousTest(); - break; - case 'Right': - event.preventDefault(); - nextTest(); - break; - case 'U+0051': // q - queue.addCurrentTest(); - break; - case 'U+0058': // x - queue.removeCurrentTest(); - break; - case 'U+0052': // r - queue.rebaseline(); - break; - } - }); - - loadText('/platforms.json', function(text) { - var platforms = JSON.parse(text); - platforms.platforms.forEach(function(platform) { - var platformOption = document.createElement('option'); - platformOption.value = platform; - platformOption.textContent = platform; - - var targetOption = platformOption.cloneNode(true); - targetOption.selected = platform == platforms.defaultPlatform; - $('baseline-target').appendChild(targetOption); - $('baseline-move-to').appendChild(platformOption.cloneNode(true)); - }); - }); - - loadText('/results.json', function(text) { - results = JSON.parse(text); - displayResults(); - }); -} - -/** - * Groups test results by failure type. - */ -function displayResults() -{ - var failureTypeSelector = $('failure-type-selector'); - var failureTypes = []; - - for (var testName in results.tests) { - var test = results.tests[testName]; - if (test.actual == 'PASS') { - continue; - } - var failureType = test.actual + ' (expected ' + test.expected + ')'; - if (!(failureType in testsByFailureType)) { - testsByFailureType[failureType] = []; - failureTypes.push(failureType); - } - testsByFailureType[failureType].push(testName); - } - - // Sort by number of failures - failureTypes.sort(function(a, b) { - return testsByFailureType[b].length - testsByFailureType[a].length; - }); - - for (var i = 0, failureType; failureType = failureTypes[i]; i++) { - var failureTypeOption = document.createElement('option'); - failureTypeOption.value = failureType; - failureTypeOption.textContent = failureType + ' - ' + testsByFailureType[failureType].length + ' tests'; - failureTypeSelector.appendChild(failureTypeOption); - } - - selectFailureType(); - - document.body.classList.remove('loading'); -} - -/** - * For a given failure type, gets all the tests and groups them by directory - * (populating the directory selector with them). - */ -function selectFailureType() -{ - var selectedFailureType = getSelectValue('failure-type-selector'); - var tests = testsByFailureType[selectedFailureType]; - - testsByDirectory = {} - var displayDirectoryNamesByDirectory = {}; - var directories = []; - - // Include a special option for all tests - testsByDirectory[ALL_DIRECTORY_PATH] = tests; - displayDirectoryNamesByDirectory[ALL_DIRECTORY_PATH] = 'all'; - directories.push(ALL_DIRECTORY_PATH); - - // Roll up tests by ancestor directories - tests.forEach(function(test) { - var pathPieces = test.split('/'); - var pathDirectories = pathPieces.slice(0, pathPieces.length -1); - var ancestorDirectory = ''; - - pathDirectories.forEach(function(pathDirectory, index) { - ancestorDirectory += pathDirectory + '/'; - if (!(ancestorDirectory in testsByDirectory)) { - testsByDirectory[ancestorDirectory] = []; - var displayDirectoryName = new Array(index * 6).join(' ') + pathDirectory; - displayDirectoryNamesByDirectory[ancestorDirectory] = displayDirectoryName; - directories.push(ancestorDirectory); - } - - testsByDirectory[ancestorDirectory].push(test); - }); - }); - - directories.sort(); - - var directorySelector = $('directory-selector'); - directorySelector.innerHTML = ''; - - directories.forEach(function(directory) { - var directoryOption = document.createElement('option'); - directoryOption.value = directory; - directoryOption.innerHTML = - displayDirectoryNamesByDirectory[directory] + ' - ' + - testsByDirectory[directory].length + ' tests'; - directorySelector.appendChild(directoryOption); - }); - - selectDirectory(); -} - -/** - * For a given failure type and directory and failure type, gets all the tests - * in that directory and populatest the test selector with them. - */ -function selectDirectory() -{ - var selectedDirectory = getSelectValue('directory-selector'); - selectedTests = testsByDirectory[selectedDirectory]; - - selectedTests.sort(); - - var testSelector = $('test-selector'); - testSelector.innerHTML = ''; - - selectedTests.forEach(function(testName) { - var testOption = document.createElement('option'); - testOption.value = testName; - var testDisplayName = testName; - if (testName.lastIndexOf(selectedDirectory) == 0) { - testDisplayName = testName.substring(selectedDirectory.length); - } - testOption.innerHTML = ' ' + testDisplayName; - testSelector.appendChild(testOption); - }); - - selectTest(); -} - -function getSelectedTest() -{ - return getSelectValue('test-selector'); -} - -function selectTest() -{ - var selectedTest = getSelectedTest(); - - if (results.tests[selectedTest].actual.indexOf('IMAGE') != -1) { - $('image-outputs').style.display = ''; - displayImageResults(selectedTest); - } else { - $('image-outputs').style.display = 'none'; - } - - if (results.tests[selectedTest].actual.indexOf('TEXT') != -1) { - $('text-outputs').style.display = ''; - displayTextResults(selectedTest); - } else { - $('text-outputs').style.display = 'none'; - } - - var currentBaselines = $('current-baselines'); - currentBaselines.textContent = ''; - var baselines = results.tests[selectedTest].baselines; - var testName = selectedTest.split('.').slice(0, -1).join('.'); - for (var platform in baselines) { - if (currentBaselines.firstChild) { - currentBaselines.appendChild(document.createTextNode('; ')); - } - currentBaselines.appendChild(document.createTextNode(platform + ' (')); - for (var i = 0, extension; extension = baselines[platform][i]; i++) { - if (i != 0) { - currentBaselines.appendChild(document.createTextNode(', ')); - } - var link = document.createElement('a'); - var baselinePath = ''; - if (platform != 'base') { - baselinePath += 'platform/' + platform + '/'; - } - baselinePath += testName + '-expected' + extension; - link.href = getTracUrl(baselinePath); - if (extension == '.checksum') { - link.textContent = 'chk'; - } else { - link.textContent = extension.substring(1); - } - link.target = '_blank'; - currentBaselines.appendChild(link); - } - currentBaselines.appendChild(document.createTextNode(')')); - } - - updateState(); - loupe.hide(); - - prefetchNextImageTest(); -} - -function prefetchNextImageTest() -{ - var testSelector = $('test-selector'); - if (testSelector.selectedIndex == testSelector.options.length - 1) { - return; - } - var nextTest = testSelector.options[testSelector.selectedIndex + 1].value; - if (results.tests[nextTest].actual.indexOf('IMAGE') != -1) { - new Image().src = getTestResultUrl(nextTest, 'expected-image'); - new Image().src = getTestResultUrl(nextTest, 'actual-image'); - } -} - -function updateState() -{ - var testName = getSelectedTest(); - var testIndex = selectedTests.indexOf(testName); - var testCount = selectedTests.length - $('test-index').textContent = testIndex + 1; - $('test-count').textContent = testCount; - - $('next-test').disabled = testIndex == testCount - 1; - $('previous-test').disabled = testIndex == 0; - - $('test-link').href = getTracUrl(testName); - - var state = results.tests[testName].state; - $('state').className = state; - $('state').innerHTML = STATE_TO_DISPLAY_STATE[state]; - - queue.updateState(); -} - -function getTestResultUrl(testName, mode) -{ - return '/test_result?test=' + testName + '&mode=' + mode; -} - -var currentExpectedImageTest; -var currentActualImageTest; - -function displayImageResults(testName) -{ - if (currentExpectedImageTest == currentActualImageTest - && currentExpectedImageTest == testName) { - return; - } - - function displayImageResult(mode, callback) { - var image = $(mode); - image.className = 'loading'; - image.src = getTestResultUrl(testName, mode); - image.onload = function() { - image.className = ''; - callback(); - updateImageDiff(); - }; - } - - displayImageResult( - 'expected-image', - function() { currentExpectedImageTest = testName; }); - displayImageResult( - 'actual-image', - function() { currentActualImageTest = testName; }); - - $('diff-canvas').className = 'loading'; - $('diff-canvas').style.display = ''; - $('diff-checksum').style.display = 'none'; -} - -/** - * Computes a graphical a diff between the expected and actual images by - * rendering each to a canvas, getting the image data, and comparing the RGBA - * components of each pixel. The output is put into the diff canvas, with - * identical pixels appearing at 12.5% opacity and different pixels being - * highlighted in red. - */ -function updateImageDiff() { - if (currentExpectedImageTest != currentActualImageTest) - return; - - var expectedImage = $('expected-image'); - var actualImage = $('actual-image'); - - function getImageData(image) { - var imageCanvas = document.createElement('canvas'); - imageCanvas.width = image.width; - imageCanvas.height = image.height; - imageCanvasContext = imageCanvas.getContext('2d'); - - imageCanvasContext.fillStyle = 'rgba(255, 255, 255, 1)'; - imageCanvasContext.fillRect( - 0, 0, image.width, image.height); - - imageCanvasContext.drawImage(image, 0, 0); - return imageCanvasContext.getImageData( - 0, 0, image.width, image.height); - } - - var expectedImageData = getImageData(expectedImage); - var actualImageData = getImageData(actualImage); - - var diffCanvas = $('diff-canvas'); - var diffCanvasContext = diffCanvas.getContext('2d'); - var diffImageData = - diffCanvasContext.createImageData(diffCanvas.width, diffCanvas.height); - - // Avoiding property lookups for all these during the per-pixel loop below - // provides a significant performance benefit. - var expectedWidth = expectedImage.width; - var expectedHeight = expectedImage.height; - var expected = expectedImageData.data; - - var actualWidth = actualImage.width; - var actual = actualImageData.data; - - var diffWidth = diffImageData.width; - var diff = diffImageData.data; - - var hadDiff = false; - for (var x = 0; x < expectedWidth; x++) { - for (var y = 0; y < expectedHeight; y++) { - var expectedOffset = (y * expectedWidth + x) * 4; - var actualOffset = (y * actualWidth + x) * 4; - var diffOffset = (y * diffWidth + x) * 4; - if (expected[expectedOffset] != actual[actualOffset] || - expected[expectedOffset + 1] != actual[actualOffset + 1] || - expected[expectedOffset + 2] != actual[actualOffset + 2] || - expected[expectedOffset + 3] != actual[actualOffset + 3]) { - hadDiff = true; - diff[diffOffset] = 255; - diff[diffOffset + 1] = 0; - diff[diffOffset + 2] = 0; - diff[diffOffset + 3] = 255; - } else { - diff[diffOffset] = expected[expectedOffset]; - diff[diffOffset + 1] = expected[expectedOffset + 1]; - diff[diffOffset + 2] = expected[expectedOffset + 2]; - diff[diffOffset + 3] = 32; - } - } - } - - diffCanvasContext.putImageData( - diffImageData, - 0, 0, - 0, 0, - diffImageData.width, diffImageData.height); - diffCanvas.className = ''; - - if (!hadDiff) { - diffCanvas.style.display = 'none'; - $('diff-checksum').style.display = ''; - loadTextResult(currentExpectedImageTest, 'expected-checksum'); - loadTextResult(currentExpectedImageTest, 'actual-checksum'); - } -} - -function loadTextResult(testName, mode) -{ - loadText(getTestResultUrl(testName, mode), function(text) { - $(mode).textContent = text; - }); -} - -function displayTextResults(testName) -{ - loadTextResult(testName, 'expected-text'); - loadTextResult(testName, 'actual-text'); - loadTextResult(testName, 'diff-text'); -} - -function nextTest() -{ - var testSelector = $('test-selector'); - var nextTestIndex = testSelector.selectedIndex + 1; - while (true) { - if (nextTestIndex == testSelector.options.length) { - return; - } - if (testSelector.options[nextTestIndex].disabled) { - nextTestIndex++; - } else { - testSelector.selectedIndex = nextTestIndex; - selectTest(); - return; - } - } -} - -function previousTest() -{ - var testSelector = $('test-selector'); - var previousTestIndex = testSelector.selectedIndex - 1; - while (true) { - if (previousTestIndex == -1) { - return; - } - if (testSelector.options[previousTestIndex].disabled) { - previousTestIndex--; - } else { - testSelector.selectedIndex = previousTestIndex; - selectTest(); - return - } - } -} - -window.addEventListener('DOMContentLoaded', main); diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/queue.js b/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/queue.js deleted file mode 100644 index f57c919..0000000 --- a/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/queue.js +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -function RebaselineQueue() -{ - this._selectNode = $('queue-select'); - this._rebaselineButtonNode = $('rebaseline-queue'); - this._toggleNode = $('toggle-queue'); - this._removeSelectionButtonNode = $('remove-queue-selection'); - - this._inProgressRebaselineCount = 0; - - var self = this; - $('add-to-rebaseline-queue').addEventListener( - 'click', function() { self.addCurentTest(); }); - this._selectNode.addEventListener('change', updateState); - this._removeSelectionButtonNode.addEventListener( - 'click', function() { self._removeSelection(); }); - this._rebaselineButtonNode.addEventListener( - 'click', function() { self.rebaseline(); }); - this._toggleNode.addEventListener( - 'click', function() { toggle('queue'); }); -} - -RebaselineQueue.prototype.updateState = function() -{ - var testName = getSelectedTest(); - - var state = results.tests[testName].state; - $('add-to-rebaseline-queue').disabled = state != STATE_NEEDS_REBASELINE; - - var queueLength = this._selectNode.options.length; - if (this._inProgressRebaselineCount > 0) { - this._rebaselineButtonNode.disabled = true; - this._rebaselineButtonNode.textContent = - 'Rebaseline in progress (' + this._inProgressRebaselineCount + - ' tests left)'; - } else if (queueLength == 0) { - this._rebaselineButtonNode.disabled = true; - this._rebaselineButtonNode.textContent = 'Rebaseline queue'; - this._toggleNode.textContent = 'Queue'; - } else { - this._rebaselineButtonNode.disabled = false; - this._rebaselineButtonNode.textContent = - 'Rebaseline queue (' + queueLength + ' tests)'; - this._toggleNode.textContent = 'Queue (' + queueLength + ' tests)'; - } - this._removeSelectionButtonNode.disabled = - this._selectNode.selectedIndex == -1; -}; - -RebaselineQueue.prototype.addCurrentTest = function() -{ - var testName = getSelectedTest(); - var test = results.tests[testName]; - - if (test.state != STATE_NEEDS_REBASELINE) { - log('Cannot add test with state "' + test.state + '" to queue.', - log.WARNING); - return; - } - - var queueOption = document.createElement('option'); - queueOption.value = testName; - queueOption.textContent = testName; - this._selectNode.appendChild(queueOption); - test.state = STATE_IN_QUEUE; - updateState(); -}; - -RebaselineQueue.prototype.removeCurrentTest = function() -{ - this._removeTest(getSelectedTest()); -}; - -RebaselineQueue.prototype._removeSelection = function() -{ - if (this._selectNode.selectedIndex == -1) - return; - - this._removeTest( - this._selectNode.options[this._selectNode.selectedIndex].value); -}; - -RebaselineQueue.prototype._removeTest = function(testName) -{ - var queueOption = this._selectNode.firstChild; - - while (queueOption && queueOption.value != testName) { - queueOption = queueOption.nextSibling; - } - - if (!queueOption) - return; - - this._selectNode.removeChild(queueOption); - var test = results.tests[testName]; - test.state = STATE_NEEDS_REBASELINE; - updateState(); -}; - -RebaselineQueue.prototype.rebaseline = function() -{ - var testNames = []; - for (var queueOption = this._selectNode.firstChild; - queueOption; - queueOption = queueOption.nextSibling) { - testNames.push(queueOption.value); - } - - this._inProgressRebaselineCount = testNames.length; - updateState(); - - testNames.forEach(this._rebaselineTest, this); -}; - -RebaselineQueue.prototype._rebaselineTest = function(testName) -{ - var baselineTarget = getSelectValue('baseline-target'); - var baselineMoveTo = getSelectValue('baseline-move-to'); - - // FIXME: actually rebaseline - log('Rebaselining ' + testName + ' for platform ' + baselineTarget + '...'); - var test = results.tests[testName]; - this._removeTest(testName); - this._inProgressRebaselineCount--; - test.state = STATE_REBASELINE_SUCCEEDED; - updateState(); - log('Rebaselined add test with state ' + test.state + ' to queue', - log.SUCCESS); -}; diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/util.js b/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/util.js deleted file mode 100644 index b348462..0000000 --- a/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/util.js +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -var results; -var testsByFailureType = {}; -var testsByDirectory = {}; -var selectedTests = []; - -function $(id) -{ - return document.getElementById(id); -} - -function getSelectValue(id) -{ - var select = $(id); - if (select.selectedIndex == -1) { - return null; - } else { - return select.options[select.selectedIndex].value; - } -} - -function loadText(url, callback) -{ - var xhr = new XMLHttpRequest(); - xhr.open('GET', url); - xhr.addEventListener('load', function() { callback(xhr.responseText); }); - xhr.send(); -} - -function log(text, type) -{ - var node = $('log'); - - if (type) { - var typeNode = document.createElement('span'); - typeNode.textContent = type.text; - typeNode.style.color = type.color; - node.appendChild(typeNode); - } - - node.appendChild(document.createTextNode(text + '\n')); - node.scrollTop = node.scrollHeight; -} - -log.WARNING = {text: 'Warning: ', color: '#aa3'}; -log.SUCCESS = {text: 'Success: ', color: 'green'}; -log.ERROR = {text: 'Error: ', color: 'red'}; - -function toggle(id) -{ - var element = $(id); - var toggler = $('toggle-' + id); - if (element.style.display == 'none') { - element.style.display = ''; - toggler.className = 'link selected'; - } else { - element.style.display = 'none'; - toggler.className = 'link'; - } -} - -function getTracUrl(layoutTestPath) -{ - return 'http://trac.webkit.org/browser/trunk/LayoutTests/' + layoutTestPath; -}
\ No newline at end of file |