Commit 4f29cfef authored by leviw@chromium.org's avatar leviw@chromium.org

Kill ui.js

Move remaining ui.js functionality into existing classes and elements.

BUG=400393
NOTRY=true

Review URL: https://codereview.chromium.org/459983002

git-svn-id: svn://svn.chromium.org/blink/trunk@179993 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 71e3765b
...@@ -14,4 +14,33 @@ function CTFailure(step, reason, resultsByBuilder, firstFailingRevisions, lastPa ...@@ -14,4 +14,33 @@ function CTFailure(step, reason, resultsByBuilder, firstFailingRevisions, lastPa
this.firstFailingRevisions = firstFailingRevisions; this.firstFailingRevisions = firstFailingRevisions;
this.lastPassingRevisions = lastPassingRevisions; this.lastPassingRevisions = lastPassingRevisions;
} }
CTFailure.prototype.flakinessDashboardURL = function(tree) {
var testType = this.step;
// FIXME: Replace the flakiness dashboard's sense of groups with sheriff-o-matic's
// sense of trees and get rid of this mapping.
var treeToDashboardGroup = {
blink: '@ToT%20Blink',
chromium: '@ToT%20Chromium',
};
// FIXME: Remove this once the flakiness dashboard stops having webkit_tests
// masquerade as layout-tests.
if (testType == 'webkit_tests')
testType = 'layout-tests';
// FIXME: sugarjs's toQueryString makes spaces into pluses instead of %20, which confuses
// the flakiness dashboard, which just uses decodeURIComponent.
return 'http://test-results.appspot.com/dashboards/flakiness_dashboard.html#group=' +
treeToDashboardGroup[tree] + '&' +
Object.toQueryString({
tests: this.testName,
testType: testType,
});
}
CTFailure.prototype.embeddedFlakinessDashboardURL = function(tree) {
return this.flakinessDashboardURL(tree) + '&showChrome=false';
}
</script> </script>
...@@ -47,8 +47,6 @@ THE POSSIBILITY OF SUCH DAMAGE. ...@@ -47,8 +47,6 @@ THE POSSIBILITY OF SUCH DAMAGE.
<script src="scripts/net_unittests.js"></script> <script src="scripts/net_unittests.js"></script>
<script src="scripts/results.js"></script> <script src="scripts/results.js"></script>
<script src="scripts/results_unittests.js"></script> <script src="scripts/results_unittests.js"></script>
<script src="scripts/ui.js"></script>
<script src="scripts/ui_unittests.js"></script>
<script src="bower_components/platform/platform.js"></script> <script src="bower_components/platform/platform.js"></script>
<link rel="import" href="bower_components/polymer/polymer.html"> <link rel="import" href="bower_components/polymer/polymer.html">
...@@ -56,6 +54,7 @@ THE POSSIBILITY OF SUCH DAMAGE. ...@@ -56,6 +54,7 @@ THE POSSIBILITY OF SUCH DAMAGE.
<link rel="import" href="model/ct-builder-tests.html"> <link rel="import" href="model/ct-builder-tests.html">
<link rel="import" href="model/ct-commit-log-tests.html"> <link rel="import" href="model/ct-commit-log-tests.html">
<link rel="import" href="model/ct-commit-tests.html"> <link rel="import" href="model/ct-commit-tests.html">
<link rel="import" href="model/ct-failure-tests.html">
<link rel="import" href="model/tree-status-tests.html"> <link rel="import" href="model/tree-status-tests.html">
<link rel="import" href="ui/ct-builder-grid-tests.html"> <link rel="import" href="ui/ct-builder-grid-tests.html">
<link rel="import" href="ui/ct-builder-tests.html"> <link rel="import" href="ui/ct-builder-tests.html">
......
/*
* Copyright (C) 2011 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:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 ui = ui || {};
(function () {
// FIXME: Put this all in a more appropriate place.
// FIXME: Replace the flakiness dashboard's sense of groups with sheriff-o-matic's
// sense of trees and get rid of this mapping.
var treeToDashboardGroup = {
blink: '@ToT%20Blink',
chromium: '@ToT%20Chromium',
};
ui.displayNameForBuilder = function(builderName)
{
return builderName.replace(/Webkit /i, '');
}
// FIXME: Take a master name argument as well.
ui.urlForFlakinessDashboard = function(testNames, testType, tree)
{
if (Array.isArray(testNames))
testNames = testNames.join(',');
// FIXME: Remove this once the flakiness dashboard stops having webkit_tests
// masquerade as layout-tests.
if (testType == 'webkit_tests')
testType = 'layout-tests';
// FIXME: sugarjs's toQueryString makes spaces into pluses instead of %20, which confuses
// the flakiness dashboard, which just uses decodeURIComponent.
return 'http://test-results.appspot.com/dashboards/flakiness_dashboard.html#group=' +
treeToDashboardGroup[tree] + '&' +
Object.toQueryString({
tests: testNames,
testType: testType,
});
}
ui.urlForEmbeddedFlakinessDashboard = function(testNames, testType, tree)
{
return ui.urlForFlakinessDashboard(testNames, testType, tree) + '&showChrome=false';
}
})();
/*
* Copyright (C) 2013 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:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 () {
module("ui");
var flakinessBaseUrl = 'http://test-results.appspot.com/dashboards/flakiness_dashboard.html#';
test('urlForFlakinessDashboard', 5, function() {
equal(ui.urlForFlakinessDashboard('foo', 'bar', 'blink'),
flakinessBaseUrl + 'group=@ToT%20Blink&tests=foo&testType=bar');
equal(ui.urlForFlakinessDashboard('foo', 'bar', 'chromium'),
flakinessBaseUrl + 'group=@ToT%20Chromium&tests=foo&testType=bar');
equal(ui.urlForFlakinessDashboard(['foo', 'baz'], 'bar', 'blink'),
flakinessBaseUrl + 'group=@ToT%20Blink&tests=foo%2Cbaz&testType=bar');
equal(ui.urlForFlakinessDashboard('foo', 'webkit_tests', 'blink'),
flakinessBaseUrl + 'group=@ToT%20Blink&tests=foo&testType=layout-tests');
equal(ui.urlForFlakinessDashboard('foo', 'layout-tests', 'blink'),
flakinessBaseUrl + 'group=@ToT%20Blink&tests=foo&testType=layout-tests');
});
test('urlForEmbeddedFlakinessDashboard', 1, function() {
equal(ui.urlForEmbeddedFlakinessDashboard('foo', 'bar', 'blink'),
flakinessBaseUrl + 'group=@ToT%20Blink&tests=foo&testType=bar&showChrome=false');
});
})();
<!--
Copyright 2014 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<link rel="import" href="ct-embedded-flakiness-dashboard.html">
<script>
(function() {
module("ct-embedded-flakiness-dashboard");
asyncTest("url", 1, function() {
var failure = new CTFailure('foo_tests', 'foo/bar.html');
var tree = "blink";
var embeddedFlakinessDashboard = document.createElement('ct-embedded-flakiness-dashboard');
embeddedFlakinessDashboard.test = failure;
embeddedFlakinessDashboard.tree = tree;
requestAnimationFrame(function() {
var iframe = embeddedFlakinessDashboard.shadowRoot.querySelector('#iframe');
equal(iframe.src, failure.embeddedFlakinessDashboardURL(tree));
start();
});
});
asyncTest("heightChanged", 1, function() {
var embeddedFlakinessDashboard = document.createElement('ct-embedded-flakiness-dashboard');
function finishTest() {
window.removeEventListener('message', finishTest);
var iframe = embeddedFlakinessDashboard.shadowRoot.querySelector('#iframe');
equal(iframe.style.height, "100px");
start();
}
window.addEventListener('message', finishTest);
requestAnimationFrame(function() {
window.postMessage({command: 'heightChanged', height: "100"}, '*');
});
});
})()
</script>
...@@ -32,7 +32,7 @@ found in the LICENSE file. ...@@ -32,7 +32,7 @@ found in the LICENSE file.
}, },
testChanged: function() { testChanged: function() {
this.$.iframe.src = ui.urlForEmbeddedFlakinessDashboard(this.test.testName, this.test.step, this.tree); this.$.iframe.src = this.test.embeddedFlakinessDashboardURL(this.tree);
}, },
}); });
......
...@@ -37,8 +37,8 @@ asyncTest("basic", 9, function() { ...@@ -37,8 +37,8 @@ asyncTest("basic", 9, function() {
requestAnimationFrame(function() { requestAnimationFrame(function() {
var tabs = resultsByBuilder.shadowRoot.querySelectorAll('paper-tab'); var tabs = resultsByBuilder.shadowRoot.querySelectorAll('paper-tab');
equal(tabs.length, 2); equal(tabs.length, 2);
equal(tabs[0].textContent, 'Linux (dbg)'); equal(tabs[0].textContent, 'WebKit Linux (dbg)');
equal(tabs[1].textContent, 'Mac10.6 (dbg)'); equal(tabs[1].textContent, 'WebKit Mac10.6 (dbg)');
var detail = resultsByBuilder.shadowRoot.querySelectorAll('ct-results-detail'); var detail = resultsByBuilder.shadowRoot.querySelectorAll('ct-results-detail');
equal(detail.length, 1); equal(detail.length, 1);
......
...@@ -18,7 +18,7 @@ found in the LICENSE file. ...@@ -18,7 +18,7 @@ found in the LICENSE file.
</style> </style>
<paper-tabs selected="{{ selected }}"> <paper-tabs selected="{{ selected }}">
<template repeat="{{ builder in builders }}"> <template repeat="{{ builder in builders }}">
<paper-tab>{{ builder | displayName }}</paper-tab> <paper-tab>{{ builder }}</paper-tab>
</template> </template>
</paper-tabs> </paper-tabs>
<ct-results-detail failure="{{ failure }}" builder="{{ builders[selected] }}"></ct-results-detail> <ct-results-detail failure="{{ failure }}" builder="{{ builders[selected] }}"></ct-results-detail>
...@@ -33,10 +33,6 @@ found in the LICENSE file. ...@@ -33,10 +33,6 @@ found in the LICENSE file.
this.builders = Object.getOwnPropertyNames(this.failure.resultNodesByBuilder).sort(); this.builders = Object.getOwnPropertyNames(this.failure.resultNodesByBuilder).sort();
this.selected = 0; this.selected = 0;
}, },
displayName: function(builder) {
return ui.displayNameForBuilder(builder);
},
}); });
</script> </script>
</polymer-element> </polymer-element>
...@@ -30,16 +30,14 @@ asyncTest("image+text", 4, function() { ...@@ -30,16 +30,14 @@ asyncTest("image+text", 4, function() {
var comparisonResult = document.createElement('ct-results-detail'); var comparisonResult = document.createElement('ct-results-detail');
comparisonResult.builder = 'dummy builder'; comparisonResult.builder = 'dummy builder';
// FIXME: Use a proper mock model object. // FIXME: Use a proper mock model object.
comparisonResult.failure = { comparisonResult.failure = new CTFailure(
"testName": "dummy/test.html", "testName", "dummy/test.html",
"resultNodesByBuilder": { {
"dummy builder": { "dummy builder": {
"actual": "IMAGE+TEXT", "actual": "IMAGE+TEXT",
}, },
}, }, 177164, 177165
"oldestFailingRevision": 177164, );
"newestPassingRevision": 177165,
};
comparisonResult.async(function() { comparisonResult.async(function() {
deepEqual(probedUrls, [ deepEqual(probedUrls, [
......
...@@ -9,85 +9,83 @@ found in the LICENSE file. ...@@ -9,85 +9,83 @@ found in the LICENSE file.
<script> <script>
(function () { (function () {
var kExampleFailures = [{ var kExampleFailures = [
"testName": "plugins/gesture-events-scrolled.html", new CTFailure("testName", "plugins/gesture-events-scrolled.html",
"resultNodesByBuilder": { {
"WebKit Win7 (dbg)": { "WebKit Win7 (dbg)": {
"expected": "PASS", "expected": "PASS",
"is_unexpected": true, "is_unexpected": true,
"actual": "CRASH", "actual": "CRASH",
"time": 0.9 "time": 0.9
}, },
"WebKit Mac10.6 (dbg)": { "WebKit Mac10.6 (dbg)": {
"expected": "PASS", "expected": "PASS",
"is_unexpected": true, "is_unexpected": true,
"actual": "CRASH", "actual": "CRASH",
"has_stderr": true, "has_stderr": true,
"time": 1.8 "time": 1.8
}, },
"WebKit Mac10.7 (dbg)": { "WebKit Mac10.7 (dbg)": {
"expected": "PASS", "expected": "PASS",
"is_unexpected": true, "is_unexpected": true,
"actual": "CRASH", "actual": "CRASH",
"has_stderr": true, "has_stderr": true,
"time": 3.2 "time": 3.2
} }
}, },
"oldestFailingRevision": 177164, 177164, 177165
"newestPassingRevision": 177165 ),
}, { new CTFailure("testName", "plugins/transformed-events.html",
"testName": "plugins/transformed-events.html", {
"resultNodesByBuilder": { "WebKit Win7 (dbg)": {
"WebKit Win7 (dbg)": { "expected": "PASS",
"expected": "PASS", "is_unexpected": true,
"is_unexpected": true, "actual": "CRASH",
"actual": "CRASH", "time": 0.6
"time": 0.6 },
}, "WebKit Mac10.6 (dbg)": {
"WebKit Mac10.6 (dbg)": { "expected": "PASS",
"expected": "PASS", "is_unexpected": true,
"is_unexpected": true, "actual": "CRASH",
"actual": "CRASH", "has_stderr": true,
"has_stderr": true, "time": 1.4
"time": 1.4 },
}, "WebKit Mac10.7 (dbg)": {
"WebKit Mac10.7 (dbg)": { "expected": "PASS",
"expected": "PASS", "is_unexpected": true,
"is_unexpected": true, "actual": "CRASH",
"actual": "CRASH", "has_stderr": true,
"has_stderr": true, "time": 3
"time": 3 }
}
}, },
"oldestFailingRevision": 177164, 177164, 177165
"newestPassingRevision": 177165 ),
}, { new CTFailure("testName", "plugins/gesture-events.html",
"testName": "plugins/gesture-events.html", {
"resultNodesByBuilder": { "WebKit Win7 (dbg)": {
"WebKit Win7 (dbg)": { "expected": "PASS",
"expected": "PASS", "is_unexpected": true,
"is_unexpected": true, "actual": "CRASH",
"actual": "CRASH", "time": 1.7
"time": 1.7 },
}, "WebKit Mac10.6 (dbg)": {
"WebKit Mac10.6 (dbg)": { "expected": "PASS",
"expected": "PASS", "is_unexpected": true,
"is_unexpected": true, "actual": "CRASH",
"actual": "CRASH", "has_stderr": true,
"has_stderr": true, "time": 2.5
"time": 2.5 },
}, "WebKit Mac10.7 (dbg)": {
"WebKit Mac10.7 (dbg)": { "expected": "PASS",
"expected": "PASS", "is_unexpected": true,
"is_unexpected": true, "actual": "CRASH",
"actual": "CRASH", "has_stderr": true,
"has_stderr": true, "time": 3.4
"time": 3.4 }
}
}, },
"oldestFailingRevision": 177164, 177164, 177165
"newestPassingRevision": 177165 ),
}]; ];
module("ct-results-panel"); module("ct-results-panel");
......
...@@ -7,7 +7,6 @@ found in the LICENSE file. ...@@ -7,7 +7,6 @@ found in the LICENSE file.
<script src="../bower_components/sugar/release/sugar-full.development.js"></script> <script src="../bower_components/sugar/release/sugar-full.development.js"></script>
<script src="../scripts/net.js"></script> <script src="../scripts/net.js"></script>
<script src="../scripts/results.js"></script> <script src="../scripts/results.js"></script>
<script src="../scripts/ui.js"></script>
<link rel="import" href="../bower_components/core-animated-pages/core-animated-pages.html"> <link rel="import" href="../bower_components/core-animated-pages/core-animated-pages.html">
<link rel="import" href="../bower_components/core-animated-pages/transitions/slide-from-right.html"> <link rel="import" href="../bower_components/core-animated-pages/transitions/slide-from-right.html">
......
...@@ -9,40 +9,27 @@ found in the LICENSE file. ...@@ -9,40 +9,27 @@ found in the LICENSE file.
<script> <script>
(function () { (function () {
var kExampleTests = [ var kExampleFailures = [
{ new CTFailure('foo_step', "plugins/gesture-events-scrolled.html",
"testName": "plugins/gesture-events-scrolled.html", {
"step": "foo_step", "WebKit Mac10.6 (dbg)": {
"resultNodesByBuilder": { "actual": "IMAGE",
"WebKit Mac10.6 (dbg)": { },
"actual": "IMAGE", }, 177164, 177165),
}, new CTFailure('foo_step', "plugins/transformed-events.html",
}, {
"oldestFailingRevision": 177164, "WebKit Mac10.6 (dbg)": {
"newestPassingRevision": 177165, "actual": "IMAGE",
}, },
{ }, 177164, 177165
"testName": "plugins/transformed-events.html", ),
"step": "foo_step", new CTFailure('foo_step', "plugins/gesture-events.html",
"resultNodesByBuilder": { {
"WebKit Mac10.6 (dbg)": { "WebKit Mac10.6 (dbg)": {
"actual": "IMAGE", "actual": "IMAGE",
}, },
}, }, 177164, 177165
"oldestFailingRevision": 177164, )
"newestPassingRevision": 177165,
},
{
"testName": "plugins/gesture-events.html",
"step": "foo_step",
"resultNodesByBuilder": {
"WebKit Mac10.6 (dbg)": {
"actual": "IMAGE",
},
},
"oldestFailingRevision": 177164,
"newestPassingRevision": 177165,
},
]; ];
module("ct-test-list"); module("ct-test-list");
...@@ -50,7 +37,7 @@ module("ct-test-list"); ...@@ -50,7 +37,7 @@ module("ct-test-list");
asyncTest("basic", 4, function() { asyncTest("basic", 4, function() {
var list = document.createElement('ct-test-list'); var list = document.createElement('ct-test-list');
list.tests = kExampleTests; list.tests = kExampleFailures;
list.tree = 'blink'; list.tree = 'blink';
Platform.endOfMicrotask(function() { Platform.endOfMicrotask(function() {
......
...@@ -23,7 +23,7 @@ found in the LICENSE file. ...@@ -23,7 +23,7 @@ found in the LICENSE file.
<script> <script>
Polymer({ Polymer({
flakinessDashboardURL: function(test) { flakinessDashboardURL: function(test) {
return ui.urlForFlakinessDashboard(test.testName, test.step, this.tree); return test.flakinessDashboardURL(this.tree);
}, },
}); });
</script> </script>
......
...@@ -13,44 +13,40 @@ found in the LICENSE file. ...@@ -13,44 +13,40 @@ found in the LICENSE file.
var assert = chai.assert; var assert = chai.assert;
var kExampleFailures = [{ var kExampleFailures = [
"testName": "plugins/gesture-events-scrolled.html", new CTFailure('layout_tests', "plugins/gesture-events-scrolled.html",
"resultNodesByBuilder": { {
"WebKit Win7 (dbg)": { "WebKit Win7 (dbg)": {
"actual": "CRASH", "actual": "CRASH",
"masterUrl": "http://master-one", "masterUrl": "http://master-one",
"earliestFailingBuild": "1", "earliestFailingBuild": "1",
}, },
"WebKit Mac10.6 (dbg)": { "WebKit Mac10.6 (dbg)": {
"actual": "CRASH", "actual": "CRASH",
"masterUrl": "http://master-one", "masterUrl": "http://master-one",
"earliestFailingBuild": "2", "earliestFailingBuild": "2",
}, },
"WebKit Mac10.7": { "WebKit Mac10.7": {
"actual": "TEXT", "actual": "TEXT",
"masterUrl": "http://master-one", "masterUrl": "http://master-one",
"earliestFailingBuild": "3", "earliestFailingBuild": "3",
} }
}, }, 177164, 177165),
"oldestFailingRevision": 177164, new CTFailure('layout_tests', "plugins/transformed-events.html",
"newestPassingRevision": 177165 {
}, { "WebKit Win7 (dbg)": {
"testName": "plugins/transformed-events.html", "actual": "TEXT",
"resultNodesByBuilder": { "masterUrl": "http://master-one",
"WebKit Win7 (dbg)": { "earliestFailingBuild": "1",
"actual": "TEXT", },
"masterUrl": "http://master-one", "WebKit Mac10.7": {
"earliestFailingBuild": "1", "actual": "CRASH",
}, "masterUrl": "http://master-two",
"WebKit Mac10.7": { "earliestFailingBuild": "4",
"actual": "CRASH", },
"masterUrl": "http://master-two", }, 177164, 177165
"earliestFailingBuild": "4", )
}, ];
},
"oldestFailingRevision": 177164,
"newestPassingRevision": 177165
}];
var kExampleBuilderLatestRevisions = { var kExampleBuilderLatestRevisions = {
'WebKit Mac10.7': { 'WebKit Mac10.7': {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment