| Index: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py
|
| diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py
|
| index 4306a205ef11389d5f6bbe751f3edef3f4de2172..567ab22f29ccd6bd473b4e7d5e1136738fe543ec 100644
|
| --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py
|
| +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py
|
| @@ -25,7 +25,6 @@
|
| # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| -
|
| """Unit testing base class for Port implementations."""
|
|
|
| import collections
|
| @@ -52,8 +51,13 @@ from webkitpy.tool.mocktool import MockOptions
|
| class TestWebKitPort(Port):
|
| port_name = "testwebkitport"
|
|
|
| - def __init__(self, port_name=None, symbols_string=None,
|
| - expectations_file=None, skips_file=None, host=None, config=None,
|
| + def __init__(self,
|
| + port_name=None,
|
| + symbols_string=None,
|
| + expectations_file=None,
|
| + skips_file=None,
|
| + host=None,
|
| + config=None,
|
| **kwargs):
|
| port_name = port_name or TestWebKitPort.port_name
|
| self.symbols_string = symbols_string # Passing "" disables all staticly-detectable features.
|
| @@ -78,11 +82,10 @@ class FakePrinter(object):
|
| pass
|
|
|
|
|
| -
|
| class PortTestCase(unittest.TestCase):
|
| """Tests that all Port implementations must pass."""
|
| HTTP_PORTS = (8000, 8080, 8443)
|
| - WEBSOCKET_PORTS = (8880,)
|
| + WEBSOCKET_PORTS = (8880, )
|
|
|
| # Subclasses override this to point to their Port subclass.
|
| os_name = None
|
| @@ -114,22 +117,23 @@ class PortTestCase(unittest.TestCase):
|
| oc = OutputCapture()
|
| try:
|
| oc.capture_output()
|
| - self.assertEqual(port.check_build(needs_http=True, printer=FakePrinter()),
|
| - test_run_results.OK_EXIT_STATUS)
|
| + self.assertEqual(port.check_build(needs_http=True, printer=FakePrinter()), test_run_results.OK_EXIT_STATUS)
|
| finally:
|
| out, err, logs = oc.restore_output()
|
| - self.assertIn('pretty patches', logs) # We should get a warning about PrettyPatch being missing,
|
| + self.assertIn('pretty patches', logs) # We should get a warning about PrettyPatch being missing,
|
| self.assertNotIn('build requirements', logs) # but not the driver itself.
|
|
|
| port._check_file_exists = lambda path, desc: False
|
| port._check_driver_build_up_to_date = lambda config: False
|
| try:
|
| oc.capture_output()
|
| - self.assertEqual(port.check_build(needs_http=True, printer=FakePrinter()),
|
| - test_run_results.UNEXPECTED_ERROR_EXIT_STATUS)
|
| + self.assertEqual(
|
| + port.check_build(needs_http=True,
|
| + printer=FakePrinter()),
|
| + test_run_results.UNEXPECTED_ERROR_EXIT_STATUS)
|
| finally:
|
| out, err, logs = oc.restore_output()
|
| - self.assertIn('pretty patches', logs) # And, here we should get warnings about both.
|
| + self.assertIn('pretty patches', logs) # And, here we should get warnings about both.
|
| self.assertIn('build requirements', logs)
|
|
|
| def test_default_batch_size(self):
|
| @@ -241,7 +245,8 @@ class PortTestCase(unittest.TestCase):
|
| def test_diff_image_crashed(self):
|
| port = self.make_port()
|
| port._executive = MockExecutive2(exit_code=2)
|
| - self.assertEqual(port.diff_image("EXPECTED", "ACTUAL"), (None, 'Image diff returned an exit code of 2. See http://crbug.com/278596'))
|
| + self.assertEqual(
|
| + port.diff_image("EXPECTED", "ACTUAL"), (None, 'Image diff returned an exit code of 2. See http://crbug.com/278596'))
|
|
|
| def test_check_wdiff(self):
|
| port = self.make_port()
|
| @@ -277,29 +282,45 @@ class PortTestCase(unittest.TestCase):
|
|
|
| def test_get_crash_log(self):
|
| port = self.make_port()
|
| - self.assertEqual(port._get_crash_log(None, None, None, None, newer_than=None),
|
| - (None,
|
| - 'crash log for <unknown process name> (pid <unknown>):\n'
|
| - 'STDOUT: <empty>\n'
|
| - 'STDERR: <empty>\n'))
|
| -
|
| - self.assertEqual(port._get_crash_log('foo', 1234, 'out bar\nout baz', 'err bar\nerr baz\n', newer_than=None),
|
| - ('err bar\nerr baz\n',
|
| - 'crash log for foo (pid 1234):\n'
|
| + self.assertEqual(
|
| + port._get_crash_log(None,
|
| + None,
|
| + None,
|
| + None,
|
| + newer_than=None),
|
| + (None, 'crash log for <unknown process name> (pid <unknown>):\n'
|
| + 'STDOUT: <empty>\n'
|
| + 'STDERR: <empty>\n'))
|
| +
|
| + self.assertEqual(
|
| + port._get_crash_log('foo',
|
| + 1234,
|
| + 'out bar\nout baz',
|
| + 'err bar\nerr baz\n',
|
| + newer_than=None),
|
| + ('err bar\nerr baz\n', 'crash log for foo (pid 1234):\n'
|
| 'STDOUT: out bar\n'
|
| 'STDOUT: out baz\n'
|
| 'STDERR: err bar\n'
|
| 'STDERR: err baz\n'))
|
|
|
| - self.assertEqual(port._get_crash_log('foo', 1234, 'foo\xa6bar', 'foo\xa6bar', newer_than=None),
|
| - ('foo\xa6bar',
|
| - u'crash log for foo (pid 1234):\n'
|
| + self.assertEqual(
|
| + port._get_crash_log('foo',
|
| + 1234,
|
| + 'foo\xa6bar',
|
| + 'foo\xa6bar',
|
| + newer_than=None),
|
| + ('foo\xa6bar', u'crash log for foo (pid 1234):\n'
|
| u'STDOUT: foo\ufffdbar\n'
|
| u'STDERR: foo\ufffdbar\n'))
|
|
|
| - self.assertEqual(port._get_crash_log('foo', 1234, 'foo\xa6bar', 'foo\xa6bar', newer_than=1.0),
|
| - ('foo\xa6bar',
|
| - u'crash log for foo (pid 1234):\n'
|
| + self.assertEqual(
|
| + port._get_crash_log('foo',
|
| + 1234,
|
| + 'foo\xa6bar',
|
| + 'foo\xa6bar',
|
| + newer_than=1.0),
|
| + ('foo\xa6bar', u'crash log for foo (pid 1234):\n'
|
| u'STDOUT: foo\ufffdbar\n'
|
| u'STDERR: foo\ufffdbar\n'))
|
|
|
| @@ -319,27 +340,23 @@ class PortTestCase(unittest.TestCase):
|
| never_fix_tests_path = port._filesystem.join(port.layout_tests_dir(), 'NeverFixTests')
|
| stale_tests_path = port._filesystem.join(port.layout_tests_dir(), 'StaleTestExpectations')
|
| slow_tests_path = port._filesystem.join(port.layout_tests_dir(), 'SlowTests')
|
| - skia_overrides_path = port.path_from_chromium_base(
|
| - 'skia', 'skia_test_expectations.txt')
|
| + skia_overrides_path = port.path_from_chromium_base('skia', 'skia_test_expectations.txt')
|
|
|
| port._filesystem.write_text_file(skia_overrides_path, 'dummy text')
|
|
|
| port._options.builder_name = 'DUMMY_BUILDER_NAME'
|
| - self.assertEqual(port.expectations_files(),
|
| - [generic_path, skia_overrides_path,
|
| - never_fix_tests_path, stale_tests_path, slow_tests_path])
|
| + self.assertEqual(port.expectations_files(), [generic_path, skia_overrides_path, never_fix_tests_path, stale_tests_path,
|
| + slow_tests_path])
|
|
|
| port._options.builder_name = 'builder (deps)'
|
| - self.assertEqual(port.expectations_files(),
|
| - [generic_path, skia_overrides_path,
|
| - never_fix_tests_path, stale_tests_path, slow_tests_path])
|
| + self.assertEqual(port.expectations_files(), [generic_path, skia_overrides_path, never_fix_tests_path, stale_tests_path,
|
| + slow_tests_path])
|
|
|
| # A builder which does NOT observe the Chromium test_expectations,
|
| # but still observes the Skia test_expectations...
|
| port._options.builder_name = 'builder'
|
| - self.assertEqual(port.expectations_files(),
|
| - [generic_path, skia_overrides_path,
|
| - never_fix_tests_path, stale_tests_path, slow_tests_path])
|
| + self.assertEqual(port.expectations_files(), [generic_path, skia_overrides_path, never_fix_tests_path, stale_tests_path,
|
| + slow_tests_path])
|
|
|
| def test_check_sys_deps(self):
|
| port = self.make_port()
|
| @@ -368,12 +385,10 @@ class PortTestCase(unittest.TestCase):
|
| def test_skipped_directories_for_symbols(self):
|
| # This first test confirms that the commonly found symbols result in the expected skipped directories.
|
| symbols_string = " ".join(["fooSymbol"])
|
| - expected_directories = set([
|
| - "webaudio/codec-tests/mp3",
|
| - "webaudio/codec-tests/aac",
|
| - ])
|
| + expected_directories = set(["webaudio/codec-tests/mp3", "webaudio/codec-tests/aac", ])
|
|
|
| - result_directories = set(TestWebKitPort(symbols_string=symbols_string)._skipped_tests_for_unsupported_features(test_list=['webaudio/codec-tests/mp3/foo.html']))
|
| + result_directories = set(TestWebKitPort(symbols_string=symbols_string)._skipped_tests_for_unsupported_features(
|
| + test_list=['webaudio/codec-tests/mp3/foo.html']))
|
| self.assertEqual(result_directories, expected_directories)
|
|
|
| # Test that the nm string parsing actually works:
|
| @@ -382,11 +397,11 @@ class PortTestCase(unittest.TestCase):
|
| 000000000124f500 s __ZZN7WebCore13ff_mp3_decoder13addChildAboveEPS0_S1_E19__PRETTY_FUNCTION__
|
| 000000000124f670 s __ZZN7WebCore13ff_mp3_decoder13addChildBelowEPS0_S1_E19__PRETTY_FUNCTION__
|
| """
|
| +
|
| # Note 'compositing' is not in the list of skipped directories (hence the parsing of GraphicsLayer worked):
|
| - expected_directories = set([
|
| - "webaudio/codec-tests/aac",
|
| - ])
|
| - result_directories = set(TestWebKitPort(symbols_string=symbols_string)._skipped_tests_for_unsupported_features(test_list=['webaudio/codec-tests/mp3/foo.html']))
|
| + expected_directories = set(["webaudio/codec-tests/aac", ])
|
| + result_directories = set(TestWebKitPort(symbols_string=symbols_string)._skipped_tests_for_unsupported_features(
|
| + test_list=['webaudio/codec-tests/mp3/foo.html']))
|
| self.assertEqual(result_directories, expected_directories)
|
|
|
| def _assert_config_file_for_platform(self, port, platform, config_file):
|
| @@ -409,7 +424,9 @@ class PortTestCase(unittest.TestCase):
|
| self._assert_config_file_for_linux_distribution(port, 'redhat', 'redhat-httpd-2.2.conf')
|
|
|
| self._assert_config_file_for_platform(port, 'mac', 'apache2-httpd-2.2.conf')
|
| - self._assert_config_file_for_platform(port, 'win32', 'apache2-httpd-2.2.conf') # win32 isn't a supported sys.platform. AppleWin/WinCairo/WinCE ports all use cygwin.
|
| + self._assert_config_file_for_platform(
|
| + port, 'win32', 'apache2-httpd-2.2.conf'
|
| + ) # win32 isn't a supported sys.platform. AppleWin/WinCairo/WinCE ports all use cygwin.
|
| self._assert_config_file_for_platform(port, 'barf', 'apache2-httpd-2.2.conf')
|
|
|
| def test_path_to_apache_config_file(self):
|
|
|