Chromium Code Reviews| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 def make_wdiff_available(self, port): | 101 def make_wdiff_available(self, port): |
| 102 port._wdiff_available = True | 102 port._wdiff_available = True |
| 103 | 103 |
| 104 def test_check_build(self): | 104 def test_check_build(self): |
| 105 port = self.make_port() | 105 port = self.make_port() |
| 106 port._check_file_exists = lambda path, desc: True | 106 port._check_file_exists = lambda path, desc: True |
| 107 if port._dump_reader: | 107 if port._dump_reader: |
| 108 port._dump_reader.check_is_functional = lambda: True | 108 port._dump_reader.check_is_functional = lambda: True |
| 109 port._options.build = True | 109 port._options.build = True |
| 110 port._check_driver_build_up_to_date = lambda config: True | 110 port._check_driver_build_up_to_date = lambda config: True |
| 111 port.check_httpd = lambda: True | |
|
scottmg
2014/02/06 01:11:32
maybe just delete this? it looks like it's only us
Dirk Pranke
2014/02/06 01:32:11
Ah, bad merge; this'll be needed in a later patch.
| |
| 111 oc = OutputCapture() | 112 oc = OutputCapture() |
| 112 try: | 113 try: |
| 113 oc.capture_output() | 114 oc.capture_output() |
| 114 self.assertEqual(port.check_build(needs_http=True, printer=FakePrint er()), | 115 self.assertEqual(port.check_build(needs_http=True, printer=FakePrint er()), |
| 115 test_run_results.OK_EXIT_STATUS) | 116 test_run_results.OK_EXIT_STATUS) |
| 116 finally: | 117 finally: |
| 117 out, err, logs = oc.restore_output() | 118 out, err, logs = oc.restore_output() |
| 118 self.assertIn('pretty patches', logs) # We should get a warn ing about PrettyPatch being missing, | 119 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. | 120 self.assertNotIn('build requirements', logs) # but not the driver i tself. |
| 120 | 121 |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 147 port = self.make_port() | 148 port = self.make_port() |
| 148 self.assertTrue(len(port.driver_cmd_line())) | 149 self.assertTrue(len(port.driver_cmd_line())) |
| 149 | 150 |
| 150 options = MockOptions(additional_drt_flag=['--foo=bar', '--foo=baz']) | 151 options = MockOptions(additional_drt_flag=['--foo=bar', '--foo=baz']) |
| 151 port = self.make_port(options=options) | 152 port = self.make_port(options=options) |
| 152 cmd_line = port.driver_cmd_line() | 153 cmd_line = port.driver_cmd_line() |
| 153 self.assertTrue('--foo=bar' in cmd_line) | 154 self.assertTrue('--foo=bar' in cmd_line) |
| 154 self.assertTrue('--foo=baz' in cmd_line) | 155 self.assertTrue('--foo=baz' in cmd_line) |
| 155 | 156 |
| 156 def test_uses_apache(self): | 157 def test_uses_apache(self): |
| 157 self.assertTrue(self.make_port()._uses_apache()) | 158 self.assertTrue(self.make_port().uses_apache()) |
| 158 | 159 |
| 159 def assert_servers_are_down(self, host, ports): | 160 def assert_servers_are_down(self, host, ports): |
| 160 for port in ports: | 161 for port in ports: |
| 161 try: | 162 try: |
| 162 test_socket = socket.socket() | 163 test_socket = socket.socket() |
| 163 test_socket.connect((host, port)) | 164 test_socket.connect((host, port)) |
| 164 self.fail() | 165 self.fail() |
| 165 except IOError, e: | 166 except IOError, e: |
| 166 self.assertTrue(e.errno in (errno.ECONNREFUSED, errno.ECONNRESET )) | 167 self.assertTrue(e.errno in (errno.ECONNREFUSED, errno.ECONNRESET )) |
| 167 finally: | 168 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') | 442 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. | 443 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' ) | 444 self._assert_config_file_for_platform(port, 'barf', 'apache2-httpd.conf' ) |
| 444 | 445 |
| 445 def test_path_to_apache_config_file(self): | 446 def test_path_to_apache_config_file(self): |
| 446 port = TestWebKitPort() | 447 port = TestWebKitPort() |
| 447 | 448 |
| 448 saved_environ = os.environ.copy() | 449 saved_environ = os.environ.copy() |
| 449 try: | 450 try: |
| 450 os.environ['WEBKIT_HTTP_SERVER_CONF_PATH'] = '/path/to/httpd.conf' | 451 os.environ['WEBKIT_HTTP_SERVER_CONF_PATH'] = '/path/to/httpd.conf' |
| 451 self.assertRaises(IOError, port._path_to_apache_config_file) | 452 self.assertRaises(IOError, port.path_to_apache_config_file) |
| 452 port._filesystem.write_text_file('/existing/httpd.conf', 'Hello, wor ld!') | 453 port._filesystem.write_text_file('/existing/httpd.conf', 'Hello, wor ld!') |
| 453 os.environ['WEBKIT_HTTP_SERVER_CONF_PATH'] = '/existing/httpd.conf' | 454 os.environ['WEBKIT_HTTP_SERVER_CONF_PATH'] = '/existing/httpd.conf' |
| 454 self.assertEqual(port._path_to_apache_config_file(), '/existing/http d.conf') | 455 self.assertEqual(port.path_to_apache_config_file(), '/existing/httpd .conf') |
| 455 finally: | 456 finally: |
| 456 os.environ = saved_environ.copy() | 457 os.environ = saved_environ.copy() |
| 457 | 458 |
| 458 # Mock out _apache_config_file_name_for_platform to ignore the passed sy s.platform value. | 459 # 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' | 460 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') | 461 self.assertEqual(port.path_to_apache_config_file(), '/mock-checkout/thir d_party/WebKit/LayoutTests/http/conf/httpd.conf') |
| 461 | 462 |
| 462 # Check that even if we mock out _apache_config_file_name, the environme nt variable takes precedence. | 463 # Check that even if we mock out _apache_config_file_name, the environme nt variable takes precedence. |
| 463 saved_environ = os.environ.copy() | 464 saved_environ = os.environ.copy() |
| 464 try: | 465 try: |
| 465 os.environ['WEBKIT_HTTP_SERVER_CONF_PATH'] = '/existing/httpd.conf' | 466 os.environ['WEBKIT_HTTP_SERVER_CONF_PATH'] = '/existing/httpd.conf' |
| 466 self.assertEqual(port._path_to_apache_config_file(), '/existing/http d.conf') | 467 self.assertEqual(port.path_to_apache_config_file(), '/existing/httpd .conf') |
| 467 finally: | 468 finally: |
| 468 os.environ = saved_environ.copy() | 469 os.environ = saved_environ.copy() |
| 469 | 470 |
| 470 def test_additional_platform_directory(self): | 471 def test_additional_platform_directory(self): |
| 471 port = self.make_port(options=MockOptions(additional_platform_directory= ['/tmp/foo'])) | 472 port = self.make_port(options=MockOptions(additional_platform_directory= ['/tmp/foo'])) |
| 472 self.assertEqual(port.baseline_search_path()[0], '/tmp/foo') | 473 self.assertEqual(port.baseline_search_path()[0], '/tmp/foo') |
| OLD | NEW |