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

Side by Side Diff: Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py

Issue 569913002: fix virtual_test_suites() for browser_test ports (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rework implementation of test_virtual_test_suites(), browser_test_unittest Created 6 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 10 matching lines...) Expand all
21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 28
29 """Unit testing base class for Port implementations.""" 29 """Unit testing base class for Port implementations."""
30 30
31 import collections
31 import errno 32 import errno
32 import logging 33 import logging
33 import os 34 import os
34 import socket 35 import socket
35 import sys 36 import sys
36 import time 37 import time
37 import unittest 38 import unittest
38 39
39 from webkitpy.common.system.executive_mock import MockExecutive, MockExecutive2 40 from webkitpy.common.system.executive_mock import MockExecutive, MockExecutive2
40 from webkitpy.common.system.filesystem_mock import MockFileSystem 41 from webkitpy.common.system.filesystem_mock import MockFileSystem
41 from webkitpy.common.system.outputcapture import OutputCapture 42 from webkitpy.common.system.outputcapture import OutputCapture
43 from webkitpy.common.system.systemhost import SystemHost
42 from webkitpy.common.system.systemhost_mock import MockSystemHost 44 from webkitpy.common.system.systemhost_mock import MockSystemHost
43 from webkitpy.layout_tests.models import test_run_results 45 from webkitpy.layout_tests.models import test_run_results
44 from webkitpy.layout_tests.port.base import Port, TestConfiguration 46 from webkitpy.layout_tests.port.base import Port, TestConfiguration
45 from webkitpy.layout_tests.port.server_process_mock import MockServerProcess 47 from webkitpy.layout_tests.port.server_process_mock import MockServerProcess
46 from webkitpy.tool.mocktool import MockOptions 48 from webkitpy.tool.mocktool import MockOptions
47 49
48 50
49 # FIXME: get rid of this fixture 51 # FIXME: get rid of this fixture
50 class TestWebKitPort(Port): 52 class TestWebKitPort(Port):
51 port_name = "testwebkitport" 53 port_name = "testwebkitport"
(...skipping 28 matching lines...) Expand all
80 class PortTestCase(unittest.TestCase): 82 class PortTestCase(unittest.TestCase):
81 """Tests that all Port implementations must pass.""" 83 """Tests that all Port implementations must pass."""
82 HTTP_PORTS = (8000, 8080, 8443) 84 HTTP_PORTS = (8000, 8080, 8443)
83 WEBSOCKET_PORTS = (8880,) 85 WEBSOCKET_PORTS = (8880,)
84 86
85 # Subclasses override this to point to their Port subclass. 87 # Subclasses override this to point to their Port subclass.
86 os_name = None 88 os_name = None
87 os_version = None 89 os_version = None
88 port_maker = TestWebKitPort 90 port_maker = TestWebKitPort
89 port_name = None 91 port_name = None
92 full_port_name = None
90 93
91 def make_port(self, host=None, port_name=None, options=None, os_name=None, o s_version=None, **kwargs): 94 def make_port(self, host=None, port_name=None, options=None, os_name=None, o s_version=None, **kwargs):
92 host = host or MockSystemHost(os_name=(os_name or self.os_name), os_vers ion=(os_version or self.os_version)) 95 host = host or MockSystemHost(os_name=(os_name or self.os_name), os_vers ion=(os_version or self.os_version))
93 options = options or MockOptions(configuration='Release') 96 options = options or MockOptions(configuration='Release')
94 port_name = port_name or self.port_name 97 port_name = port_name or self.port_name
95 port_name = self.port_maker.determine_full_port_name(host, options, port _name) 98 port_name = self.port_maker.determine_full_port_name(host, options, port _name)
96 port = self.port_maker(host, port_name, options=options, **kwargs) 99 port = self.port_maker(host, port_name, options=options, **kwargs)
97 port._config.build_directory = lambda configuration: '/mock-build' 100 port._config.build_directory = lambda configuration: '/mock-build'
98 return port 101 return port
99 102
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 saved_environ = os.environ.copy() 461 saved_environ = os.environ.copy()
459 try: 462 try:
460 os.environ['WEBKIT_HTTP_SERVER_CONF_PATH'] = '/existing/httpd.conf' 463 os.environ['WEBKIT_HTTP_SERVER_CONF_PATH'] = '/existing/httpd.conf'
461 self.assertEqual(port.path_to_apache_config_file(), '/existing/httpd .conf') 464 self.assertEqual(port.path_to_apache_config_file(), '/existing/httpd .conf')
462 finally: 465 finally:
463 os.environ = saved_environ.copy() 466 os.environ = saved_environ.copy()
464 467
465 def test_additional_platform_directory(self): 468 def test_additional_platform_directory(self):
466 port = self.make_port(options=MockOptions(additional_platform_directory= ['/tmp/foo'])) 469 port = self.make_port(options=MockOptions(additional_platform_directory= ['/tmp/foo']))
467 self.assertEqual(port.baseline_search_path()[0], '/tmp/foo') 470 self.assertEqual(port.baseline_search_path()[0], '/tmp/foo')
471
472 def test_virtual_test_suites(self):
473 # We test that we can load the real LayoutTests/VirtualTestSuites file p roperly, so we
474 # use a real SystemHost(). We don't care what virtual_test_suites() retu rns as long
475 # as it is iterable.
476 port = self.make_port(host=SystemHost(), port_name=self.full_port_name)
477 self.assertTrue(isinstance(port.virtual_test_suites(), collections.Itera ble))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698