| OLD | NEW |
| 1 # Copyright (C) 2010 Google Inc. All rights reserved. | 1 # Copyright (C) 2010 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 import time | 36 import time |
| 37 import webkitpy.thirdparty.unittest2 as unittest | 37 import webkitpy.thirdparty.unittest2 as unittest |
| 38 | 38 |
| 39 from webkitpy.common.system.executive_mock import MockExecutive, MockExecutive2 | 39 from webkitpy.common.system.executive_mock import MockExecutive, MockExecutive2 |
| 40 from webkitpy.common.system.filesystem_mock import MockFileSystem | 40 from webkitpy.common.system.filesystem_mock import MockFileSystem |
| 41 from webkitpy.common.system.outputcapture import OutputCapture | 41 from webkitpy.common.system.outputcapture import OutputCapture |
| 42 from webkitpy.common.system.systemhost_mock import MockSystemHost | 42 from webkitpy.common.system.systemhost_mock import MockSystemHost |
| 43 from webkitpy.layout_tests.models import test_run_results | 43 from webkitpy.layout_tests.models import test_run_results |
| 44 from webkitpy.layout_tests.port.base import Port, TestConfiguration | 44 from webkitpy.layout_tests.port.base import Port, TestConfiguration |
| 45 from webkitpy.layout_tests.port.server_process_mock import MockServerProcess | 45 from webkitpy.layout_tests.port.server_process_mock import MockServerProcess |
| 46 from webkitpy.layout_tests.servers import http_server_base | |
| 47 from webkitpy.tool.mocktool import MockOptions | 46 from webkitpy.tool.mocktool import MockOptions |
| 48 | 47 |
| 49 | 48 |
| 50 # FIXME: get rid of this fixture | 49 # FIXME: get rid of this fixture |
| 51 class TestWebKitPort(Port): | 50 class TestWebKitPort(Port): |
| 52 port_name = "testwebkitport" | 51 port_name = "testwebkitport" |
| 53 | 52 |
| 54 def __init__(self, port_name=None, symbols_string=None, | 53 def __init__(self, port_name=None, symbols_string=None, |
| 55 expectations_file=None, skips_file=None, host=None, config=None
, | 54 expectations_file=None, skips_file=None, host=None, config=None
, |
| 56 **kwargs): | 55 **kwargs): |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 def make_wdiff_available(self, port): | 100 def make_wdiff_available(self, port): |
| 102 port._wdiff_available = True | 101 port._wdiff_available = True |
| 103 | 102 |
| 104 def test_check_build(self): | 103 def test_check_build(self): |
| 105 port = self.make_port() | 104 port = self.make_port() |
| 106 port._check_file_exists = lambda path, desc: True | 105 port._check_file_exists = lambda path, desc: True |
| 107 if port._dump_reader: | 106 if port._dump_reader: |
| 108 port._dump_reader.check_is_functional = lambda: True | 107 port._dump_reader.check_is_functional = lambda: True |
| 109 port._options.build = True | 108 port._options.build = True |
| 110 port._check_driver_build_up_to_date = lambda config: True | 109 port._check_driver_build_up_to_date = lambda config: True |
| 110 port.check_httpd = lambda: True |
| 111 oc = OutputCapture() | 111 oc = OutputCapture() |
| 112 try: | 112 try: |
| 113 oc.capture_output() | 113 oc.capture_output() |
| 114 self.assertEqual(port.check_build(needs_http=True, printer=FakePrint
er()), | 114 self.assertEqual(port.check_build(needs_http=True, printer=FakePrint
er()), |
| 115 test_run_results.OK_EXIT_STATUS) | 115 test_run_results.OK_EXIT_STATUS) |
| 116 finally: | 116 finally: |
| 117 out, err, logs = oc.restore_output() | 117 out, err, logs = oc.restore_output() |
| 118 self.assertIn('pretty patches', logs) # We should get a warn
ing about PrettyPatch being missing, | 118 self.assertIn('pretty patches', logs) # We should get a warn
ing about PrettyPatch being missing, |
| 119 self.assertNotIn('build requirements', logs) # but not the driver i
tself. | 119 self.assertNotIn('build requirements', logs) # but not the driver i
tself. |
| 120 | 120 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 147 port = self.make_port() | 147 port = self.make_port() |
| 148 self.assertTrue(len(port.driver_cmd_line())) | 148 self.assertTrue(len(port.driver_cmd_line())) |
| 149 | 149 |
| 150 options = MockOptions(additional_drt_flag=['--foo=bar', '--foo=baz']) | 150 options = MockOptions(additional_drt_flag=['--foo=bar', '--foo=baz']) |
| 151 port = self.make_port(options=options) | 151 port = self.make_port(options=options) |
| 152 cmd_line = port.driver_cmd_line() | 152 cmd_line = port.driver_cmd_line() |
| 153 self.assertTrue('--foo=bar' in cmd_line) | 153 self.assertTrue('--foo=bar' in cmd_line) |
| 154 self.assertTrue('--foo=baz' in cmd_line) | 154 self.assertTrue('--foo=baz' in cmd_line) |
| 155 | 155 |
| 156 def test_uses_apache(self): | 156 def test_uses_apache(self): |
| 157 self.assertTrue(self.make_port()._uses_apache()) | 157 self.assertTrue(self.make_port().uses_apache()) |
| 158 | 158 |
| 159 def assert_servers_are_down(self, host, ports): | 159 def assert_servers_are_down(self, host, ports): |
| 160 for port in ports: | 160 for port in ports: |
| 161 try: | 161 try: |
| 162 test_socket = socket.socket() | 162 test_socket = socket.socket() |
| 163 test_socket.connect((host, port)) | 163 test_socket.connect((host, port)) |
| 164 self.fail() | 164 self.fail() |
| 165 except IOError, e: | 165 except IOError, e: |
| 166 self.assertTrue(e.errno in (errno.ECONNREFUSED, errno.ECONNRESET
)) | 166 self.assertTrue(e.errno in (errno.ECONNREFUSED, errno.ECONNRESET
)) |
| 167 finally: | 167 finally: |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 self._assert_config_file_for_platform(port, 'mac', 'apache2-httpd.conf') | 441 self._assert_config_file_for_platform(port, 'mac', 'apache2-httpd.conf') |
| 442 self._assert_config_file_for_platform(port, 'win32', 'apache2-httpd.conf
') # win32 isn't a supported sys.platform. AppleWin/WinCairo/WinCE ports all u
se cygwin. | 442 self._assert_config_file_for_platform(port, 'win32', 'apache2-httpd.conf
') # win32 isn't a supported sys.platform. AppleWin/WinCairo/WinCE ports all u
se cygwin. |
| 443 self._assert_config_file_for_platform(port, 'barf', 'apache2-httpd.conf'
) | 443 self._assert_config_file_for_platform(port, 'barf', 'apache2-httpd.conf'
) |
| 444 | 444 |
| 445 def test_path_to_apache_config_file(self): | 445 def test_path_to_apache_config_file(self): |
| 446 port = TestWebKitPort() | 446 port = TestWebKitPort() |
| 447 | 447 |
| 448 saved_environ = os.environ.copy() | 448 saved_environ = os.environ.copy() |
| 449 try: | 449 try: |
| 450 os.environ['WEBKIT_HTTP_SERVER_CONF_PATH'] = '/path/to/httpd.conf' | 450 os.environ['WEBKIT_HTTP_SERVER_CONF_PATH'] = '/path/to/httpd.conf' |
| 451 self.assertRaises(IOError, port._path_to_apache_config_file) | 451 self.assertRaises(IOError, port.path_to_apache_config_file) |
| 452 port._filesystem.write_text_file('/existing/httpd.conf', 'Hello, wor
ld!') | 452 port._filesystem.write_text_file('/existing/httpd.conf', 'Hello, wor
ld!') |
| 453 os.environ['WEBKIT_HTTP_SERVER_CONF_PATH'] = '/existing/httpd.conf' | 453 os.environ['WEBKIT_HTTP_SERVER_CONF_PATH'] = '/existing/httpd.conf' |
| 454 self.assertEqual(port._path_to_apache_config_file(), '/existing/http
d.conf') | 454 self.assertEqual(port.path_to_apache_config_file(), '/existing/httpd
.conf') |
| 455 finally: | 455 finally: |
| 456 os.environ = saved_environ.copy() | 456 os.environ = saved_environ.copy() |
| 457 | 457 |
| 458 # Mock out _apache_config_file_name_for_platform to ignore the passed sy
s.platform value. | 458 # Mock out _apache_config_file_name_for_platform to ignore the passed sy
s.platform value. |
| 459 port._apache_config_file_name_for_platform = lambda platform: 'httpd.con
f' | 459 port._apache_config_file_name_for_platform = lambda platform: 'httpd.con
f' |
| 460 self.assertEqual(port._path_to_apache_config_file(), '/mock-checkout/thi
rd_party/WebKit/LayoutTests/http/conf/httpd.conf') | 460 self.assertEqual(port.path_to_apache_config_file(), '/mock-checkout/thir
d_party/WebKit/LayoutTests/http/conf/httpd.conf') |
| 461 | 461 |
| 462 # Check that even if we mock out _apache_config_file_name, the environme
nt variable takes precedence. | 462 # Check that even if we mock out _apache_config_file_name, the environme
nt variable takes precedence. |
| 463 saved_environ = os.environ.copy() | 463 saved_environ = os.environ.copy() |
| 464 try: | 464 try: |
| 465 os.environ['WEBKIT_HTTP_SERVER_CONF_PATH'] = '/existing/httpd.conf' | 465 os.environ['WEBKIT_HTTP_SERVER_CONF_PATH'] = '/existing/httpd.conf' |
| 466 self.assertEqual(port._path_to_apache_config_file(), '/existing/http
d.conf') | 466 self.assertEqual(port.path_to_apache_config_file(), '/existing/httpd
.conf') |
| 467 finally: | 467 finally: |
| 468 os.environ = saved_environ.copy() | 468 os.environ = saved_environ.copy() |
| 469 | 469 |
| 470 def test_additional_platform_directory(self): | 470 def test_additional_platform_directory(self): |
| 471 port = self.make_port(options=MockOptions(additional_platform_directory=
['/tmp/foo'])) | 471 port = self.make_port(options=MockOptions(additional_platform_directory=
['/tmp/foo'])) |
| 472 self.assertEqual(port.baseline_search_path()[0], '/tmp/foo') | 472 self.assertEqual(port.baseline_search_path()[0], '/tmp/foo') |
| OLD | NEW |