コード例 #1
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')
コード例 #2
0
    def __init__(self,
                 log_executive=False,
                 executive_throws_when_run=None,
                 initialize_scm_by_default=True,
                 web=None,
                 scm=None,
                 os_name=None,
                 os_version=None):
        MockSystemHost.__init__(self,
                                log_executive,
                                executive_throws_when_run,
                                os_name=os_name,
                                os_version=os_version)
        add_unit_tests_to_mock_filesystem(self.filesystem)
        self.web = web or MockWeb()

        self._scm = scm
        # FIXME: we should never initialize the SCM by default, since the real
        # object doesn't either. This has caused at least one bug (see bug 89498).
        if initialize_scm_by_default:
            self.initialize_scm()
        self.buildbot = MockBuildBot()

        # Note: We're using a real PortFactory here.  Tests which don't wish to depend
        # on the list of known ports should override this with a MockPortFactory.
        self.port_factory = PortFactory(self)

        self.builders = Builders()
コード例 #3
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 = ['--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')
コード例 #4
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")
コード例 #5
0
    def __init__(self,
                 log_executive=False,
                 initialize_scm_by_default=True,
                 web=None,
                 scm=None,
                 os_name=None,
                 os_version=None,
                 time_return_val=123):
        super(MockHost, self).__init__(log_executive=log_executive,
                                       os_name=os_name,
                                       os_version=os_version,
                                       time_return_val=time_return_val)

        add_unit_tests_to_mock_filesystem(self.filesystem)
        self.web = web or MockWeb()

        self._scm = scm
        # TODO(qyearsley): we should never initialize the SCM by default, since
        # the real object doesn't either. This has caused at least one bug
        # (see bug 89498).
        if initialize_scm_by_default:
            self.initialize_scm()
        self.buildbot = MockBuildBot()

        # Note: We're using a real PortFactory here.  Tests which don't wish to depend
        # on the list of known ports should override this with a MockPortFactory.
        self.port_factory = PortFactory(self)

        self.builders = BuilderList(BUILDERS)
コード例 #6
0
 def make_port(self,
               host=None,
               options=optparse.Values({'configuration': 'Release'})):
     host = host or MockSystemHost()
     test.add_unit_tests_to_mock_filesystem(host.filesystem)
     return mock_drt.MockDRTPort(host,
                                 port_name='mock-mac',
                                 options=options)
コード例 #7
0
ファイル: base_unittest.py プロジェクト: iboukris/Artemis
 def make_port(self, executive=None, with_tests=False, **kwargs):
     host = MockSystemHost()
     if executive:
         host.executive = executive
     if with_tests:
         add_unit_tests_to_mock_filesystem(host.filesystem)
         return TestPort(host, **kwargs)
     return Port(host, **kwargs)
コード例 #8
0
 def make_port(self, options=mock_options):
     host = MockSystemHost()
     test.add_unit_tests_to_mock_filesystem(host.filesystem)
     if sys.platform == 'win32':
         # We use this because the 'win' port doesn't work yet.
         host.platform.os_name = 'win'
         host.platform.os_version = 'xp'
         return mock_drt.MockDRTPort(host, port_name='mock-chromium-win', options=options)
     return mock_drt.MockDRTPort(host, port_name='mock-mac', options=options)
コード例 #9
0
 def make_port(self, options=mock_options):
     host = MockSystemHost()
     test.add_unit_tests_to_mock_filesystem(host.filesystem)
     if sys.platform == 'win32':
         # We use this because the 'win' port doesn't work yet.
         host.platform.os_name = 'win'
         host.platform.os_version = 'xp'
         return mock_drt.MockDRTPort(host, port_name='mock-chromium-win', options=options)
     return mock_drt.MockDRTPort(host, port_name='mock-mac', options=options)
コード例 #10
0
 def test_main(self):
     host = MockSystemHost()
     test.add_unit_tests_to_mock_filesystem(host.filesystem)
     stdin = io.BytesIO()
     stdout = io.BytesIO()
     stderr = io.BytesIO()
     res = mock_drt.main(["--run-layout-test", "--platform", "test", "-"], host, stdin, stdout, stderr)
     self.assertEqual(res, 0)
     self.assertEqual(stdout.getvalue(), "#READY\n")
     self.assertEqual(stderr.getvalue(), "")
     self.assertEqual(host.filesystem.written_files, {})
コード例 #11
0
 def test_main(self):
     host = MockSystemHost()
     test.add_unit_tests_to_mock_filesystem(host.filesystem)
     stdin = newstringio.StringIO()
     stdout = newstringio.StringIO()
     stderr = newstringio.StringIO()
     res = mock_drt.main(["--platform", "test"] + self.extra_args(False), host, stdin, stdout, stderr)
     self.assertEqual(res, 0)
     self.assertEqual(stdout.getvalue(), "")
     self.assertEqual(stderr.getvalue(), "")
     self.assertEqual(host.filesystem.written_files, {})
コード例 #12
0
ファイル: mock_drt_unittest.py プロジェクト: Jamesducque/mojo
 def test_main(self):
     host = MockSystemHost()
     test.add_unit_tests_to_mock_filesystem(host.filesystem)
     stdin = io.BytesIO()
     stdout = io.BytesIO()
     stderr = io.BytesIO()
     res = mock_drt.main(['--dump-render-tree', '--platform', 'test', '-'],
                         host, stdin, stdout, stderr)
     self.assertEqual(res, 0)
     self.assertEqual(stdout.getvalue(), '')
     self.assertEqual(stderr.getvalue(), '')
     self.assertEqual(host.filesystem.written_files, {})
コード例 #13
0
 def test_main(self):
     host = MockSystemHost()
     test.add_unit_tests_to_mock_filesystem(host.filesystem)
     stdin = io.BytesIO()
     stdout = io.BytesIO()
     stderr = io.BytesIO()
     res = mock_drt.main(['--run-layout-test', '--platform', 'test', '-'],
                         host, stdin, stdout, stderr)
     self.assertEqual(res, 0)
     self.assertEqual(stdout.getvalue(), '#READY\n')
     self.assertEqual(stderr.getvalue(), '')
     self.assertEqual(host.filesystem.written_files, {})
コード例 #14
0
 def test_main(self):
     host = MockSystemHost()
     test.add_unit_tests_to_mock_filesystem(host.filesystem)
     stdin = newstringio.StringIO()
     stdout = newstringio.StringIO()
     stderr = newstringio.StringIO()
     res = mock_drt.main(['--platform', 'test'] + self.extra_args(False),
                         host, stdin, stdout, stderr)
     self.assertEqual(res, 0)
     self.assertEqual(stdout.getvalue(), '')
     self.assertEqual(stderr.getvalue(), '')
     self.assertEqual(host.filesystem.written_files, {})
コード例 #15
0
    def __init__(self, log_executive=False, executive_throws_when_run=None, initialize_scm_by_default=True, web=None, scm=None):
        MockSystemHost.__init__(self, log_executive, executive_throws_when_run)
        add_unit_tests_to_mock_filesystem(self.filesystem)
        self.web = web or MockWeb()

        self._scm = scm
        # FIXME: we should never initialize the SCM by default, since the real
        # object doesn't either. This has caused at least one bug (see bug 89498).
        if initialize_scm_by_default:
            self.initialize_scm()
        self.buildbot = MockBuildBot()

        # Note: We're using a real PortFactory here.  Tests which don't wish to depend
        # on the list of known ports should override this with a MockPortFactory.
        self.port_factory = PortFactory(self)
コード例 #16
0
    def __init__(self,
                 log_executive=False,
                 web=None,
                 git=None,
                 os_name=None,
                 os_version=None,
                 time_return_val=123):
        super(MockHost, self).__init__(log_executive=log_executive,
                                       os_name=os_name,
                                       os_version=os_version,
                                       time_return_val=time_return_val)

        add_unit_tests_to_mock_filesystem(self.filesystem)
        self._add_base_manifest_to_mock_filesystem(self.filesystem)
        self.web = web or MockWeb()
        self._git = git

        self.buildbot = MockBuildBot()

        # Note: We're using a real PortFactory here. Tests which don't wish to depend
        # on the list of known ports should override this with a MockPortFactory.
        self.port_factory = PortFactory(self)

        self.builders = BuilderList({
            'Fake Test Win10': {
                'port_name': 'win-win10',
                'specifiers': ['Win10', 'Release']
            },
            'Fake Test Linux': {
                'port_name': 'linux-trusty',
                'specifiers': ['Trusty', 'Release']
            },
            'Fake Test Linux (dbg)': {
                'port_name': 'linux-trusty',
                'specifiers': ['Trusty', 'Debug']
            },
            'Fake Test Mac10.12': {
                'port_name': 'mac-mac10.12',
                'specifiers': ['Mac10.12', 'Release']
            },
            'Fake Test Linux Try Bot': {
                'port_name': 'linux-trusty',
                'specifiers': ['Trusty', 'Release'],
                'is_try_builder': True,
            },
        })
コード例 #17
0
    def __init__(self, log_executive=False, executive_throws_when_run=None, initialize_scm_by_default=True):
        MockSystemHost.__init__(self, log_executive, executive_throws_when_run)
        add_unit_tests_to_mock_filesystem(self.filesystem)
        self.web = MockWeb()

        self._checkout = MockCheckout()
        self._scm = None
        # FIXME: we should never initialize the SCM by default, since the real
        # object doesn't either. This has caused at least one bug (see bug 89498).
        if initialize_scm_by_default:
            self.initialize_scm()
        self.bugs = MockBugzilla()
        self.buildbot = MockBuildBot()
        self._chromium_buildbot = MockBuildBot()

        # Note: We're using a real PortFactory here.  Tests which don't wish to depend
        # on the list of known ports should override this with a MockPortFactory.
        self.port_factory = PortFactory(self)

        self._watch_list = MockWatchList()
コード例 #18
0
ファイル: host_mock.py プロジェクト: Moondee/Artemis
    def __init__(self, log_executive=False, executive_throws_when_run=None):
        MockSystemHost.__init__(self, log_executive, executive_throws_when_run)
        add_unit_tests_to_mock_filesystem(self.filesystem)
        self.web = MockWeb()

        self._checkout = MockCheckout()
        self._scm = MockSCM(filesystem=self.filesystem, executive=self.executive)
        # Various pieces of code (wrongly) call filesystem.chdir(checkout_root).
        # Making the checkout_root exist in the mock filesystem makes that chdir not raise.
        self.filesystem.maybe_make_directory(self._scm.checkout_root)

        self.bugs = MockBugzilla()
        self.buildbot = MockBuildBot()
        self._chromium_buildbot = MockBuildBot()

        # Note: We're using a real PortFactory here.  Tests which don't wish to depend
        # on the list of known ports should override this with a MockPortFactory.
        self.port_factory = PortFactory(self)

        self._watch_list = MockWatchList()
コード例 #19
0
ファイル: host_mock.py プロジェクト: iboukris/Artemis
    def __init__(self, log_executive=False, executive_throws_when_run=None):
        MockSystemHost.__init__(self, log_executive, executive_throws_when_run)
        add_unit_tests_to_mock_filesystem(self.filesystem)
        self.web = MockWeb()

        self._checkout = MockCheckout()
        self._scm = MockSCM(filesystem=self.filesystem,
                            executive=self.executive)
        # Various pieces of code (wrongly) call filesystem.chdir(checkout_root).
        # Making the checkout_root exist in the mock filesystem makes that chdir not raise.
        self.filesystem.maybe_make_directory(self._scm.checkout_root)

        self.bugs = MockBugzilla()
        self.buildbot = MockBuildBot()
        self._chromium_buildbot = MockBuildBot()

        # Note: We're using a real PortFactory here.  Tests which don't wish to depend
        # on the list of known ports should override this with a MockPortFactory.
        self.port_factory = PortFactory(self)

        self._watch_list = MockWatchList()
コード例 #20
0
ファイル: mock_drt_unittest.py プロジェクト: mirror/chromium
    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')
コード例 #21
0
ファイル: host_mock.py プロジェクト: IncoCura/qt5
    def __init__(self,
                 log_executive=False,
                 web=None,
                 git=None,
                 os_name=None,
                 os_version=None,
                 time_return_val=123):
        super(MockHost, self).__init__(log_executive=log_executive,
                                       os_name=os_name,
                                       os_version=os_version,
                                       time_return_val=time_return_val)

        add_unit_tests_to_mock_filesystem(self.filesystem)
        self._add_base_manifest_to_mock_filesystem(self.filesystem)
        self.web = web or MockWeb()
        self._git = git

        self.buildbot = MockBuildBot()

        # Note: We're using a real PortFactory here. Tests which don't wish to depend
        # on the list of known ports should override this with a MockPortFactory.
        self.port_factory = PortFactory(self)

        self.builders = BuilderList(BUILDERS)
コード例 #22
0
 def make_port(self, options=mock_options):
     host = MockSystemHost()
     test.add_unit_tests_to_mock_filesystem(host.filesystem)
     return mock_drt.MockDRTPort(host,
                                 port_name='mock-chromium-mac',
                                 options=options)
コード例 #23
0
ファイル: mock_drt_unittest.py プロジェクト: yang-bo/webkit
 def make_port(self, options=mock_options):
     host = MockSystemHost()
     test.add_unit_tests_to_mock_filesystem(host.filesystem)
     return mock_drt.MockDRTPort(host, port_name='mock-mac', options=options)
コード例 #24
0
 def make_port(self, host=None, options=optparse.Values({"configuration": "Release"})):
     host = host or MockSystemHost()
     test.add_unit_tests_to_mock_filesystem(host.filesystem)
     return mock_drt.MockDRTPort(host, port_name="mock-mac", options=options)