示例#1
0
    def test_determine_architecture_fails(self):
        # Test that we default to 'x86' if the driver doesn't exist.
        port = self.make_port()
        self.assertEqual(port.architecture(), 'x86_64')

        # Test that we default to 'x86' on an unknown architecture.
        host = MockSystemHost()
        host.filesystem.exists = lambda x: True
        host.executive = executive_mock.MockExecutive2('win32')
        port = self.make_port(host=host)
        self.assertEqual(port.architecture(), 'x86_64')

        # Test that we raise errors if something weird happens.
        host.executive = executive_mock.MockExecutive2(exception=AssertionError)
        self.assertRaises(AssertionError, chromium_linux.ChromiumLinuxPort, host, self.port_name)
示例#2
0
    def test_determine_architecture_fails(self):
        # Test that we default to 'x86' if the driver doesn't exist.
        port = self.make_port()
        self.assertEqual(port.architecture(), 'x86_64')

        # Test that we default to 'x86' on an unknown architecture.
        host = MockSystemHost()
        host.filesystem.exists = lambda x: True
        host.executive = executive_mock.MockExecutive2('win32')
        port = self.make_port(host=host)
        self.assertEqual(port.architecture(), 'x86_64')

        # Test that we raise errors if something weird happens.
        host.executive = executive_mock.MockExecutive2(exception=AssertionError)
        self.assertRaises(AssertionError, linux.LinuxPort, host, '%s-foo' % self.port_name)
示例#3
0
 def _assert_skipped_path(self, search_paths, os_name, use_webkit2=False, qt_version='4.8'):
     host = MockSystemHost(os_name=os_name)
     host.executive = MockExecutive2(self._qt_version(qt_version))
     port_name = 'qt-' + os_name
     port = self.make_port(host=host, qt_version=qt_version, port_name=port_name,
                           options=MockOptions(webkit_test_runner=use_webkit2, platform='qt'))
     self.assertEquals(port._skipped_file_search_paths(), search_paths)
示例#4
0
 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)
示例#5
0
 def _assert_search_path(self, search_paths, sys_platform, use_webkit2=False, qt_version='4.8'):
     # FIXME: Port constructors should not "parse" the port name, but
     # rather be passed components (directly or via setters).  Once
     # we fix that, this method will need a re-write.
     host = MockSystemHost()
     host.executive = MockExecutive2(self._qt_version(qt_version))
     port = QtPort(host, sys_platform=sys_platform, options=MockOptions(webkit_test_runner=use_webkit2, platform='qt'))
     absolute_search_paths = map(port._webkit_baseline_path, search_paths)
     self.assertEquals(port.baseline_search_path(), absolute_search_paths)
示例#6
0
 def _assert_expectations_files(self, search_paths, os_name, use_webkit2=False, qt_version='4.8'):
     # FIXME: Port constructors should not "parse" the port name, but
     # rather be passed components (directly or via setters).  Once
     # we fix that, this method will need a re-write.
     host = MockSystemHost(os_name=os_name)
     host.executive = MockExecutive2(self._qt_version(qt_version))
     port_name = 'qt-' + os_name
     port = self.make_port(host=host, qt_version=qt_version, port_name=port_name,
                           options=MockOptions(webkit_test_runner=use_webkit2, platform='qt'))
     self.assertEquals(port.expectations_files(), search_paths)
示例#7
0
 def _assert_expectations_files(self, search_paths, os_name, use_webkit2=False, qt_version='4.8'):
     # FIXME: Port constructors should not "parse" the port name, but
     # rather be passed components (directly or via setters).  Once
     # we fix that, this method will need a re-write.
     host = MockSystemHost(os_name=os_name)
     host.executive = MockExecutive2(self._qt_version(qt_version))
     port_name = 'qt-' + os_name
     port = self.make_port(host=host, qt_version=qt_version, port_name=port_name,
                           options=MockOptions(webkit_test_runner=use_webkit2, platform='qt'))
     self.assertEquals(port.expectations_files(), search_paths)
 def assert_version_properties(self, port_name, os_version, expected_name,
                               expected_version,
                               driver_file_output=None):
     host = MockSystemHost(os_name=self.os_name, os_version=(os_version or self.os_version))
     host.filesystem.isfile = lambda x: 'content_shell' in x
     if driver_file_output:
         host.executive = executive_mock.MockExecutive2(driver_file_output)
     port = self.make_port(host=host, port_name=port_name, os_version=os_version)
     self.assertEqual(port.name(), expected_name)
     self.assertEqual(port.version(), expected_version)
示例#9
0
 def assert_version_properties(self, port_name, os_version, expected_name,
                               expected_version,
                               driver_file_output=None):
     host = MockSystemHost(os_name=self.os_name, os_version=(os_version or self.os_version))
     host.filesystem.isfile = lambda x: 'content_shell' in x
     if driver_file_output:
         host.executive = executive_mock.MockExecutive2(driver_file_output)
     port = self.make_port(host=host, port_name=port_name, os_version=os_version)
     self.assertEqual(port.name(), expected_name)
     self.assertEqual(port.version(), expected_version)
示例#10
0
    def test_wdiff_text_fails(self):
        host = MockSystemHost(os_name=self.os_name, os_version=self.os_version)
        host.executive = MockExecutive(should_throw=True)
        port = self.make_port(host=host)
        port._executive = host.executive  # AndroidPortTest.make_port sets its own executive, so reset that as well.

        # This should raise a ScriptError that gets caught and turned into the
        # error text, and also mark wdiff as not available.
        self.make_wdiff_available(port)
        self.assertTrue(port.wdiff_available())
        diff_txt = port.wdiff_text("/tmp/foo.html", "/tmp/bar.html")
        self.assertEqual(diff_txt, port._wdiff_error_html)
        self.assertFalse(port.wdiff_available())
    def test_wdiff_text_fails(self):
        host = MockSystemHost(os_name=self.os_name, os_version=self.os_version)
        host.executive = MockExecutive(should_throw=True)
        port = self.make_port(host=host)
        port._executive = host.executive  # AndroidPortTest.make_port sets its own executive, so reset that as well.

        # This should raise a ScriptError that gets caught and turned into the
        # error text, and also mark wdiff as not available.
        self.make_wdiff_available(port)
        self.assertTrue(port.wdiff_available())
        diff_txt = port.wdiff_text("/tmp/foo.html", "/tmp/bar.html")
        self.assertEqual(diff_txt, port._wdiff_error_html)
        self.assertFalse(port.wdiff_available())
示例#12
0
    def assert_architecture(self, port_name=None, file_output=None, expected_architecture=None):
        host = MockSystemHost()
        host.filesystem.exists = lambda x: 'content_shell' in x
        if file_output:
            host.executive = executive_mock.MockExecutive2(file_output)

        port = self.make_port(host, port_name=port_name)
        self.assertEqual(port.architecture(), expected_architecture)
        if expected_architecture == 'x86':
            self.assertTrue(port.baseline_path().endswith('chromium-linux-x86'))
            self.assertTrue(port.baseline_search_path()[0].endswith('chromium-linux-x86'))
            self.assertTrue(port.baseline_search_path()[1].endswith('chromium-linux'))
        else:
            self.assertTrue(port.baseline_path().endswith('chromium-linux'))
            self.assertTrue(port.baseline_search_path()[0].endswith('chromium-linux'))
示例#13
0
    def assert_architecture(self, port_name=None, file_output=None, expected_architecture=None):
        host = MockSystemHost()
        host.filesystem.isfile = lambda x: 'content_shell' in x
        if file_output:
            host.executive = executive_mock.MockExecutive2(file_output)

        port = self.make_port(host, port_name=port_name)
        self.assertEqual(port.architecture(), expected_architecture)
        if expected_architecture == 'x86':
            self.assertTrue(port.baseline_path().endswith('linux-x86'))
            self.assertTrue(port.baseline_search_path()[0].endswith('linux-x86'))
            self.assertTrue(port.baseline_search_path()[1].endswith('linux'))
        else:
            self.assertTrue(port.baseline_path().endswith('linux'))
            self.assertTrue(port.baseline_search_path()[0].endswith('linux'))
示例#14
0
 def _assert_skipped_path(self,
                          search_paths,
                          os_name,
                          use_webkit2=False,
                          qt_version='4.8'):
     host = MockSystemHost(os_name=os_name)
     host.executive = MockExecutive2(self._qt_version(qt_version))
     port_name = 'qt-' + os_name
     port = self.make_port(host=host,
                           qt_version=qt_version,
                           port_name=port_name,
                           options=MockOptions(
                               webkit_test_runner=use_webkit2,
                               platform='qt'))
     self.assertEquals(port._skipped_file_search_paths(), search_paths)
示例#15
0
 def _assert_search_path(self, search_paths, os_name, use_webkit2=False, qt_version="4.8"):
     # FIXME: Port constructors should not "parse" the port name, but
     # rather be passed components (directly or via setters).  Once
     # we fix that, this method will need a re-write.
     host = MockSystemHost(os_name=os_name)
     host.executive = MockExecutive2(self._qt_version(qt_version))
     port_name = "qt-" + os_name
     port = self.make_port(
         host=host,
         qt_version=qt_version,
         port_name=port_name,
         options=MockOptions(webkit_test_runner=use_webkit2, platform="qt"),
     )
     absolute_search_paths = map(port._webkit_baseline_path, search_paths)
     self.assertEqual(port.baseline_search_path(), absolute_search_paths)