garden-o-matic examine buttons shows both expected and unexpected failures
authorabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Sep 2011 21:02:34 +0000 (21:02 +0000)
committerabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Sep 2011 21:02:34 +0000 (21:02 +0000)
https://bugs.webkit.org/show_bug.cgi?id=68918

Reviewed by Dimitri Glazkov.

This was a copy/paste error when I refactored this classes to share
more code.

* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/controllers.js:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96153 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/run-unittests.html
Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/controllers.js
Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/controllers_unittests.js [new file with mode: 0644]
Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/garden-o-matic.js
Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/results_unittests.js
Tools/ChangeLog

index 638de7c..673cfe8 100644 (file)
@@ -65,6 +65,7 @@ THE POSSIBILITY OF SUCH DAMAGE.
 <script src="scripts/model_unittests.js"></script>
 <script src="scripts/ui/notifications.js"></script>
 <script src="scripts/ui/notifications_unittests.js"></script>
+<script src="scripts/controllers_unittests.js"></script>
 
 <!-- FIXME: We should have tests for these files! -->
 <script src="scripts/Bugzilla.js"></script>
index 7af63ee..cb2fc0f 100644 (file)
@@ -100,9 +100,11 @@ var FailureStreamController = base.extends(Object, {
     _keyFor: function(failureAnalysis) { throw "Not implemented!"; },
     _createFailureView: function(failureAnalysis) { throw "Not implemented!"; },
 
-    init: function(view)
+    init: function(model, view, delegate)
     {
+        this._model = model;
         this._view = view;
+        this._delegate = delegate;
         this._testFailures = new base.UpdateTracker();
     },
     update: function(failureAnalysis)
@@ -139,18 +141,13 @@ var FailureStreamController = base.extends(Object, {
 
         var testNameList = failures.testNameList();
         var failuresByTest = base.filterDictionary(
-            this._resultsFilter(model.state.resultsByBuilder),
+            this._resultsFilter(this._model.resultsByBuilder),
             function(key) {
                 return testNameList.indexOf(key) != -1;
             });
 
         var controller = new controllers.ResultsDetails(resultsView, failuresByTest);
-
-        // FIXME: This doesn't belong here.
-        var onebar = $('#onebar')[0];
-        var resultsContainer = onebar.results();
-        $(resultsContainer).empty().append(resultsView);
-        onebar.select('results');
+        this._delegate.showResults(resultsView);
     },
     _toFailureInfoList: function(failures)
     {
@@ -167,7 +164,7 @@ var FailureStreamController = base.extends(Object, {
 });
 
 controllers.UnexpectedFailures = base.extends(FailureStreamController, {
-    _resultsFilter: results.expectedOrUnexpectedFailuresByTest,
+    _resultsFilter: results.unexpectedFailuresByTest,
 
     _impliedFirstFailingRevision: function(failureAnalysis)
     {
diff --git a/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/controllers_unittests.js b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/controllers_unittests.js
new file mode 100644 (file)
index 0000000..bea57ce
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * 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 () {
+
+var kExampleResultsByBuilder = {
+    "Mock Builder": unittest.kExampleResultsJSON,
+};
+
+module("controllers");
+
+test("UnexpectedFailures", 2, function() {
+    var mockView = {};
+    var mockState = {
+        resultsByBuilder: kExampleResultsByBuilder
+    };
+    var expectedResultsByTest = null;
+    var mockDelegate = {
+        showResults: function(resultsView)
+        {
+            deepEqual(resultsView._resultsByTest, expectedResultsByTest);
+        }
+    }
+    var controller = controllers.UnexpectedFailures(mockState, mockView, mockDelegate);
+
+    var testNameList = null;
+    var mockFailures = {
+        testNameList: function() { return testNameList; }
+    };
+
+    testNameList = ["scrollbars/custom-scrollbar-with-incomplete-style.html"];
+    expectedResultsByTest = {};
+    controller.onExamine(mockFailures);
+
+    testNameList = ["userscripts/another-test.html"];
+    expectedResultsByTest = {
+      "userscripts/another-test.html": {
+        "Mock Builder": {
+          "expected": "PASS",
+          "actual": "TEXT"
+        }
+      }
+    };
+    controller.onExamine(mockFailures);
+});
+
+})();
index edad518..06c6178 100644 (file)
@@ -60,11 +60,21 @@ $(document).ready(function() {
     onebar = new ui.onebar();
     onebar.attach();
 
+    // FIXME: This doesn't belong here.
+    var onebarController = {
+        showResults: function(resultsView)
+        {
+            var resultsContainer = onebar.results();
+            $(resultsContainer).empty().append(resultsView);
+            onebar.select('results');
+        }
+    };
+
     var unexpectedFailuresView = new ui.notifications.Stream();
-    g_unexpectedFailuresController = new controllers.UnexpectedFailures(unexpectedFailuresView);
+    g_unexpectedFailuresController = new controllers.UnexpectedFailures(model.state, unexpectedFailuresView, onebarController);
 
     var failuresView = new ui.notifications.Stream();
-    g_failuresController = new controllers.Failures(failuresView);
+    g_failuresController = new controllers.Failures(model.state, failuresView, onebarController);
 
     g_info = new ui.notifications.Stream();
     g_failingBuilders = new controllers.FailingBuilders(g_info);
index 49445ae..09492b1 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+var unittest = unittest || {};
+
 (function () {
 
 module("results");
 
-var kExampleResultsJSON = {
+unittest.kExampleResultsJSON = {
     "tests": {
         "scrollbars": {
             "custom-scrollbar-with-incomplete-style.html": {
@@ -69,7 +71,7 @@ var kExampleResultsJSON = {
 };
 
 test("unexpectedFailures", 1, function() {
-    var unexpectedFailures = results.unexpectedFailures(kExampleResultsJSON);
+    var unexpectedFailures = results.unexpectedFailures(unittest.kExampleResultsJSON);
     deepEqual(unexpectedFailures, {
         "userscripts/another-test.html": {
             "expected": "PASS",
@@ -80,7 +82,7 @@ test("unexpectedFailures", 1, function() {
 
 test("unexpectedFailuresByTest", 1, function() {
     var unexpectedFailuresByTest = results.unexpectedFailuresByTest({
-        "Mock Builder": kExampleResultsJSON
+        "Mock Builder": unittest.kExampleResultsJSON
     });
     deepEqual(unexpectedFailuresByTest, {
         "userscripts/another-test.html": {
@@ -94,7 +96,7 @@ test("unexpectedFailuresByTest", 1, function() {
 
 test("unexpectedSuccessesByTest", 1, function() {
     var unexpectedFailuresByTest = results.unexpectedSuccessesByTest({
-        "Mock Builder": kExampleResultsJSON
+        "Mock Builder": unittest.kExampleResultsJSON
     });
     deepEqual(unexpectedFailuresByTest, {
         "scrollbars/unexpected-pass.html": {
@@ -108,7 +110,7 @@ test("unexpectedSuccessesByTest", 1, function() {
 
 test("failureInfoForTestAndBuilder", 1, function() {
     var unexpectedFailuresByTest = results.unexpectedFailuresByTest({
-        "Mock Builder": kExampleResultsJSON
+        "Mock Builder": unittest.kExampleResultsJSON
     });
     var failureInfo = results.failureInfoForTestAndBuilder(unexpectedFailuresByTest, "userscripts/another-test.html", "Mock Builder");
     deepEqual(failureInfo, {
@@ -149,13 +151,13 @@ test("resultType", 12, function() {
 });
 
 test("resultNodeForTest", 4, function() {
-    deepEqual(results.resultNodeForTest(kExampleResultsJSON, "userscripts/another-test.html"), {
+    deepEqual(results.resultNodeForTest(unittest.kExampleResultsJSON, "userscripts/another-test.html"), {
         "expected": "PASS",
         "actual": "TEXT"
     });
-    equals(results.resultNodeForTest(kExampleResultsJSON, "foo.html"), null);
-    equals(results.resultNodeForTest(kExampleResultsJSON, "userscripts/foo.html"), null);
-    equals(results.resultNodeForTest(kExampleResultsJSON, "userscripts/foo/bar.html"), null);
+    equals(results.resultNodeForTest(unittest.kExampleResultsJSON, "foo.html"), null);
+    equals(results.resultNodeForTest(unittest.kExampleResultsJSON, "userscripts/foo.html"), null);
+    equals(results.resultNodeForTest(unittest.kExampleResultsJSON, "userscripts/foo/bar.html"), null);
 });
 
 test("walkHistory", 6, function() {
index 5ab688c..a374806 100644 (file)
@@ -1,3 +1,15 @@
+2011-09-27  Adam Barth  <abarth@webkit.org>
+
+        garden-o-matic examine buttons shows both expected and unexpected failures
+        https://bugs.webkit.org/show_bug.cgi?id=68918
+
+        Reviewed by Dimitri Glazkov.
+
+        This was a copy/paste error when I refactored this classes to share
+        more code.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/controllers.js:
+
 2011-09-27  Ryosuke Niwa  <rniwa@webkit.org>
 
         Add Kaustubh Atrawalkar to the list of contributors.