Title: [93483] trunk/Tools
Revision
93483
Author
[email protected]
Date
2011-08-20 13:37:41 -0700 (Sat, 20 Aug 2011)

Log Message

garden-o-matic summary.html should have UI for examining failures
https://bugs.webkit.org/show_bug.cgi?id=66625

Reviewed by Dimitri Glazkov.

This patch introduces the notion of UI actions and converts our
existing manual <button> manipulation with this new abstraction.  The
patch also adds an Examine button to failure notifications.  In a
future patch, I'll add a controller that wires this button up to
something useful.

* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/garden-o-matic.html:
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/run-unittests.html:
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/actions.js: Added.
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/actions_unittests.js: Added.
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications.js:
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications_unittests.js:
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/results.js:
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/summary.html:

Modified Paths

Added Paths

Diff

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/garden-o-matic.html (93482 => 93483)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/garden-o-matic.html	2011-08-20 18:40:16 UTC (rev 93482)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/garden-o-matic.html	2011-08-20 20:37:41 UTC (rev 93483)
@@ -59,6 +59,7 @@
 <script src=""
 <script src=""
 <script src=""
+<script src=""
 <script src=""
 <script src=""
 <script src=""

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/run-unittests.html (93482 => 93483)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/run-unittests.html	2011-08-20 18:40:16 UTC (rev 93482)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/run-unittests.html	2011-08-20 20:37:41 UTC (rev 93483)
@@ -53,6 +53,8 @@
 <script src=""
 <script src=""
 <script src=""
+<script src=""
+<script src=""
 <script src=""
 <script src="" <!-- This script is slightly of order. -->
 <script src=""

Added: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/actions.js (0 => 93483)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/actions.js	                        (rev 0)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/actions.js	2011-08-20 20:37:41 UTC (rev 93483)
@@ -0,0 +1,93 @@
+/*
+ * 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 || {};
+ui.actions = ui.actions || {};
+
+(function() {
+
+var Action = "" {
+    init: function() {
+        this._eventName = null;
+        this.addEventListener('click', function() {
+            if (this._eventName)
+                $(this).trigger(this._eventName);
+        }.bind(this));
+    },
+    makeDefault: function() {
+        $(this).addClass('default');
+        return this;
+    }
+});
+
+ui.actions.Rollout = base.extends(Action, {
+    init: function() {
+        this.textContent = 'Roll out';
+        this._eventName = 'rollout';
+    }
+});
+
+ui.actions.Examine = base.extends(Action, {
+    init: function() {
+        this.textContent = 'Examine';
+        this._eventName = 'examine';
+    }
+});
+
+ui.actions.Rebaseline = base.extends(Action, {
+    init: function() {
+        this.textContent = 'Rebaseline';
+        this._eventName = 'rebaseline';
+    }
+});
+
+ui.actions.Next = base.extends(Action, {
+    init: function() {
+        this.textContent = '&#9654;';
+        this._eventName = 'next';
+        this.className = 'next';
+    }
+});
+
+ui.actions.Previous = base.extends(Action, {
+    init: function() {
+        this.textContent = '&#9664;';
+        this._eventName = 'previous';
+        this.className = 'previous';
+    }
+});
+
+ui.actions.List = base.extends('ul', {
+    init: function(actions) {
+        this.className = 'actions';
+        $(this).append(actions.map(function(action) {
+            var item = document.createElement('li');
+            item.appendChild(action);
+            return item;
+        }));
+    }
+});
+
+})();

Added: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/actions_unittests.js (0 => 93483)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/actions_unittests.js	                        (rev 0)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/actions_unittests.js	2011-08-20 20:37:41 UTC (rev 93483)
@@ -0,0 +1,76 @@
+/*
+ * 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.
+ */
+
+(function () {
+
+module('ui.actions');
+
+test('Buttons', 6, function() {
+    var buttonInfos = [{
+        view: new ui.actions.Rollout(),
+        text: 'Roll out',
+        event: 'rollout'
+    }, {
+        view: new ui.actions.Examine(),
+        text: 'Examine',
+        event: 'examine'
+    }, {
+        view: new ui.actions.Rebaseline(),
+        text: 'Rebaseline',
+        event: 'rebaseline'
+    }];
+    buttonInfos.forEach(function(buttonInfo) {
+        equal(buttonInfo.view.textContent, buttonInfo.text);
+        equal(buttonInfo.view._eventName, buttonInfo.event);
+    });
+});
+
+test('click', 1, function() {
+    var examine = new ui.actions.Examine();
+    $(examine).bind('examine', function() {
+        ok('Examine triggered.');
+    });
+    $(examine).trigger('click');
+});
+
+test('default', 2, function() {
+    var next = new ui.actions.Next();
+    equal(next.makeDefault(), next);
+    equal(next.className, 'next default');
+});
+
+test('List', 1, function() {
+    var list = new ui.actions.List([
+        new ui.actions.Rebaseline(),
+        new ui.actions.Previous(),
+        new ui.actions.Next()
+    ]);
+    equal(list.innerHTML,
+        '<li><button>Rebaseline</button></li>' +
+        '<li><button class="previous">&amp;#9664;</button></li>' +
+        '<li><button class="next">&amp;#9654;</button></li>');
+});
+
+}());

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications.js (93482 => 93483)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications.js	2011-08-20 18:40:16 UTC (rev 93482)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications.js	2011-08-20 20:37:41 UTC (rev 93483)
@@ -113,10 +113,9 @@
     {
         this._description = this.appendChild(document.createElement('div'));
         this._description.className = 'description';
-        var actions = this.appendChild(document.createElement('ul'));
-        actions.className = 'actions';
-        // FIXME: Actions should do something.
-        actions.appendChild(document.createElement('li')).innerHTML = '<button>Roll out</button>';
+        this.appendChild(new ui.actions.List([
+            new ui.actions.Rollout()
+        ]));
     }
 });
 
