def assertTest(self,
                   test_name,
                   pixel_tests,
                   expected_checksum=None,
                   drt_output=None,
                   host=None,
                   expected_text=None):
        port_name = 'test'
        host = host or MockSystemHost()
        test.add_unit_tests_to_mock_filesystem(host.filesystem)
        port = PortFactory(host).get(port_name)
        drt_input, drt_output = self.make_input_output(
            port,
            test_name,
            pixel_tests,
            expected_checksum,
            drt_output,
            drt_input=None,
            expected_text=expected_text)

        args = ['--run-layout-test', '--platform', port_name, '-']
        stdin = io.BytesIO(drt_input)
        stdout = io.BytesIO()
        stderr = io.BytesIO()
        options, args = mock_drt.parse_options(args)

        drt = self.make_drt(options, args, host, stdin, stdout, stderr)
        res = drt.run()

        self.assertEqual(res, 0)

        self.assertEqual(stdout.getvalue(), ''.join(drt_output))
        self.assertEqual(stderr.getvalue(), '#EOF\n')
    def assertTest(self,
                   test_name,
                   pixel_tests,
                   expected_checksum=None,
                   drt_output=None,
                   host=None,
                   expected_text=None):
        port_name = 'test'
        host = host or MockSystemHost()
        test.add_unit_tests_to_mock_filesystem(host.filesystem)
        port = PortFactory(host).get(port_name)
        drt_input, drt_output = self.make_input_output(
            port,
            test_name,
            pixel_tests,
            expected_checksum,
            drt_output,
            drt_input=None,
            expected_text=expected_text)

        args = ['--dump-render-tree', '--platform', port_name, '-']
        stdin = newstringio.StringIO(drt_input)
        stdout = newstringio.StringIO()
        stderr = newstringio.StringIO()
        options, args = mock_drt.parse_options(args)

        drt = self.make_drt(options, args, host, stdin, stdout, stderr)
        res = drt.run()

        self.assertEqual(res, 0)

        # We use the StringIO.buflist here instead of getvalue() because
        # the StringIO might be a mix of unicode/ascii and 8-bit strings.
        self.assertEqual(stdout.buflist, drt_output)
        self.assertEqual(stderr.getvalue(), '#EOF\n')
 def test_chromium_parse_options(self):
     options, args = mock_drt.parse_options([
         '--platform', 'chromium-mac', '--pixel-tests=/tmp/png_result0.png'
     ])
     self.assertTrue(options.chromium)
     self.assertTrue(options.pixel_tests)
     self.assertEquals(options.pixel_path, '/tmp/png_result0.png')
    def assertTest(self,
                   test_name,
                   pixel_tests,
                   expected_checksum=None,
                   drt_output=None,
                   filesystem=None):
        platform = 'test'
        filesystem = filesystem or test.unit_test_filesystem()
        port = factory.get(platform, filesystem=filesystem)
        drt_input, drt_output = self.make_input_output(port, test_name,
                                                       pixel_tests,
                                                       expected_checksum,
                                                       drt_output)

        args = ['--platform', 'test'] + self.extra_args(pixel_tests)
        stdin = newstringio.StringIO(drt_input)
        stdout = newstringio.StringIO()
        stderr = newstringio.StringIO()
        options, args = mock_drt.parse_options(args)

        drt = self.make_drt(options, args, filesystem, stdin, stdout, stderr)
        res = drt.run()

        self.assertEqual(res, 0)

        # We use the StringIO.buflist here instead of getvalue() because
        # the StringIO might be a mix of unicode/ascii and 8-bit strings.
        self.assertEqual(stdout.buflist, drt_output)
        self.assertEqual(stderr.getvalue(), '')
Пример #5
0
 def test_test_shell_parse_options(self):
     options, args = mock_drt.parse_options(
         ["--platform", "mac", "--test-shell", "--pixel-tests=/tmp/png_result0.png"]
     )
     self.assertTrue(options.test_shell)
     self.assertTrue(options.pixel_tests)
     self.assertEqual(options.pixel_path, "/tmp/png_result0.png")
