| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |