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(), '#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 = ["--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(), "#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 = ['--platform', port_name] + self.extra_args(pixel_tests) stdin = StringIO(drt_input) stdout = StringIO() stderr = 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) self.assertEqual(stdout.getvalue(), ''.join(drt_output)) self.assertEqual(stderr.getvalue(), '#EOF\n')
def test_test_shell_parse_options(self): options, args = mock_drt.parse_options([ '--platform', 'chromium-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')
def test_test_shell_parse_options(self): options, args = mock_drt.parse_options(['--platform', 'chromium-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')