<!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>[203386] 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/203386">203386</a></dd>
<dt>Author</dt> <dd>aakash_jain@apple.com</dd>
<dt>Date</dt> <dd>2016-07-18 17:24:50 -0700 (Mon, 18 Jul 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>EWS console logs doesn't go to log file
https://bugs.webkit.org/show_bug.cgi?id=159539
&lt;rdar://problem/24464570&gt;

Reviewed by David Kilzer.

* Scripts/webkitpy/common/system/logutils.py:
(configure_logger_to_log_to_file): Added method to configure the logger to log to file.
(FileSystemHandler): Added class which uses logging.FileHandler as base class and supports writing
to filesystem. It also supports passing MockFilesystem.
(FileSystemHandler.__init__): Initialize the class and calls base class __init__.
(FileSystemHandler._open): Overrides the base class _open method to use filesystem object.
* Scripts/webkitpy/tool/commands/earlywarningsystem_unittest.py:
(AbstractEarlyWarningSystemTest.test_failing_tests_message): Added MockHost() parameter.
(_test_ews): Same.
* Scripts/webkitpy/tool/commands/queues.py:
(AbstractQueue.begin_work_queue): Configure the logger to log to file.
(AbstractQueue._log_directory): Using filesystem object instead of os.
(AbstractQueue.queue_log_path): Same.
(AbstractQueue.__init__): Passed host parameter.
(PatchProcessingQueue.__init__): Same.
(CommitQueue.__init__): Same.
(AbstractReviewQueue.__init__): Same.
(StyleQueue.__init__): Same.
* Scripts/webkitpy/tool/commands/queues_unittest.py:
(TestCommitQueue): Passed MockHost() as host.
(TestCommitQueue.__init__): Same.
(TestQueue.__init__): Same.
(TestReviewQueue.__init__): Same.
(TestFeederQueue.__init__): Same.
(AbstractPatchQueueTest.test_next_patch): Same.
(PatchProcessingQueueTest.test_upload_results_archive_for_patch): Same.
(test_commit_queue_failure): Same.
(MockCommitQueueTask.results_from_patch_test_run): Same.
(test_rollout_lands): Same.
(test_non_valid_patch): Same.
(test_auto_retry): Same.
(test_style_queue_with_watch_list_exception): Same.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptswebkitpycommonsystemlogutilspy">trunk/Tools/Scripts/webkitpy/common/system/logutils.py</a></li>
<li><a href="#trunkToolsScriptswebkitpytoolcommandsearlywarningsystem_unittestpy">trunk/Tools/Scripts/webkitpy/tool/commands/earlywarningsystem_unittest.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>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (203385 => 203386)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-07-19 00:24:28 UTC (rev 203385)
+++ trunk/Tools/ChangeLog        2016-07-19 00:24:50 UTC (rev 203386)
</span><span class="lines">@@ -1,3 +1,44 @@
</span><ins>+2016-07-18  Aakash Jain  &lt;aakash_jain@apple.com&gt;
+
+        EWS console logs doesn't go to log file
+        https://bugs.webkit.org/show_bug.cgi?id=159539
+        &lt;rdar://problem/24464570&gt;
+
+        Reviewed by David Kilzer.
+
+        * Scripts/webkitpy/common/system/logutils.py:
+        (configure_logger_to_log_to_file): Added method to configure the logger to log to file.
+        (FileSystemHandler): Added class which uses logging.FileHandler as base class and supports writing
+        to filesystem. It also supports passing MockFilesystem.
+        (FileSystemHandler.__init__): Initialize the class and calls base class __init__.
+        (FileSystemHandler._open): Overrides the base class _open method to use filesystem object.
+        * Scripts/webkitpy/tool/commands/earlywarningsystem_unittest.py:
+        (AbstractEarlyWarningSystemTest.test_failing_tests_message): Added MockHost() parameter.
+        (_test_ews): Same.
+        * Scripts/webkitpy/tool/commands/queues.py:
+        (AbstractQueue.begin_work_queue): Configure the logger to log to file.
+        (AbstractQueue._log_directory): Using filesystem object instead of os.
+        (AbstractQueue.queue_log_path): Same.
+        (AbstractQueue.__init__): Passed host parameter.
+        (PatchProcessingQueue.__init__): Same.
+        (CommitQueue.__init__): Same.
+        (AbstractReviewQueue.__init__): Same.
+        (StyleQueue.__init__): Same.
+        * Scripts/webkitpy/tool/commands/queues_unittest.py:
+        (TestCommitQueue): Passed MockHost() as host.
+        (TestCommitQueue.__init__): Same.
+        (TestQueue.__init__): Same.
+        (TestReviewQueue.__init__): Same.
+        (TestFeederQueue.__init__): Same.
+        (AbstractPatchQueueTest.test_next_patch): Same.
+        (PatchProcessingQueueTest.test_upload_results_archive_for_patch): Same.
+        (test_commit_queue_failure): Same.
+        (MockCommitQueueTask.results_from_patch_test_run): Same.
+        (test_rollout_lands): Same.
+        (test_non_valid_patch): Same.
+        (test_auto_retry): Same.
+        (test_style_queue_with_watch_list_exception): Same.
+
</ins><span class="cx"> 2016-07-02  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         WTF::Lock should be fair eventually
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpycommonsystemlogutilspy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/common/system/logutils.py (203385 => 203386)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/common/system/logutils.py        2016-07-19 00:24:28 UTC (rev 203385)
+++ trunk/Tools/Scripts/webkitpy/common/system/logutils.py        2016-07-19 00:24:50 UTC (rev 203386)
</span><span class="lines">@@ -31,7 +31,9 @@
</span><span class="cx"> 
</span><span class="cx"> import webkitpy
</span><span class="cx"> 
</span><ins>+from logging import FileHandler
</ins><span class="cx"> 
</span><ins>+
</ins><span class="cx"> _log = logging.getLogger(__name__)
</span><span class="cx"> 
</span><span class="cx"> # We set these directory paths lazily in get_logger() below.
</span><span class="lines">@@ -209,3 +211,25 @@
</span><span class="cx">     _log.debug(&quot;Debug logging enabled.&quot;)
</span><span class="cx"> 
</span><span class="cx">     return handlers
</span><ins>+
+
+def configure_logger_to_log_to_file(logger, log_path, filesystem):
+    log_directory = filesystem.dirname(log_path)
+    if log_directory and not filesystem.exists(log_directory):
+        filesystem.maybe_make_directory(log_directory)
+
+    handler = FileSystemHandler(log_path, filesystem)
+    formatter = logging.Formatter('%(asctime)s - %(message)s')
+    handler.setFormatter(formatter)
+
+    logger.addHandler(handler)
+
+
+class FileSystemHandler(FileHandler):
+    def __init__(self, filename, filesystem):
+        self.filename = filename
+        self.filesystem = filesystem
+        FileHandler.__init__(self, filename)
+
+    def _open(self):
+        return self.filesystem.open_text_file_for_writing(self.filename)
</ins></span></pre></div>
<a id="trunkToolsScriptswebkitpytoolcommandsearlywarningsystem_unittestpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/tool/commands/earlywarningsystem_unittest.py (203385 => 203386)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/tool/commands/earlywarningsystem_unittest.py        2016-07-19 00:24:28 UTC (rev 203385)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/earlywarningsystem_unittest.py        2016-07-19 00:24:50 UTC (rev 203386)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> from webkitpy.thirdparty.mock import Mock
</span><span class="cx"> from webkitpy.common.host import Host
</span><ins>+from webkitpy.common.host_mock import MockHost
</ins><span class="cx"> from webkitpy.common.net.layouttestresults import LayoutTestResults
</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">@@ -49,6 +50,7 @@
</span><span class="cx"> 
</span><span class="cx">         ews = TestEWS()
</span><span class="cx">         ews.bind_to_tool(MockTool())
</span><ins>+        ews.host = MockHost()
</ins><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><span class="cx">         task = Mock()
</span><span class="lines">@@ -89,6 +91,7 @@
</span><span class="cx"> 
</span><span class="cx">     def _test_ews(self, ews):
</span><span class="cx">         ews.bind_to_tool(MockTool())
</span><ins>+        ews.host = MockHost()
</ins><span class="cx">         options = Mock()
</span><span class="cx">         options.port = None
</span><span class="cx">         options.run_tests = ews.run_tests
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpytoolcommandsqueuespy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/tool/commands/queues.py (203385 => 203386)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/tool/commands/queues.py        2016-07-19 00:24:28 UTC (rev 203385)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/queues.py        2016-07-19 00:24:50 UTC (rev 203386)
</span><span class="lines">@@ -41,8 +41,10 @@
</span><span class="cx"> 
</span><span class="cx"> from webkitpy.common.config.committervalidator import CommitterValidator
</span><span class="cx"> from webkitpy.common.config.ports import DeprecatedPort
</span><ins>+from webkitpy.common.host import Host
</ins><span class="cx"> from webkitpy.common.net.bugzilla import Attachment
</span><span class="cx"> from webkitpy.common.net.statusserver import StatusServer
</span><ins>+from webkitpy.common.system import logutils
</ins><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><span class="lines">@@ -66,7 +68,7 @@
</span><span class="cx">     _fail_status = &quot;Fail&quot;
</span><span class="cx">     _error_status = &quot;Error&quot;
</span><span class="cx"> 
</span><del>-    def __init__(self, options=None):  # Default values should never be collections (like []) as default values are shared between invocations
</del><ins>+    def __init__(self, options=None, host=Host()):  # Default values should never be collections (like []) as default values are shared between invocations
</ins><span class="cx">         options_list = (options or []) + [
</span><span class="cx">             make_option(&quot;--no-confirm&quot;, action=&quot;store_false&quot;, dest=&quot;confirm&quot;, default=True, help=&quot;Do not ask the user for confirmation before running the queue.  Dangerous!&quot;),
</span><span class="cx">             make_option(&quot;--exit-after-iteration&quot;, action=&quot;store&quot;, type=&quot;int&quot;, dest=&quot;iterations&quot;, default=None, help=&quot;Stop running the queue after iterating this number of times.&quot;),
</span><span class="lines">@@ -76,6 +78,7 @@
</span><span class="cx">         self._iteration_count = 0
</span><span class="cx">         if not hasattr(self, 'architecture'):
</span><span class="cx">             self.architecture = None
</span><ins>+        self.host = host
</ins><span class="cx"> 
</span><span class="cx">     def _cc_watchers(self, bug_id):
</span><span class="cx">         try:
</span><span class="lines">@@ -109,17 +112,18 @@
</span><span class="cx">         return command_output
</span><span class="cx"> 
</span><span class="cx">     def _log_directory(self):
</span><del>-        return os.path.join(&quot;..&quot;, &quot;%s-logs&quot; % self.name)
</del><ins>+        return self.host.filesystem.join(&quot;..&quot;, &quot;%s-logs&quot; % self.name)
</ins><span class="cx"> 
</span><span class="cx">     # QueueEngineDelegate methods
</span><span class="cx"> 
</span><span class="cx">     def queue_log_path(self):
</span><del>-        return os.path.join(self._log_directory(), &quot;%s.log&quot; % self.name)
</del><ins>+        return self.host.filesystem.join(self._log_directory(), &quot;%s.log&quot; % self.name)
</ins><span class="cx"> 
</span><span class="cx">     def work_item_log_path(self, work_item):
</span><span class="cx">         raise NotImplementedError, &quot;subclasses must implement&quot;
</span><span class="cx"> 
</span><span class="cx">     def begin_work_queue(self):
</span><ins>+        logutils.configure_logger_to_log_to_file(_log, self.queue_log_path(), self.host.filesystem)
</ins><span class="cx">         _log.info(&quot;CAUTION: %s will discard all local changes in \&quot;%s\&quot;&quot; % (self.name, self._tool.scm().checkout_root))
</span><span class="cx">         if self._options.confirm:
</span><span class="cx">             response = self._tool.user.prompt(&quot;Are you sure?  Type \&quot;yes\&quot; to continue: &quot;)
</span><span class="lines">@@ -259,9 +263,10 @@
</span><span class="cx">     # Subclasses must override.
</span><span class="cx">     port_name = None
</span><span class="cx"> 
</span><del>-    def __init__(self, options=None):
</del><ins>+    def __init__(self, options=None, host=Host()):
</ins><span class="cx">         self._port = None  # We can't instantiate port here because tool isn't avaialble.
</span><del>-        AbstractPatchQueue.__init__(self, options)
</del><ins>+        self.host = host
+        AbstractPatchQueue.__init__(self, options, host=host)
</ins><span class="cx"> 
</span><span class="cx">     # FIXME: This is a hack to map between the old port names and the new port names.
</span><span class="cx">     def _new_port_name_from_old(self, port_name, platform):
</span><span class="lines">@@ -313,9 +318,10 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> class CommitQueue(PatchProcessingQueue, StepSequenceErrorHandler, CommitQueueTaskDelegate):
</span><del>-    def __init__(self, commit_queue_task_class=CommitQueueTask):
</del><ins>+    def __init__(self, commit_queue_task_class=CommitQueueTask, host=Host()):
+        self.host = host
</ins><span class="cx">         self._commit_queue_task_class = commit_queue_task_class
</span><del>-        PatchProcessingQueue.__init__(self)
</del><ins>+        PatchProcessingQueue.__init__(self, host=host)
</ins><span class="cx"> 
</span><span class="cx">     name = &quot;commit-queue&quot;
</span><span class="cx">     port_name = &quot;mac&quot;
</span><span class="lines">@@ -430,8 +436,9 @@
</span><span class="cx"> 
</span><span class="cx"> class AbstractReviewQueue(PatchProcessingQueue, StepSequenceErrorHandler):
</span><span class="cx">     &quot;&quot;&quot;This is the base-class for the EWS queues and the style-queue.&quot;&quot;&quot;
</span><del>-    def __init__(self, options=None):
-        PatchProcessingQueue.__init__(self, options)
</del><ins>+    def __init__(self, options=None, host=Host()):
+        self.host = host
+        PatchProcessingQueue.__init__(self, options, host=host)
</ins><span class="cx"> 
</span><span class="cx">     def review_patch(self, patch):
</span><span class="cx">         raise NotImplementedError(&quot;subclasses must implement&quot;)
</span><span class="lines">@@ -463,8 +470,9 @@
</span><span class="cx"> class StyleQueue(AbstractReviewQueue, StyleQueueTaskDelegate):
</span><span class="cx">     name = &quot;style-queue&quot;
</span><span class="cx"> 
</span><del>-    def __init__(self):
-        AbstractReviewQueue.__init__(self)
</del><ins>+    def __init__(self, host=Host()):
+        self.host = host
+        AbstractReviewQueue.__init__(self, host=host)
</ins><span class="cx"> 
</span><span class="cx">     def review_patch(self, patch):
</span><span class="cx">         task = StyleQueueTask(self, patch)
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpytoolcommandsqueues_unittestpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py (203385 => 203386)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py        2016-07-19 00:24:28 UTC (rev 203385)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py        2016-07-19 00:24:50 UTC (rev 203386)
</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.host_mock import MockHost
</ins><span class="cx"> from webkitpy.common.net.layouttestresults import LayoutTestResults
</span><span class="cx"> from webkitpy.common.net.bugzilla import Attachment
</span><span class="cx"> from webkitpy.common.system.outputcapture import OutputCapture
</span><span class="lines">@@ -47,7 +48,7 @@
</span><span class="cx"> 
</span><span class="cx"> class TestCommitQueue(CommitQueue):
</span><span class="cx">     def __init__(self, tool=None):
</span><del>-        CommitQueue.__init__(self)
</del><ins>+        CommitQueue.__init__(self, host=MockHost())
</ins><span class="cx">         if tool:
</span><span class="cx">             self.bind_to_tool(tool)
</span><span class="cx">         self._options = MockOptions(confirm=False, parent_command=&quot;commit-queue&quot;, port=None)
</span><span class="lines">@@ -62,15 +63,24 @@
</span><span class="cx"> class TestQueue(AbstractPatchQueue):
</span><span class="cx">     name = &quot;test-queue&quot;
</span><span class="cx"> 
</span><ins>+    def __init__(self):
+        AbstractPatchQueue.__init__(self, host=MockHost())
</ins><span class="cx"> 
</span><ins>+
</ins><span class="cx"> class TestReviewQueue(AbstractReviewQueue):
</span><span class="cx">     name = &quot;test-review-queue&quot;
</span><span class="cx"> 
</span><ins>+    def __init__(self):
+        AbstractReviewQueue.__init__(self, host=MockHost())
</ins><span class="cx"> 
</span><ins>+
</ins><span class="cx"> class TestFeederQueue(FeederQueue):
</span><span class="cx">     _sleep_duration = 0
</span><span class="cx"> 
</span><ins>+    def __init__(self):
+        FeederQueue.__init__(self, host=MockHost())
</ins><span class="cx"> 
</span><ins>+
</ins><span class="cx"> class AbstractQueueTest(CommandsTest):
</span><span class="cx">     def test_log_directory(self):
</span><span class="cx">         self.assertEqual(TestQueue()._log_directory(), os.path.join(&quot;..&quot;, &quot;test-queue-logs&quot;))
</span><span class="lines">@@ -153,7 +163,7 @@
</span><span class="cx"> 
</span><span class="cx"> class AbstractPatchQueueTest(CommandsTest):
</span><span class="cx">     def test_next_patch(self):
</span><del>-        queue = AbstractPatchQueue()
</del><ins>+        queue = AbstractPatchQueue(host=MockHost())
</ins><span class="cx">         tool = MockTool()
</span><span class="cx">         queue.bind_to_tool(tool)
</span><span class="cx">         queue._options = Mock()
</span><span class="lines">@@ -171,7 +181,7 @@
</span><span class="cx"> 
</span><span class="cx"> class PatchProcessingQueueTest(CommandsTest):
</span><span class="cx">     def test_upload_results_archive_for_patch(self):
</span><del>-        queue = PatchProcessingQueue()
</del><ins>+        queue = PatchProcessingQueue(host=MockHost())
</ins><span class="cx">         queue.name = &quot;mock-queue&quot;
</span><span class="cx">         tool = MockTool()
</span><span class="cx">         queue.bind_to_tool(tool)
</span><span class="lines">@@ -260,7 +270,7 @@
</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>-        self.assert_queue_outputs(CommitQueue(), tool=tool, expected_logs=expected_logs)
</del><ins>+        self.assert_queue_outputs(CommitQueue(host=MockHost()), tool=tool, expected_logs=expected_logs)
</ins><span class="cx"> 
</span><span class="cx">     def test_commit_queue_failure(self):
</span><span class="cx">         expected_logs = {
</span><span class="lines">@@ -276,7 +286,7 @@
</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><ins>+        queue = CommitQueue(host=MockHost())
</ins><span class="cx"> 
</span><span class="cx">         def mock_run_webkit_patch(command):
</span><span class="cx">             if command[0] == 'clean' or command[0] == 'update':
</span><span class="lines">@@ -308,7 +318,7 @@
</span><span class="cx">             def results_from_patch_test_run(self, patch):
</span><span class="cx">                 return LayoutTestResults([test_results.TestResult(&quot;mock_test_name.html&quot;, failures=[test_failures.FailureTextMismatch()])], did_exceed_test_failure_limit=False)
</span><span class="cx"> 
</span><del>-        queue = CommitQueue(MockCommitQueueTask)
</del><ins>+        queue = CommitQueue(MockCommitQueueTask, host=MockHost())
</ins><span class="cx"> 
</span><span class="cx">         def mock_run_webkit_patch(command):
</span><span class="cx">             if command[0] == 'clean' or command[0] == 'update':
</span><span class="lines">@@ -347,7 +357,7 @@
</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>-        self.assert_queue_outputs(CommitQueue(), tool=tool, expected_logs=expected_logs)
</del><ins>+        self.assert_queue_outputs(CommitQueue(host=MockHost()), tool=tool, expected_logs=expected_logs)
</ins><span class="cx"> 
</span><span class="cx">     def test_rollout_lands(self):
</span><span class="cx">         tool = MockTool()
</span><span class="lines">@@ -372,7 +382,7 @@
</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 '10005' with comment 'Rejecting attachment 10005 from commit-queue.\n\nMock error message'\n&quot;,
</span><span class="cx">         }
</span><del>-        self.assert_queue_outputs(CommitQueue(), tool=tool, work_item=rollout_patch, expected_logs=expected_logs)
</del><ins>+        self.assert_queue_outputs(CommitQueue(host=MockHost()), tool=tool, work_item=rollout_patch, expected_logs=expected_logs)
</ins><span class="cx"> 
</span><span class="cx">     def test_non_valid_patch(self):
</span><span class="cx">         tool = MockTool()
</span><span class="lines">@@ -383,10 +393,10 @@
</span><span class="cx"> MOCK: release_work_item: commit-queue 10007
</span><span class="cx"> &quot;&quot;&quot;,
</span><span class="cx">         }
</span><del>-        self.assert_queue_outputs(CommitQueue(), tool=tool, work_item=patch, expected_logs=expected_logs)
</del><ins>+        self.assert_queue_outputs(CommitQueue(host=MockHost()), tool=tool, work_item=patch, expected_logs=expected_logs)
</ins><span class="cx"> 
</span><span class="cx">     def test_auto_retry(self):
</span><del>-        queue = CommitQueue()
</del><ins>+        queue = CommitQueue(host=MockHost())
</ins><span class="cx">         options = Mock()
</span><span class="cx">         options.parent_command = &quot;commit-queue&quot;
</span><span class="cx">         tool = AlwaysCommitQueueTool()
</span><span class="lines">@@ -498,7 +508,7 @@
</span><span class="cx">             &quot;handle_script_error&quot;: &quot;MOCK output\n&quot;,
</span><span class="cx">         }
</span><span class="cx">         tool = MockTool(executive_throws_when_run=set(['check-style']))
</span><del>-        self.assert_queue_outputs(StyleQueue(), expected_logs=expected_logs, tool=tool)
</del><ins>+        self.assert_queue_outputs(StyleQueue(host=MockHost()), expected_logs=expected_logs, tool=tool)
</ins><span class="cx"> 
</span><span class="cx">     def test_style_queue_with_watch_list_exception(self):
</span><span class="cx">         expected_logs = {
</span><span class="lines">@@ -523,4 +533,4 @@
</span><span class="cx">             &quot;handle_script_error&quot;: &quot;MOCK output\n&quot;,
</span><span class="cx">         }
</span><span class="cx">         tool = MockTool(executive_throws_when_run=set(['apply-watchlist-local']))
</span><del>-        self.assert_queue_outputs(StyleQueue(), expected_logs=expected_logs, tool=tool)
</del><ins>+        self.assert_queue_outputs(StyleQueue(host=MockHost()), expected_logs=expected_logs, tool=tool)
</ins></span></pre>
</div>
</div>

</body>
</html>