Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1156)

Unified Diff: Tools/Scripts/webkitpy/tool/servers/gardeningserver_unittest.py

Issue 351873005: Remove support for local garden-o-matic (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Tools/Scripts/webkitpy/tool/servers/gardeningserver_unittest.py
diff --git a/Tools/Scripts/webkitpy/tool/servers/gardeningserver_unittest.py b/Tools/Scripts/webkitpy/tool/servers/gardeningserver_unittest.py
deleted file mode 100644
index b4db5f52c670c3f371bf183fdadb783274601ddb..0000000000000000000000000000000000000000
--- a/Tools/Scripts/webkitpy/tool/servers/gardeningserver_unittest.py
+++ /dev/null
@@ -1,136 +0,0 @@
-# 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
-# "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 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 json
-import sys
-import webkitpy.thirdparty.unittest2 as unittest
-
-from webkitpy.common.system.outputcapture import OutputCapture
-from webkitpy.layout_tests.models.test_configuration import *
-from webkitpy.layout_tests.port import builders
-from webkitpy.thirdparty.mock import Mock
-from webkitpy.tool.mocktool import MockTool
-from webkitpy.common.system.executive_mock import MockExecutive
-from webkitpy.common.host_mock import MockHost
-from webkitpy.tool.servers.gardeningserver import *
-
-
-class TestPortFactory(object):
- # FIXME: Why is this a class method?
- @classmethod
- def create(cls):
- host = MockHost()
- return host.port_factory.get("test-win-xp")
-
- @classmethod
- def path_to_generic_test_expectations_file(cls):
- return cls.create().path_to_generic_test_expectations_file()
-
-
-class MockServer(object):
- def __init__(self):
- self.tool = MockTool()
- self.tool.executive = MockExecutive(should_log=True)
- self.tool.filesystem.files[TestPortFactory.path_to_generic_test_expectations_file()] = ""
-
-
-# The real GardeningHTTPRequestHandler has a constructor that's too hard to
-# call in a unit test, so we create a subclass that's easier to construct.
-class TestGardeningHTTPRequestHandler(GardeningHTTPRequestHandler):
- def __init__(self, server):
- self.server = server
- self.body = None
-
- def _expectations_updater(self):
- return GardeningExpectationsUpdater(self.server.tool, TestPortFactory.create())
-
- def read_entity_body(self):
- return self.body if self.body else ''
-
- def _serve_text(self, text):
- print "== Begin Response =="
- print text
- print "== End Response =="
-
- def _serve_json(self, json_object):
- print "== Begin JSON Response =="
- print json.dumps(json_object)
- print "== End JSON Response =="
-
- def _serve_xml(self, xml):
- print "== Begin XML Response =="
- print xml
- print "== End XML Response =="
-
-class GardeningServerTest(unittest.TestCase):
- def _post_to_path(self, path, body=None, expected_stderr=None, expected_stdout=None, server=None):
- handler = TestGardeningHTTPRequestHandler(server or MockServer())
- handler.path = path
- handler.body = body
- OutputCapture().assert_outputs(self, handler.do_POST, expected_stderr=expected_stderr, expected_stdout=expected_stdout)
-
- def test_svnlog(self):
- expected_stderr = ''
- expected_stdout = '== Begin XML Response ==\nMOCK output of child process\n== End XML Response ==\n'
- self._post_to_path('/svnlog', expected_stderr=expected_stderr, expected_stdout=expected_stdout)
-
- def test_lastroll(self):
- expected_stderr = 'MOCK run_command: [\'svn\', \'cat\', \'http://src.chromium.org/chrome/trunk/src/DEPS\'], cwd=None, input=None\n'
- expected_stdout = '== Begin Response ==\n1\n== End Response ==\n'
- server = MockServer()
-
- self.output = [' "webkit_revision": "3",', 'lol']
-
- def run_command(args, cwd=None, input=None, **kwargs):
- print >> sys.stderr, "MOCK run_command: %s, cwd=%s, input=%s" % (args, cwd, input)
- return self.output.pop(0)
-
- server.tool.executive.run_command = run_command
- self._post_to_path('/lastroll', expected_stderr=expected_stderr, expected_stdout='== Begin Response ==\n3\n== End Response ==\n', server=server)
- self._post_to_path('/lastroll', expected_stderr=expected_stderr, expected_stdout='== Begin Response ==\n0\n== End Response ==\n', server=server)
-
- def disabled_test_rollout(self):
- expected_stderr = "MOCK run_command: ['echo', 'rollout', '--force-clean', '--non-interactive', '2314', 'MOCK rollout reason'], cwd=/mock-checkout\n"
- expected_stdout = "== Begin Response ==\nsuccess\n== End Response ==\n"
- self._post_to_path("/rollout?revision=2314&reason=MOCK+rollout+reason", expected_stderr=expected_stderr, expected_stdout=expected_stdout)
-
- def disabled_test_rebaselineall(self):
- expected_stderr = "MOCK run_command: ['echo', 'rebaseline-json'], cwd=/mock-checkout, input={\"user-scripts/another-test.html\":{\"%s\": [%s]}}\n"
- expected_stdout = "== Begin Response ==\n{result_code: 0}\n== End Response ==\n"
- server = MockServer()
-
- self.output = ['{"add": [], "delete": []}', '']
-
- def run_command(args, cwd=None, input=None, **kwargs):
- print >> sys.stderr, "MOCK run_command: %s, cwd=%s, input=%s" % (args, cwd, input)
- return self.output.pop(0)
-
- server.tool.executive.run_command = run_command
- self._post_to_path("/rebaselineall", body='{"user-scripts/another-test.html":{"MOCK builder": ["txt","png"]}}', expected_stderr=expected_stderr % ('MOCK builder', '"txt","png"'), expected_stdout=expected_stdout, server=server)
-
- self._post_to_path("/rebaselineall", body='{"user-scripts/another-test.html":{"MOCK builder (Debug)": ["txt","png"]}}', expected_stderr=expected_stderr % ('MOCK builder (Debug)', '"txt","png"'), expected_stdout=expected_stdout)

Powered by Google App Engine
This is Rietveld 408576698