Пример #6
0
    def assertTest(
        self, test_name, pixel_tests, expected_checksum=None, drt_output=None, host=None, expected_text=None
    ):
        port_name = "test"
        host = host or MockSystemHost()
        test.add_unit_tests_to_mock_filesystem(host.filesystem)
        port = PortFactory(host).get(port_name)
        drt_input, drt_output = self.make_input_output(
            port, test_name, pixel_tests, expected_checksum, drt_output, drt_input=None, expected_text=expected_text
        )

        args = ["--platform", port_name] + self.extra_args(pixel_tests)
        stdin = newstringio.StringIO(drt_input)
        stdout = newstringio.StringIO()
        stderr = newstringio.StringIO()
        options, args = mock_drt.parse_options(args)

        drt = self.make_drt(options, args, host, stdin, stdout, stderr)
        res = drt.run()

        self.assertEqual(res, 0)

        # We use the StringIO.buflist here instead of getvalue() because
        # the StringIO might be a mix of unicode/ascii and 8-bit strings.
        self.assertEqual(stdout.buflist, drt_output)
        self.assertEqual(stderr.getvalue(), "" if options.test_shell else "#EOF\n")
Пример #7
0
    def assertTest(self, test_name, pixel_tests, expected_checksum=None, drt_output=None, host=None, expected_text=None):
        port_name = 'test'
        host = host or MockSystemHost()
        test.add_unit_tests_to_mock_filesystem(host.filesystem)
        port = PortFactory(host).get(port_name)
        drt_input, drt_output = self.make_input_output(
            port, test_name, pixel_tests, expected_checksum, drt_output, drt_input=None, expected_text=expected_text)

        args = ['--run-layout-test', '--platform', port_name, '-']
        stdin = io.BytesIO(drt_input)
        stdout = io.BytesIO()
        stderr = io.BytesIO()
        options, args = mock_drt.parse_options(args)

        drt = self.make_drt(options, args, host, stdin, stdout, stderr)
        res = drt.run()

        self.assertEqual(res, 0)

        self.assertEqual(stdout.getvalue(), ''.join(drt_output))
        self.assertEqual(stderr.getvalue(), '#EOF\n')
Пример #8
0
    def assertTest(self, test_name, pixel_tests, expected_checksum=None,
                   drt_output=None, filesystem=None):
        platform = 'test'
        filesystem = filesystem or test.unit_test_filesystem()
        port = factory.get(platform, filesystem=filesystem)
        drt_input, drt_output = self.make_input_output(port, test_name,
            pixel_tests, expected_checksum, drt_output)

        args = ['--platform', 'test'] + self.extra_args(pixel_tests)
        stdin = newstringio.StringIO(drt_input)
        stdout = newstringio.StringIO()
        stderr = newstringio.StringIO()
        options, args = mock_drt.parse_options(args)

        drt = self.make_drt(options, args, filesystem, stdin, stdout, stderr)
        res = drt.run()

        self.assertEqual(res, 0)

        # We use the StringIO.buflist here instead of getvalue() because
        # the StringIO might be a mix of unicode/ascii and 8-bit strings.
        self.assertEqual(stdout.buflist, drt_output)
        self.assertEqual(stderr.getvalue(), '')
Пример #9
0
 def test_chromium_parse_options(self):
     options, args = mock_drt.parse_options(['--platform', 'chromium-mac',
         '--pixel-tests=/tmp/png_result0.png'])
     self.assertTrue(options.chromium)
     self.assertTrue(options.pixel_tests)
     self.assertEquals(options.pixel_path, '/tmp/png_result0.png')
 def test_test_shell_parse_options(self):
     options, args = mock_drt.parse_options(['--platform', 'mac', '--test-shell',
         '--pixel-tests=/tmp/png_result0.png'])
     self.assertTrue(options.test_shell)
     self.assertTrue(options.pixel_tests)
     self.assertEqual(options.pixel_path, '/tmp/png_result0.png')