@@ -151,7 +150,11 @@
 });
 
 ui.notifications.TestFailures = base.extends(ui.notifications.Failure, {
-    init: function() { },
+    init: function() {
+        this.appendChild(new ui.actions.List([
+            new ui.actions.Examine()
+        ]));
+    },
     containsFailureAnalysis: function(failureAnalysis)
     {
         return Array.prototype.some.call(this._effects.children, function(child) {

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications_unittests.js (93482 => 93483)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications_unittests.js	2011-08-20 18:40:16 UTC (rev 93482)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications_unittests.js	2011-08-20 20:37:41 UTC (rev 93483)
@@ -93,17 +93,72 @@
 test('TestFailures', 7, function() {
     var testFailures = new ui.notifications.TestFailures();
     equal(testFailures.tagName, 'LI');
-    equal(testFailures.innerHTML, '<time>Just now</time><div class="what"><div class="problem"><ul class="effects"></ul><ul class="causes"></ul></div></div>');
+    equal(testFailures.innerHTML,
+        '<time>Just now</time>' +
+        '<div class="what">' +
+            '<div class="problem">' +
+                '<ul class="effects"></ul>' +
+                '<ul class="causes"></ul>' +
+            '</div>' +
+        '</div>' +
+        '<ul class="actions">' +
+            '<li><button>Examine</button></li>' +
+        '</ul>');
     testFailures.addFailureAnalysis({testName: 'test'});
-    equal(testFailures.innerHTML, '<time>Just now</time><div class="what"><div class="problem"><ul class="effects"><li>test</li></ul><ul class="causes"></ul></div></div>');
+    equal(testFailures.innerHTML,
+        '<time>Just now</time>' +
+        '<div class="what">' +
+            '<div class="problem">' +
+                '<ul class="effects">' +
+                    '<li>test</li>' +
+                '</ul>' +
+                '<ul class="causes"></ul>' +
+            '</div>' +
+        '</div>' +
+        '<ul class="actions">' +
+            '<li><button>Examine</button></li>' +
+        '</ul>');
     ok(testFailures.containsFailureAnalysis({testName: 'test'}));
     ok(!testFailures.containsFailureAnalysis({testName: 'foo'}));
     testFailures.addFailureAnalysis({testName: 'test'});
-    equal(testFailures.innerHTML, '<time>Just now</time><div class="what"><div class="problem"><ul class="effects"><li>test</li></ul><ul class="causes"></ul></div></div>');
+    equal(testFailures.innerHTML,
+        '<time>Just now</time>' +
+        '<div class="what">' +
+            '<div class="problem">' +
+                '<ul class="effects">' +
+                    '<li>test</li>' +
+                '</ul>' +
+                '<ul class="causes"></ul>' +
+            '</div>' +
+        '</div>' +
+        '<ul class="actions">' +
+            '<li><button>Examine</button></li>' +
+        '</ul>');
     var time = new Date();
     time.setMinutes(time.getMinutes() - 10);
     testFailures.addCommitData({revision: 1, time: time, title: "title", author: "author", reviewer: "reviewer"});
-    equal(testFailures.innerHTML, '<time>10 minutes ago</time><div class="what"><div class="problem"><ul class="effects"><li>test</li></ul><ul class="causes"><li><div class="description"><a href="" author (reviewer)</div><ul class="actions"><li><button>Roll out</button></li></ul></li></ul></div></div>');
+    equal(testFailures.innerHTML,
+        '<time>10 minutes ago</time>' +
+        '<div class="what">' +
+            '<div class="problem">' +
+                '<ul class="effects">' +
+                    '<li>test</li>' +
+                '</ul>' +
+                '<ul class="causes">' +
+                    '<li>' +
+                        '<div class="description">' +
+                            '<a href="" author (reviewer)'+
+                        '</div>' +
+                        '<ul class="actions">' +
+                            '<li><button>Roll out</button></li>' +
+                        '</ul>' +
+                    '</li>' +
+                '</ul>' +
+            '</div>' +
+        '</div>' +
+        '<ul class="actions">' +
+            '<li><button>Examine</button></li>' +
+        '</ul>');
 });
 
 test('BuildersFailing', 1, function() {

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/results.js (93482 => 93483)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/results.js	2011-08-20 18:40:16 UTC (rev 93482)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/results.js	2011-08-20 20:37:41 UTC (rev 93483)
@@ -207,24 +207,6 @@
     }
 });
 
-ui.results.Actions = base.extends('div', {
-    init: function()
-    {
-        this.className = 'actions';
-        this.innerHTML = '<button class="rebaseline default">Rebaseline</button>' +
-                         '<button class="previous">&#9664;</button>' +
-                         '<button class="next">&#9654;</button>';
-        this._routeClickEvent('.rebaseline', 'rebaseline');
-        this._routeClickEvent('.previous', 'previous');
-        this._routeClickEvent('.next', 'next');
-    },
-    _routeClickEvent: function(selector, eventName) {
-        $(selector, this).bind('click', function() {
-            $(this).trigger(eventName);
-        }.bind(this));
-    }
-});
-
 ui.results.View = base.extends('div', {
     init: function(delegate)
     {
@@ -235,7 +217,11 @@
         this._builderSelector = new ui.results.BuilderSelector();
         this._resultsDetails = new ui.results.ResultsDetails(delegate);
 
-        $('.toolbar', this).prepend(new ui.results.Actions())
+        $('.toolbar', this).prepend(new ui.actions.List([
+            new ui.actions.Rebaseline().makeDefault(),
+            new ui.actions.Previous(),
+            new ui.actions.Next(),
+        ]));
         $('.selector', this).append(this._testSelector).append(this._builderSelector);
         $('.content', this).append(this._resultsDetails);
     },

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/summary.html (93482 => 93483)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/summary.html	2011-08-20 18:40:16 UTC (rev 93482)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/summary.html	2011-08-20 20:37:41 UTC (rev 93483)
@@ -43,7 +43,9 @@
 <script src=""
 <script src=""
 <script src=""
+<script src=""
 <script src=""
+<script src=""
 <script src=""
 </body>
 </html>

Modified: trunk/Tools/ChangeLog (93482 => 93483)


--- trunk/Tools/ChangeLog	2011-08-20 18:40:16 UTC (rev 93482)
+++ trunk/Tools/ChangeLog	2011-08-20 20:37:41 UTC (rev 93483)
@@ -1,5 +1,27 @@
 2011-08-20  Adam Barth  <[email protected]>
 
+        garden-o-matic summary.html should have UI for examining failures
+        https://bugs.webkit.org/show_bug.cgi?id=66625
+
+        Reviewed by Dimitri Glazkov.
+
+        This patch introduces the notion of UI actions and converts our
+        existing manual <button> manipulation with this new abstraction.  The
+        patch also adds an Examine button to failure notifications.  In a
+        future patch, I'll add a controller that wires this button up to
+        something useful.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/garden-o-matic.html:
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/run-unittests.html:
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/actions.js: Added.
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/actions_unittests.js: Added.
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications.js:
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications_unittests.js:
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/results.js:
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/summary.html:
+
+2011-08-20  Adam Barth  <[email protected]>
+
         garden-o-matic summary page should indiciate compile failures
         https://bugs.webkit.org/show_bug.cgi?id=66624
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to