<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[175063] trunk/Tools</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/175063">175063</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-10-22 13:04:37 -0700 (Wed, 22 Oct 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>PatchAnalysisTask._test_patch() needs refactoring
https://bugs.webkit.org/show_bug.cgi?id=137904

Patch by Jake Nielsen &lt;jacob_nielsen@apple.com&gt; on 2014-10-22
Reviewed by Alexey Proskuryakov.

* Scripts/webkitpy/tool/bot/commitqueuetask_unittest.py:
Fixes several small bugs, and makes minor changes to accomodate the
changes in PatchAnalysisTask.
(MockCommitQueue.refetch_patch):
(MockCommitQueue.test_results):
(test_flaky_test_failure):
(test_failed_archive):
(test_very_red_tree_retry):
(_expect_validate.MockDelegate.refetch_patch):
(MockCommitQueue.expected_failures): Deleted.
(_expect_validate.MockDelegate.expected_failures): Deleted.
* Scripts/webkitpy/tool/bot/expectedfailures.py: Removed.
* Scripts/webkitpy/tool/bot/expectedfailures_unittest.py: Removed.
* Scripts/webkitpy/tool/bot/patchanalysistask.py:
Removes the unexpected_failures member, adds the _clean_tree_results
member, adds a helper function for _test_patch, and refactors
_test_patch to be more readable.
(PatchAnalysisTask.__init__):
(PatchAnalysisTask._continue_testing_patch_that_exceeded_failure_limit_on_first_or_second_try):
(PatchAnalysisTask._test_patch):
(PatchAnalysisTask.results_from_test_run_without_patch):
* Scripts/webkitpy/tool/commands/earlywarningsystem.py:
Removes AbstractEarlyWarningSystem's dependancy on ExpectedFailures.
(AbstractEarlyWarningSystem.begin_work_queue):
(AbstractEarlyWarningSystem._failing_tests_message):
(AbstractEarlyWarningSystem.command_failed):
(AbstractEarlyWarningSystem.expected_failures): Deleted.
* Scripts/webkitpy/tool/commands/earlywarningsystem_unittest.py:
Makes changes to accomodate the changes made to PatchAnalysisTask.
(AbstractEarlyWarningSystemTest.test_failing_tests_message):
* Scripts/webkitpy/tool/commands/perfalizer.py:
Removes Perfalizer's dependancy on ExpectedFailures.
(PerfalizerTask.refetch_patch):
(PerfalizerTask.expected_failures): Deleted.
* Scripts/webkitpy/tool/commands/queues.py:
Removes CommitQueue's dependancy on ExpectedFailures, and adds an
initializer to allow for mock injection.
(CommitQueue.__init__):
(CommitQueue.begin_work_queue):
(CommitQueue.process_work_item):
(CommitQueue._failing_tests_message):
* Scripts/webkitpy/tool/commands/queues_unittest.py:
Removes dependancy on ExpectedFailures, and instead uses mock
injection.
(MockCommitQueueTask):
(MockCommitQueueTask.results_from_patch_test_run):
(MockCommitQueueTask.results_from_test_run_without_patch):
(mock_run_webkit_patch):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptswebkitpytoolbotcommitqueuetask_unittestpy">trunk/Tools/Scripts/webkitpy/tool/bot/commitqueuetask_unittest.py</a></li>
<li><a href="#trunkToolsScriptswebkitpytoolbotpatchanalysistaskpy">trunk/Tools/Scripts/webkitpy/tool/bot/patchanalysistask.py</a></li>
<li><a href="#trunkToolsScriptswebkitpytoolcommandsearlywarningsystempy">trunk/Tools/Scripts/webkitpy/tool/commands/earlywarningsystem.py</a></li>
<li><a href="#trunkToolsScriptswebkitpytoolcommandsearlywarningsystem_unittestpy">trunk/Tools/Scripts/webkitpy/tool/commands/earlywarningsystem_unittest.py</a></li>
<li><a href="#trunkToolsScriptswebkitpytoolcommandsperfalizerpy">trunk/Tools/Scripts/webkitpy/tool/commands/perfalizer.py</a></li>
<li><a href="#trunkToolsScriptswebkitpytoolcommandsqueuespy">trunk/Tools/Scripts/webkitpy/tool/commands/queues.py</a></li>
<li><a href="#trunkToolsScriptswebkitpytoolcommandsqueues_unittestpy">trunk/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkToolsScriptswebkitpytoolbotexpectedfailurespy">trunk/Tools/Scripts/webkitpy/tool/bot/expectedfailures.py</a></li>
<li><a href="#trunkToolsScriptswebkitpytoolbotexpectedfailures_unittestpy">trunk/Tools/Scripts/webkitpy/tool/bot/expectedfailures_unittest.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (175062 => 175063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-10-22 19:44:03 UTC (rev 175062)
+++ trunk/Tools/ChangeLog        2014-10-22 20:04:37 UTC (rev 175063)
</span><span class="lines">@@ -1,3 +1,59 @@
</span><ins>+2014-10-22  Jake Nielsen  &lt;jacob_nielsen@apple.com&gt;
+
+        PatchAnalysisTask._test_patch() needs refactoring
+        https://bugs.webkit.org/show_bug.cgi?id=137904
+
+        Reviewed by Alexey Proskuryakov.
+
+        * Scripts/webkitpy/tool/bot/commitqueuetask_unittest.py:
+        Fixes several small bugs, and makes minor changes to accomodate the
+        changes in PatchAnalysisTask.
+        (MockCommitQueue.refetch_patch):
+        (MockCommitQueue.test_results):
+        (test_flaky_test_failure):
+        (test_failed_archive):
+        (test_very_red_tree_retry):
+        (_expect_validate.MockDelegate.refetch_patch):
+        (MockCommitQueue.expected_failures): Deleted.
+        (_expect_validate.MockDelegate.expected_failures): Deleted.
+        * Scripts/webkitpy/tool/bot/expectedfailures.py: Removed.
+        * Scripts/webkitpy/tool/bot/expectedfailures_unittest.py: Removed.
+        * Scripts/webkitpy/tool/bot/patchanalysistask.py:
+        Removes the unexpected_failures member, adds the _clean_tree_results
+        member, adds a helper function for _test_patch, and refactors
+        _test_patch to be more readable.
+        (PatchAnalysisTask.__init__):
+        (PatchAnalysisTask._continue_testing_patch_that_exceeded_failure_limit_on_first_or_second_try):
+        (PatchAnalysisTask._test_patch):
+        (PatchAnalysisTask.results_from_test_run_without_patch):
+        * Scripts/webkitpy/tool/commands/earlywarningsystem.py:
+        Removes AbstractEarlyWarningSystem's dependancy on ExpectedFailures. 
+        (AbstractEarlyWarningSystem.begin_work_queue):
+        (AbstractEarlyWarningSystem._failing_tests_message):
+        (AbstractEarlyWarningSystem.command_failed):
+        (AbstractEarlyWarningSystem.expected_failures): Deleted.
+        * Scripts/webkitpy/tool/commands/earlywarningsystem_unittest.py:
+        Makes changes to accomodate the changes made to PatchAnalysisTask.
+        (AbstractEarlyWarningSystemTest.test_failing_tests_message):
+        * Scripts/webkitpy/tool/commands/perfalizer.py:
+        Removes Perfalizer's dependancy on ExpectedFailures. 
+        (PerfalizerTask.refetch_patch):
+        (PerfalizerTask.expected_failures): Deleted.
+        * Scripts/webkitpy/tool/commands/queues.py:
+        Removes CommitQueue's dependancy on ExpectedFailures, and adds an
+        initializer to allow for mock injection.
+        (CommitQueue.__init__):
+        (CommitQueue.begin_work_queue):
+        (CommitQueue.process_work_item):
+        (CommitQueue._failing_tests_message):
+        * Scripts/webkitpy/tool/commands/queues_unittest.py:
+        Removes dependancy on ExpectedFailures, and instead uses mock
+        injection.
+        (MockCommitQueueTask):
+        (MockCommitQueueTask.results_from_patch_test_run):
+        (MockCommitQueueTask.results_from_test_run_without_patch):
+        (mock_run_webkit_patch):
+
</ins><span class="cx"> 2014-10-22  Rohit Kumar  &lt;kumar.rohit@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [EFL][WK2] Minibrowser : Add support for mouse middle button to open links in new window
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpytoolbotcommitqueuetask_unittestpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/tool/bot/commitqueuetask_unittest.py (175062 => 175063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/tool/bot/commitqueuetask_unittest.py        2014-10-22 19:44:03 UTC (rev 175062)
+++ trunk/Tools/Scripts/webkitpy/tool/bot/commitqueuetask_unittest.py        2014-10-22 20:04:37 UTC (rev 175063)
</span><span class="lines">@@ -38,7 +38,6 @@
</span><span class="cx"> from webkitpy.layout_tests.models import test_failures
</span><span class="cx"> from webkitpy.thirdparty.mock import Mock
</span><span class="cx"> from webkitpy.tool.bot.commitqueuetask import *
</span><del>-from webkitpy.tool.bot.expectedfailures import ExpectedFailures
</del><span class="cx"> from webkitpy.tool.mocktool import MockTool
</span><span class="cx"> 
</span><span class="cx"> _log = logging.getLogger(__name__)
</span><span class="lines">@@ -69,11 +68,8 @@
</span><span class="cx">     def refetch_patch(self, patch):
</span><span class="cx">         return patch
</span><span class="cx"> 
</span><del>-    def expected_failures(self):
-        return ExpectedFailures()
-
</del><span class="cx">     def test_results(self):
</span><del>-        return LayoutTestResults(test_results=[], did_exceed_test_failure_limit=True)
</del><ins>+        return LayoutTestResults(test_results=[], did_exceed_test_failure_limit=False)
</ins><span class="cx"> 
</span><span class="cx">     def report_flaky_tests(self, patch, flaky_results, results_archive):
</span><span class="cx">         flaky_tests = [result.test_name for result in flaky_results]
</span><span class="lines">@@ -281,7 +277,7 @@
</span><span class="cx">         ])
</span><span class="cx">         # CommitQueueTask will only report flaky tests if we successfully parsed
</span><span class="cx">         # results.json and returned a LayoutTestResults object, so we fake one.
</span><del>-        commit_queue.test_results = lambda: LayoutTestResults(test_results=[], did_exceed_test_failure_limit=True)
</del><ins>+        commit_queue.test_results = lambda: LayoutTestResults(test_results=[], did_exceed_test_failure_limit=False)
</ins><span class="cx">         expected_logs = &quot;&quot;&quot;run_webkit_patch: ['clean']
</span><span class="cx"> command_passed: success_message='Cleaned working directory' patch='10000'
</span><span class="cx"> run_webkit_patch: ['update']
</span><span class="lines">@@ -312,7 +308,7 @@
</span><span class="cx">             None,
</span><span class="cx">             ScriptError(&quot;MOCK tests failure&quot;),
</span><span class="cx">         ])
</span><del>-        commit_queue.test_results = lambda: LayoutTestResults(test_results=[], did_exceed_test_failure_limit=True)
</del><ins>+        commit_queue.test_results = lambda: LayoutTestResults(test_results=[], did_exceed_test_failure_limit=False)
</ins><span class="cx">         # It's possible delegate to fail to archive layout tests, don't try to report
</span><span class="cx">         # flaky tests when that happens.
</span><span class="cx">         commit_queue.archive_last_test_results = lambda patch: None
</span><span class="lines">@@ -409,6 +405,7 @@
</span><span class="cx"> archive_last_test_results: patch='10000'
</span><span class="cx"> run_webkit_patch: ['build-and-test', '--no-clean', '--no-update', '--test', '--non-interactive']
</span><span class="cx"> command_failed: failure_message='Patch does not pass tests' script_error='MOCK test failure again' patch='10000'
</span><ins>+archive_last_test_results: patch='10000'
</ins><span class="cx"> &quot;&quot;&quot;
</span><span class="cx">         tool = MockTool(log_executive=True)
</span><span class="cx">         patch = tool.bugs.fetch_attachment(10000)
</span><span class="lines">@@ -497,12 +494,10 @@
</span><span class="cx">             None,
</span><span class="cx">             None,
</span><span class="cx">             ScriptError(&quot;MOCK test failure&quot;),
</span><del>-            ScriptError(&quot;MOCK test failure again&quot;),
</del><span class="cx">             ScriptError(&quot;MOCK clean test failure&quot;),
</span><span class="cx">         ], [
</span><span class="cx">             lots_of_failing_tests,
</span><span class="cx">             lots_of_failing_tests,
</span><del>-            lots_of_failing_tests,
</del><span class="cx">         ])
</span><span class="cx"> 
</span><span class="cx">         # Tests always fail, and return so many failures that we do not
</span><span class="lines">@@ -521,9 +516,6 @@
</span><span class="cx"> run_webkit_patch: ['build-and-test', '--no-clean', '--no-update', '--test', '--non-interactive']
</span><span class="cx"> command_failed: failure_message='Patch does not pass tests' script_error='MOCK test failure' patch='10000'
</span><span class="cx"> archive_last_test_results: patch='10000'
</span><del>-run_webkit_patch: ['build-and-test', '--no-clean', '--no-update', '--test', '--non-interactive']
-command_failed: failure_message='Patch does not pass tests' script_error='MOCK test failure again' patch='10000'
-archive_last_test_results: patch='10000'
</del><span class="cx"> run_webkit_patch: ['build-and-test', '--force-clean', '--no-update', '--build', '--test', '--non-interactive']
</span><span class="cx"> command_failed: failure_message='Unable to pass tests without patch (tree is red?)' script_error='MOCK clean test failure' patch='10000'
</span><span class="cx"> &quot;&quot;&quot;
</span><span class="lines">@@ -604,9 +596,6 @@
</span><span class="cx">             def refetch_patch(self, patch):
</span><span class="cx">                 return patch
</span><span class="cx"> 
</span><del>-            def expected_failures(self):
-                return ExpectedFailures()
-
</del><span class="cx">         task = CommitQueueTask(MockDelegate(), patch)
</span><span class="cx">         self.assertEqual(task.validate(), is_valid)
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpytoolbotexpectedfailurespy"></a>
<div class="delfile"><h4>Deleted: trunk/Tools/Scripts/webkitpy/tool/bot/expectedfailures.py (175062 => 175063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/tool/bot/expectedfailures.py        2014-10-22 19:44:03 UTC (rev 175062)
+++ trunk/Tools/Scripts/webkitpy/tool/bot/expectedfailures.py        2014-10-22 20:04:37 UTC (rev 175063)
</span><span class="lines">@@ -1,60 +0,0 @@
</span><del>-# 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:
-#
-#     * 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
-# &quot;AS IS&quot; 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.
-
-
-class ExpectedFailures(object):
-    def __init__(self):
-        self._failures = set()
-        self._is_trustworthy = True
-
-    @classmethod
-    def _has_failures(cls, results):
-        return bool(results and results.failing_tests())
-
-    @classmethod
-    def _should_trust(cls, results):
-        return bool(results and not results.did_exceed_test_failure_limit())
-
-    def failures_were_expected(self, results):
-        if not self._is_trustworthy:
-            return False
-        if not self._should_trust(results):
-            return False
-        return set(results.failing_tests()) &lt;= self._failures
-
-    def unexpected_failures_observed(self, results):
-        if not self._is_trustworthy:
-            return None
-        if not self._has_failures(results):
-            return None
-        return set(results.failing_tests()) - self._failures
-
-    def update(self, results):
-        if results:
-            self._failures = set(results.failing_tests())
-            self._is_trustworthy = self._should_trust(results)
</del></span></pre></div>
<a id="trunkToolsScriptswebkitpytoolbotexpectedfailures_unittestpy"></a>
<div class="delfile"><h4>Deleted: trunk/Tools/Scripts/webkitpy/tool/bot/expectedfailures_unittest.py (175062 => 175063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/tool/bot/expectedfailures_unittest.py        2014-10-22 19:44:03 UTC (rev 175062)
+++ trunk/Tools/Scripts/webkitpy/tool/bot/expectedfailures_unittest.py        2014-10-22 20:04:37 UTC (rev 175063)
</span><span class="lines">@@ -1,95 +0,0 @@
</span><del>-# Copyright (c) 2009 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
-# &quot;AS IS&quot; 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.
-
-import unittest
-
-from webkitpy.tool.bot.expectedfailures import ExpectedFailures
-
-
-class MockResults(object):
-    def __init__(self, failing_tests=[], did_exceed_test_failure_limit=False):
-        self._failing_tests = failing_tests
-        self._did_exceed_test_failure_limit = did_exceed_test_failure_limit
-
-    def did_exceed_test_failure_limit(self):
-        return self._did_exceed_test_failure_limit
-
-    def failing_tests(self):
-        return self._failing_tests
-
-
-class ExpectedFailuresTest(unittest.TestCase):
-    def _assert_can_trust(self, results, can_trust):
-        self.assertEqual(ExpectedFailures._should_trust(results), can_trust)
-
-    def test_can_trust_results(self):
-        self._assert_can_trust(None, False)
-        self._assert_can_trust(MockResults(failing_tests=[], did_exceed_test_failure_limit=False), True)
-        self._assert_can_trust(MockResults(failing_tests=[], did_exceed_test_failure_limit=True), False)
-        self._assert_can_trust(MockResults(failing_tests=[1], did_exceed_test_failure_limit=False), True)
-        self._assert_can_trust(MockResults(failing_tests=[1], did_exceed_test_failure_limit=True), False)
-        self._assert_can_trust(MockResults(failing_tests=[1, 2], did_exceed_test_failure_limit=False), True)
-        self._assert_can_trust(MockResults(failing_tests=[1, 2], did_exceed_test_failure_limit=True), False)
-
-    def _assert_expected(self, expected_failures, failures, expected):
-        self.assertEqual(expected_failures.failures_were_expected(MockResults(failures)), expected)
-
-    def test_failures_were_expected(self):
-        failures = ExpectedFailures()
-        failures.update(MockResults(['foo.html']))
-        self._assert_expected(failures, ['foo.html'], True)
-        self._assert_expected(failures, ['bar.html'], False)
-        self._assert_expected(failures, ['bar.html', 'foo.html'], False)
-
-        failures.update(MockResults(['baz.html']))
-        self._assert_expected(failures, ['baz.html'], True)
-        self._assert_expected(failures, ['foo.html'], False)
-
-        failures.update(MockResults([]))
-        self._assert_expected(failures, ['baz.html'], False)
-        self._assert_expected(failures, ['foo.html'], False)
-
-    def test_unexpected_failures_observed(self):
-        failures = ExpectedFailures()
-        failures.update(MockResults(['foo.html']))
-        self.assertEqual(failures.unexpected_failures_observed(MockResults(['foo.html', 'bar.html'])), set(['bar.html']))
-        self.assertEqual(failures.unexpected_failures_observed(MockResults(['baz.html'])), set(['baz.html']))
-        unbounded_results = MockResults(['baz.html', 'qux.html', 'taco.html'], did_exceed_test_failure_limit=True)
-        self.assertEqual(failures.unexpected_failures_observed(unbounded_results), set(['baz.html', 'qux.html', 'taco.html']))
-        unbounded_results_with_existing_failure = MockResults(['foo.html', 'baz.html', 'qux.html', 'taco.html'], did_exceed_test_failure_limit=True)
-        self.assertEqual(failures.unexpected_failures_observed(unbounded_results_with_existing_failure), set(['baz.html', 'qux.html', 'taco.html']))
-
-    def test_unexpected_failures_observed_when_tree_is_hosed(self):
-        failures = ExpectedFailures()
-        failures.update(MockResults(['foo.html', 'banana.html'], did_exceed_test_failure_limit=True))
-        self.assertEqual(failures.unexpected_failures_observed(MockResults(['foo.html', 'bar.html'])), None)
-        self.assertEqual(failures.unexpected_failures_observed(MockResults(['baz.html'])), None)
-        unbounded_results = MockResults(['baz.html', 'qux.html', 'taco.html'], did_exceed_test_failure_limit=True)
-        self.assertEqual(failures.unexpected_failures_observed(unbounded_results), None)
-        unbounded_results_with_existing_failure = MockResults(['foo.html', 'baz.html', 'qux.html', 'taco.html'], did_exceed_test_failure_limit=True)
-        self.assertEqual(failures.unexpected_failures_observed(unbounded_results_with_existing_failure), None)
</del></span></pre></div>
<a id="trunkToolsScriptswebkitpytoolbotpatchanalysistaskpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/tool/bot/patchanalysistask.py (175062 => 175063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/tool/bot/patchanalysistask.py        2014-10-22 19:44:03 UTC (rev 175062)
+++ trunk/Tools/Scripts/webkitpy/tool/bot/patchanalysistask.py        2014-10-22 20:04:37 UTC (rev 175063)
</span><span class="lines">@@ -82,7 +82,7 @@
</span><span class="cx">         self._script_error = None
</span><span class="cx">         self._results_archive_from_patch_test_run = None
</span><span class="cx">         self._results_from_patch_test_run = None
</span><del>-        self._expected_failures = delegate.expected_failures()
</del><ins>+        self._clean_tree_results = None
</ins><span class="cx"> 
</span><span class="cx">     def _run_command(self, command, success_message, failure_message):
</span><span class="cx">         try:
</span><span class="lines">@@ -183,6 +183,19 @@
</span><span class="cx">         second_failing_tests = [] if not second else second.failing_tests()
</span><span class="cx">         return first_failing_tests != second_failing_tests
</span><span class="cx"> 
</span><ins>+    def _continue_testing_patch_that_exceeded_failure_limit_on_first_or_second_try(self, results, results_archive, script_error):
+        self._build_and_test_without_patch()
+        self._clean_tree_results = self._delegate.test_results()
+
+        # If we've made it here, then many (500) tests are failing with the patch applied, but
+        # if the clean tree is also failing many tests, even if it's not quite as many (495),
+        # then we can't be certain that the discrepancy isn't due to flakiness, and hence we must
+        # defer judgement.
+        if (len(results.failing_tests()) - len(self._clean_tree_results.failing_tests())) &lt;= 5:
+            return False
+
+        return self.report_failure(results_archive, results, script_error)
+
</ins><span class="cx">     def _test_patch(self):
</span><span class="cx">         if self._test():
</span><span class="cx">             return True
</span><span class="lines">@@ -194,8 +207,8 @@
</span><span class="cx">         first_script_error = self._script_error
</span><span class="cx">         first_failure_status_id = self.failure_status_id
</span><span class="cx"> 
</span><del>-        if self._expected_failures.failures_were_expected(first_results):
-            return True
</del><ins>+        if first_results.did_exceed_test_failure_limit():
+            return self._continue_testing_patch_that_exceeded_failure_limit_on_first_or_second_try(first_results, first_results_archive, first_script_error)
</ins><span class="cx"> 
</span><span class="cx">         if self._test():
</span><span class="cx">             # Only report flaky tests if we were successful at parsing results.json and archiving results.
</span><span class="lines">@@ -204,10 +217,14 @@
</span><span class="cx">             return True
</span><span class="cx"> 
</span><span class="cx">         second_results = self._delegate.test_results()
</span><ins>+        second_results_archive = self._delegate.archive_last_test_results(self._patch)
+        second_script_error = self._script_error
+        second_failure_status_id = self.failure_status_id
</ins><span class="cx"> 
</span><del>-        if (not first_results.did_exceed_test_failure_limit() and
-            not second_results.did_exceed_test_failure_limit() and
-            self._results_failed_different_tests(first_results, second_results)):
</del><ins>+        if second_results.did_exceed_test_failure_limit():
+            return self._continue_testing_patch_that_exceeded_failure_limit_on_first_or_second_try(second_results, second_results_archive, second_script_error)
+
+        if self._results_failed_different_tests(first_results, second_results):
</ins><span class="cx">             # We could report flaky tests here, but we would need to be careful
</span><span class="cx">             # to use similar checks to ExpectedFailures._can_trust_results
</span><span class="cx">             # to make sure we don't report constant failures as flakes when
</span><span class="lines">@@ -215,30 +232,23 @@
</span><span class="cx">             # See https://bugs.webkit.org/show_bug.cgi?id=51272
</span><span class="cx">             return False
</span><span class="cx"> 
</span><del>-        # Archive (and remove) second results so test_results() after
-        # build_and_test_without_patch won't use second results instead of the clean-tree results.
-        second_results_archive = self._delegate.archive_last_test_results(self._patch)
-
</del><span class="cx">         if self._build_and_test_without_patch():
</span><span class="cx">             # The error from the previous ._test() run is real, report it.
</span><span class="cx">             return self.report_failure(first_results_archive, first_results, first_script_error)
</span><span class="cx"> 
</span><del>-        clean_tree_results = self._delegate.test_results()
-        self._expected_failures.update(clean_tree_results)
</del><ins>+        self._clean_tree_results = self._delegate.test_results()
</ins><span class="cx"> 
</span><del>-        # Re-check if the original results are now to be expected to avoid a full re-try.
-        if self._expected_failures.failures_were_expected(first_results):
-            return True
</del><ins>+        if self._clean_tree_results.did_exceed_test_failure_limit():
+            return False
</ins><span class="cx"> 
</span><del>-        # Now that we have updated information about failing tests with a clean checkout, we can
-        # tell if our original failures were unexpected and fail the patch if necessary.
-        if self._expected_failures.unexpected_failures_observed(first_results):
</del><ins>+        if set(first_results.failing_tests()) - set(self._clean_tree_results.failing_tests()):
</ins><span class="cx">             self.failure_status_id = first_failure_status_id
</span><span class="cx">             return self.report_failure(first_results_archive, first_results, first_script_error)
</span><span class="cx"> 
</span><del>-        # We don't know what's going on.  The tree is likely very red (beyond our layout-test-results
-        # failure limit), just keep retrying the patch. until someone fixes the tree.
-        return False
</del><ins>+        # At this point, we know that the first and second runs had the exact same failures,
+        # and that those failures are all present on the clean tree, so we can say with certainty
+        # that the patch is good.
+        return True
</ins><span class="cx"> 
</span><span class="cx">     def results_archive_from_patch_test_run(self, patch):
</span><span class="cx">         assert(self._patch.id() == patch.id())  # PatchAnalysisTask is not currently re-useable.
</span><span class="lines">@@ -248,6 +258,10 @@
</span><span class="cx">         assert(self._patch.id() == patch.id())  # PatchAnalysisTask is not currently re-useable.
</span><span class="cx">         return self._results_from_patch_test_run
</span><span class="cx"> 
</span><ins>+    def results_from_test_run_without_patch(self, patch):
+        assert(self._patch.id() == patch.id())  # PatchAnalysisTask is not currently re-useable.
+        return self._clean_tree_results
+
</ins><span class="cx">     def report_failure(self, results_archive=None, results=None, script_error=None):
</span><span class="cx">         if not self.validate():
</span><span class="cx">             return False
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpytoolcommandsearlywarningsystempy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/tool/commands/earlywarningsystem.py (175062 => 175063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/tool/commands/earlywarningsystem.py        2014-10-22 19:44:03 UTC (rev 175062)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/earlywarningsystem.py        2014-10-22 20:04:37 UTC (rev 175063)
</span><span class="lines">@@ -35,7 +35,6 @@
</span><span class="cx"> from webkitpy.common.system.filesystem import FileSystem
</span><span class="cx"> from webkitpy.common.system.executive import ScriptError
</span><span class="cx"> from webkitpy.tool.bot.earlywarningsystemtask import EarlyWarningSystemTask, EarlyWarningSystemTaskDelegate
</span><del>-from webkitpy.tool.bot.expectedfailures import ExpectedFailures
</del><span class="cx"> from webkitpy.tool.bot.layouttestresultsreader import LayoutTestResultsReader
</span><span class="cx"> from webkitpy.tool.bot.patchanalysistask import UnableToApplyPatch, PatchIsNotValid
</span><span class="cx"> from webkitpy.tool.bot.queueengine import QueueEngine
</span><span class="lines">@@ -55,12 +54,15 @@
</span><span class="cx"> 
</span><span class="cx">     def begin_work_queue(self):
</span><span class="cx">         AbstractReviewQueue.begin_work_queue(self)
</span><del>-        self._expected_failures = ExpectedFailures()
</del><span class="cx">         self._layout_test_results_reader = LayoutTestResultsReader(self._tool, self._port.results_directory(), self._log_directory())
</span><span class="cx"> 
</span><span class="cx">     def _failing_tests_message(self, task, patch):
</span><span class="cx">         results = task.results_from_patch_test_run(patch)
</span><del>-        unexpected_failures = self._expected_failures.unexpected_failures_observed(results)
</del><ins>+        clean_results = task.results_from_test_run_without_patch(patch)
+
+        unexpected_failures = None
+        if results and clean_results:
+            unexpected_failures = list(set(results.failing_tests()) - set(clean_results.failing_tests()))
</ins><span class="cx">         if not unexpected_failures:
</span><span class="cx">             return None
</span><span class="cx">         if results and results.did_exceed_test_failure_limit():
</span><span class="lines">@@ -118,9 +120,6 @@
</span><span class="cx">         failure_log = self._log_from_script_error_for_upload(script_error)
</span><span class="cx">         return self._update_status(message, patch=patch, results_file=failure_log)
</span><span class="cx"> 
</span><del>-    def expected_failures(self):
-        return self._expected_failures
-
</del><span class="cx">     def test_results(self):
</span><span class="cx">         return self._layout_test_results_reader.results()
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpytoolcommandsearlywarningsystem_unittestpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/tool/commands/earlywarningsystem_unittest.py (175062 => 175063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/tool/commands/earlywarningsystem_unittest.py        2014-10-22 19:44:03 UTC (rev 175062)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/earlywarningsystem_unittest.py        2014-10-22 20:04:37 UTC (rev 175063)
</span><span class="lines">@@ -27,7 +27,10 @@
</span><span class="cx"> # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> 
</span><span class="cx"> from webkitpy.thirdparty.mock import Mock
</span><ins>+from webkitpy.common.net.layouttestresults import LayoutTestResults
</ins><span class="cx"> from webkitpy.common.system.outputcapture import OutputCapture
</span><ins>+from webkitpy.layout_tests.models import test_results
+from webkitpy.layout_tests.models import test_failures
</ins><span class="cx"> from webkitpy.tool.bot.queueengine import QueueEngine
</span><span class="cx"> from webkitpy.tool.commands.earlywarningsystem import *
</span><span class="cx"> from webkitpy.tool.commands.queuestest import QueuesTest
</span><span class="lines">@@ -44,9 +47,11 @@
</span><span class="cx">         ews.bind_to_tool(MockTool())
</span><span class="cx">         ews._options = MockOptions(port=None, confirm=False)
</span><span class="cx">         OutputCapture().assert_outputs(self, ews.begin_work_queue, expected_logs=self._default_begin_work_queue_logs(ews.name))
</span><del>-        ews._expected_failures.unexpected_failures_observed = lambda results: set([&quot;foo.html&quot;, &quot;bar.html&quot;])
</del><span class="cx">         task = Mock()
</span><del>-        task.results_from_patch_test_run = lambda a: None
</del><ins>+        task.results_from_patch_test_run = lambda a: LayoutTestResults([test_results.TestResult(&quot;foo.html&quot;, failures=[test_failures.FailureTextMismatch()]),
+                                                                          test_results.TestResult(&quot;bar.html&quot;, failures=[test_failures.FailureTextMismatch()])],
+                                                                          did_exceed_test_failure_limit=False)
+        task.results_from_test_run_without_patch = lambda a: LayoutTestResults([], did_exceed_test_failure_limit=False)
</ins><span class="cx">         patch = ews._tool.bugs.fetch_attachment(10000)
</span><span class="cx">         self.assertMultiLineEqual(ews._failing_tests_message(task, patch), &quot;New failing tests:\nbar.html\nfoo.html&quot;)
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpytoolcommandsperfalizerpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/tool/commands/perfalizer.py (175062 => 175063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/tool/commands/perfalizer.py        2014-10-22 19:44:03 UTC (rev 175062)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/perfalizer.py        2014-10-22 20:04:37 UTC (rev 175063)
</span><span class="lines">@@ -28,7 +28,6 @@
</span><span class="cx"> 
</span><span class="cx"> import logging
</span><span class="cx"> 
</span><del>-from webkitpy.tool.bot.expectedfailures import ExpectedFailures
</del><span class="cx"> from webkitpy.tool.bot.irc_command import IRCCommand
</span><span class="cx"> from webkitpy.tool.bot.irc_command import Help
</span><span class="cx"> from webkitpy.tool.bot.irc_command import Hi
</span><span class="lines">@@ -151,9 +150,6 @@
</span><span class="cx">     def refetch_patch(self, patch):
</span><span class="cx">         return self._tool.bugs.fetch_attachment(patch.id())
</span><span class="cx"> 
</span><del>-    def expected_failures(self):
-        return ExpectedFailures()
-
</del><span class="cx">     def build_style(self):
</span><span class="cx">         return &quot;release&quot;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpytoolcommandsqueuespy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/tool/commands/queues.py (175062 => 175063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/tool/commands/queues.py        2014-10-22 19:44:03 UTC (rev 175062)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/queues.py        2014-10-22 20:04:37 UTC (rev 175063)
</span><span class="lines">@@ -46,7 +46,6 @@
</span><span class="cx"> from webkitpy.common.system.executive import ScriptError
</span><span class="cx"> from webkitpy.tool.bot.botinfo import BotInfo
</span><span class="cx"> from webkitpy.tool.bot.commitqueuetask import CommitQueueTask, CommitQueueTaskDelegate
</span><del>-from webkitpy.tool.bot.expectedfailures import ExpectedFailures
</del><span class="cx"> from webkitpy.tool.bot.feeders import CommitQueueFeeder, EWSFeeder
</span><span class="cx"> from webkitpy.tool.bot.flakytestreporter import FlakyTestReporter
</span><span class="cx"> from webkitpy.tool.bot.layouttestresultsreader import LayoutTestResultsReader
</span><span class="lines">@@ -299,6 +298,10 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> class CommitQueue(PatchProcessingQueue, StepSequenceErrorHandler, CommitQueueTaskDelegate):
</span><ins>+    def __init__(self, commit_queue_task_class=CommitQueueTask):
+        self._commit_queue_task_class = commit_queue_task_class
+        PatchProcessingQueue.__init__(self)
+
</ins><span class="cx">     name = &quot;commit-queue&quot;
</span><span class="cx">     port_name = &quot;mac-mountainlion&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -307,7 +310,6 @@
</span><span class="cx">     def begin_work_queue(self):
</span><span class="cx">         PatchProcessingQueue.begin_work_queue(self)
</span><span class="cx">         self.committer_validator = CommitterValidator(self._tool)
</span><del>-        self._expected_failures = ExpectedFailures()
</del><span class="cx">         self._layout_test_results_reader = LayoutTestResultsReader(self._tool, self._port.results_directory(), self._log_directory())
</span><span class="cx"> 
</span><span class="cx">     def next_work_item(self):
</span><span class="lines">@@ -315,7 +317,7 @@
</span><span class="cx"> 
</span><span class="cx">     def process_work_item(self, patch):
</span><span class="cx">         self._cc_watchers(patch.bug_id())
</span><del>-        task = CommitQueueTask(self, patch)
</del><ins>+        task = self._commit_queue_task_class(self, patch)
</ins><span class="cx">         try:
</span><span class="cx">             if task.run():
</span><span class="cx">                 self._did_pass(patch)
</span><span class="lines">@@ -336,7 +338,12 @@
</span><span class="cx"> 
</span><span class="cx">     def _failing_tests_message(self, task, patch):
</span><span class="cx">         results = task.results_from_patch_test_run(patch)
</span><del>-        unexpected_failures = self._expected_failures.unexpected_failures_observed(results)
</del><ins>+        clean_results = task.results_from_test_run_without_patch(patch)
+
+        unexpected_failures = None
+        if results and clean_results:
+            unexpected_failures = list(set(results.failing_tests()) - set(clean_results.failing_tests()))
+        # FIXME: Can this ever happen?
</ins><span class="cx">         if not unexpected_failures:
</span><span class="cx">             return None
</span><span class="cx">         if results and results.did_exceed_test_failure_limit():
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpytoolcommandsqueues_unittestpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py (175062 => 175063)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py        2014-10-22 19:44:03 UTC (rev 175062)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py        2014-10-22 20:04:37 UTC (rev 175063)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> 
</span><span class="cx"> from webkitpy.common.checkout.scm import CheckoutNeedsUpdate
</span><span class="cx"> from webkitpy.common.checkout.scm.scm_mock import MockSCM
</span><ins>+from webkitpy.common.net.layouttestresults import LayoutTestResults
</ins><span class="cx"> from webkitpy.common.net.bugzilla import Attachment
</span><span class="cx"> from webkitpy.common.system.outputcapture import OutputCapture
</span><span class="cx"> from webkitpy.layout_tests.models import test_results
</span><span class="lines">@@ -295,7 +296,6 @@
</span><span class="cx"> MOCK: update_status: commit-queue Patch does not apply
</span><span class="cx"> MOCK setting flag 'commit-queue' to '-' on attachment '10000' with comment 'Rejecting attachment 10000 from commit-queue.\n\nNew failing tests:
</span><span class="cx"> mock_test_name.html
</span><del>-another_test_name.html
</del><span class="cx"> Full output: http://dummy_url'
</span><span class="cx"> MOCK: update_status: commit-queue Fail
</span><span class="cx"> MOCK: release_work_item: commit-queue 10000
</span><span class="lines">@@ -303,14 +303,21 @@
</span><span class="cx">             &quot;handle_script_error&quot;: &quot;ScriptError error message\n\nMOCK output\n&quot;,
</span><span class="cx">             &quot;handle_unexpected_error&quot;: &quot;MOCK setting flag 'commit-queue' to '-' on attachment '10000' with comment 'Rejecting attachment 10000 from commit-queue.\n\nMock error message'\n&quot;,
</span><span class="cx">         }
</span><del>-        queue = CommitQueue()
</del><span class="cx"> 
</span><ins>+        class MockCommitQueueTask(CommitQueueTask):
+            def results_from_patch_test_run(self, patch):
+                return LayoutTestResults([test_results.TestResult(&quot;mock_test_name.html&quot;, failures=[test_failures.FailureTextMismatch()])], did_exceed_test_failure_limit=False)
+
+            def results_from_test_run_without_patch(self, patch):
+                return LayoutTestResults([], did_exceed_test_failure_limit=False)
+
+        queue = CommitQueue(MockCommitQueueTask)
+
</ins><span class="cx">         def mock_run_webkit_patch(command):
</span><span class="cx">             if command[0] == 'clean' or command[0] == 'update':
</span><span class="cx">                 # We want cleaning to succeed so we can error out on a step
</span><span class="cx">                 # that causes the commit-queue to reject the patch.
</span><span class="cx">                 return
</span><del>-            queue._expected_failures.unexpected_failures_observed = lambda results: [&quot;mock_test_name.html&quot;, &quot;another_test_name.html&quot;]
</del><span class="cx">             raise ScriptError('MOCK script error')
</span><span class="cx"> 
</span><span class="cx">         queue.run_webkit_patch = mock_run_webkit_patch
</span></span></pre>
</div>
</div>

</body>
</html>