Commit 95bc63ed authored by dpranke@chromium.org's avatar dpranke@chromium.org

Fix virtual_test_suites() for browser_test ports

In r181420 we started pulling the list of virtual test suites to run
from LayoutTests/VirtualTestSuites (a new file). The browser_test ports
do not pull their tests from that directory, and need a different list
of suites, but I forgot to override the port.virtual_test_suites() call
in their implementations.

The browser_test ports don't currently need or have any virtual test suites,
so this patch implements returning an empty list and adds tests to ensure
that we would catch this regression if it happened again.

We also rework the browser_test_unittest.py tests to eliminate a bunch of duplication and make it clearer that the tests are shared and testing the same behavior.

TBR=thestig@chromium.org
BUG=413986

Review URL: https://codereview.chromium.org/569913002

git-svn-id: svn://svn.chromium.org/blink/trunk@181962 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 3f51a080
......@@ -71,6 +71,9 @@ class BrowserTestPortOverrides(object):
return 3 * timeout_ms
return timeout_ms
def virtual_test_suites(self):
return []
class BrowserTestLinuxPort(BrowserTestPortOverrides, linux.LinuxPort):
pass
......
......@@ -38,78 +38,58 @@ from webkitpy.layout_tests.port import port_testcase
from webkitpy.layout_tests.port import browser_test_driver
class BrowserTestLinuxTest(port_testcase.PortTestCase):
port_name = 'linux'
port_maker = browser_test.BrowserTestLinuxPort
class _BrowserTestTestCaseMixin(object):
def test_check_sys_deps(self):
port = self.make_port()
port._executive = MockExecutive2(exit_code=0)
self.assertEqual(port.check_sys_deps(needs_http=False), test_run_results.OK_EXIT_STATUS)
def test_driver_name_option(self):
self.assertTrue(self.make_port(options=MockOptions(driver_name='browser_tests'))._path_to_driver().endswith('browser_tests'))
self.assertTrue(self.make_port()._path_to_driver().endswith(self.driver_name_endswith))
def test_layout_tests_dir(self):
self.assertTrue(self.make_port().layout_tests_dir().endswith('chrome/test/data/printing/layout_tests'))
def test_default_timeout_ms(self):
self.assertEqual(self.make_port(options=MockOptions(configuration='Release')).default_timeout_ms(),
self.timeout_ms)
self.assertEqual(self.make_port(options=MockOptions(configuration='Debug')).default_timeout_ms(),
3 * self.timeout_ms)
def test_driver_type(self):
self.assertTrue(isinstance(self.make_port(options=MockOptions(driver_name='browser_tests')).create_driver(1), browser_test_driver.BrowserTestDriver))
def test_check_sys_deps(self):
def test_layout_tests_dir(self):
self.assertTrue(self.make_port().layout_tests_dir().endswith('chrome/test/data/printing/layout_tests'))
def test_virtual_test_suites(self):
# The browser_tests port do not use virtual test suites, so we are just testing the stub.
port = self.make_port()
port._executive = MockExecutive2(exit_code=0)
self.assertEqual(port.check_sys_deps(needs_http=False), test_run_results.OK_EXIT_STATUS)
self.assertEqual(port.virtual_test_suites(), [])
def test_default_timeout_ms(self):
self.assertEqual(self.make_port(options=MockOptions(configuration='Release')).default_timeout_ms(), 10000)
self.assertEqual(self.make_port(options=MockOptions(configuration='Debug')).default_timeout_ms(), 30000)
class BrowserTestLinuxTest(_BrowserTestTestCaseMixin, port_testcase.PortTestCase):
port_name = 'linux'
port_maker = browser_test.BrowserTestLinuxPort
driver_name_endswith = 'browser_tests'
timeout_ms = 10 * 1000
class BrowserTestWinTest(port_testcase.PortTestCase):
class BrowserTestWinTest(_BrowserTestTestCaseMixin, port_testcase.PortTestCase):
port_name = 'win'
port_maker = browser_test.BrowserTestWinPort
os_name = 'win'
os_version = 'xp'
driver_name_endswith = 'browser_tests.exe'
timeout_ms = 20 * 1000
def test_driver_name_option(self):
self.assertTrue(self.make_port(options=MockOptions(driver_name='browser_tests'))._path_to_driver().endswith('browser_tests.exe'))
def test_layout_tests_dir(self):
self.assertTrue(self.make_port().layout_tests_dir().endswith('chrome/test/data/printing/layout_tests'))
def test_driver_type(self):
self.assertTrue(isinstance(self.make_port(options=MockOptions(driver_name='browser_tests')).create_driver(1), browser_test_driver.BrowserTestDriver))
def test_check_sys_deps(self):
port = self.make_port()
port._executive = MockExecutive2(exit_code=0)
self.assertEqual(port.check_sys_deps(needs_http=False), test_run_results.OK_EXIT_STATUS)
def test_default_timeout_ms(self):
self.assertEqual(self.make_port(options=MockOptions(configuration='Release')).default_timeout_ms(), 20000)
self.assertEqual(self.make_port(options=MockOptions(configuration='Debug')).default_timeout_ms(), 60000)
class BrowserTestMacTest(port_testcase.PortTestCase):
class BrowserTestMacTest(_BrowserTestTestCaseMixin, port_testcase.PortTestCase):
os_name = 'mac'
os_version = 'snowleopard'
port_name = 'mac'
port_maker = browser_test.BrowserTestMacPort
def test_driver_name_option(self):
self.assertTrue(self.make_port(options=MockOptions(driver_name='browser_tests'))._path_to_driver().endswith('browser_tests'))
def test_layout_tests_dir(self):
self.assertTrue(self.make_port().layout_tests_dir().endswith('chrome/test/data/printing/layout_tests'))
def test_driver_type(self):
self.assertTrue(isinstance(self.make_port(options=MockOptions(driver_name='browser_tests')).create_driver(1), browser_test_driver.BrowserTestDriver))
driver_name_endswith = 'browser_tests'
timeout_ms = 20 * 1000
def test_driver_path(self):
test_port = self.make_port(options=MockOptions(driver_name='browser_tests'))
self.assertFalse('.app/Contents/MacOS' in test_port._path_to_driver())
def test_check_sys_deps(self):
port = self.make_port()
port._executive = MockExecutive2(exit_code=0)
self.assertEqual(port.check_sys_deps(needs_http=False), test_run_results.OK_EXIT_STATUS)
def test_default_timeout_ms(self):
self.assertEqual(self.make_port(options=MockOptions(configuration='Release')).default_timeout_ms(), 20000)
self.assertEqual(self.make_port(options=MockOptions(configuration='Debug')).default_timeout_ms(), 60000)
......@@ -38,6 +38,7 @@ from webkitpy.layout_tests.port import port_testcase
class LinuxPortTest(port_testcase.PortTestCase):
port_name = 'linux'
full_port_name = 'linux-x86'
port_maker = linux.LinuxPort
def assert_architecture(self, port_name=None, file_output=None, expected_architecture=None):
......
......@@ -37,6 +37,7 @@ class MacPortTest(port_testcase.PortTestCase):
os_name = 'mac'
os_version = 'snowleopard'
port_name = 'mac'
full_port_name = 'mac-snowleopard'
port_maker = mac.MacPort
def assert_name(self, port_name, os_version_string, expected):
......
......@@ -77,6 +77,9 @@ class MockDRTPortTest(port_testcase.PortTestCase):
def test_check_build(self):
pass
def test_virtual_test_suites(self):
pass
class MockDRTTest(unittest.TestCase):
def input_line(self, port, test_name, pixel_tests, checksum=None):
......
......@@ -28,6 +28,7 @@
"""Unit testing base class for Port implementations."""
import collections
import errno
import logging
import os
......@@ -39,6 +40,7 @@ import unittest
from webkitpy.common.system.executive_mock import MockExecutive, MockExecutive2
from webkitpy.common.system.filesystem_mock import MockFileSystem
from webkitpy.common.system.outputcapture import OutputCapture
from webkitpy.common.system.systemhost import SystemHost
from webkitpy.common.system.systemhost_mock import MockSystemHost
from webkitpy.layout_tests.models import test_run_results
from webkitpy.layout_tests.port.base import Port, TestConfiguration
......@@ -87,6 +89,7 @@ class PortTestCase(unittest.TestCase):
os_version = None
port_maker = TestWebKitPort
port_name = None
full_port_name = None
def make_port(self, host=None, port_name=None, options=None, os_name=None, os_version=None, **kwargs):
host = host or MockSystemHost(os_name=(os_name or self.os_name), os_version=(os_version or self.os_version))
......@@ -465,3 +468,10 @@ class PortTestCase(unittest.TestCase):
def test_additional_platform_directory(self):
port = self.make_port(options=MockOptions(additional_platform_directory=['/tmp/foo']))
self.assertEqual(port.baseline_search_path()[0], '/tmp/foo')
def test_virtual_test_suites(self):
# We test that we can load the real LayoutTests/VirtualTestSuites file properly, so we
# use a real SystemHost(). We don't care what virtual_test_suites() returns as long
# as it is iterable.
port = self.make_port(host=SystemHost(), port_name=self.full_port_name)
self.assertTrue(isinstance(port.virtual_test_suites(), collections.Iterable))
......@@ -39,6 +39,7 @@ from webkitpy.tool.mocktool import MockOptions
class WinPortTest(port_testcase.PortTestCase):
port_name = 'win'
full_port_name = 'win-xp'
port_maker = win.WinPort
os_name = 'win'
os_version = 'xp'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment