Example #1
0
 def test_two_starts_cleans_up_properly(self):
     port = TestWebKitPort()
     driver = WebKitDriver(port, 0, pixel_tests=True)
     driver.start(True, [])
     last_tmpdir = port._filesystem.last_tmpdir
     driver._start(True, [])
     self.assertFalse(port._filesystem.isdir(last_tmpdir))
Example #2
0
 def stop(self):
     WebKitDriver.stop(self)
     if getattr(self, '_xvfb_process', None):
         # FIXME: This should use Executive.kill_process
         os.kill(self._xvfb_process.pid, signal.SIGTERM)
         self._xvfb_process.wait()
         self._xvfb_process = None
Example #3
0
    def __init__(self, port, worker_number, pixel_tests, no_timeout=False):
        WebKitDriver.__init__(self, port, worker_number, pixel_tests, no_timeout)
        self._proc = None
        self._image_path = None

        # FIXME: Delete all of this driver code once we're satisfied that it's not needed any more.
        self._test_shell = '--test-shell' in port.get_option('additional_drt_flag', [])
Example #4
0
 def stop(self):
     WebKitDriver.stop(self)
     if getattr(self, '_xvfb_process', None):
         # FIXME: This should use Executive.kill_process
         os.kill(self._xvfb_process.pid, signal.SIGTERM)
         self._xvfb_process.wait()
         self._xvfb_process = None
Example #5
0
 def test_stop_cleans_up_properly(self):
     port = TestWebKitPort()
     driver = WebKitDriver(port, 0, pixel_tests=True)
     driver.start(True, [])
     last_tmpdir = port._filesystem.last_tmpdir
     self.assertNotEquals(last_tmpdir, None)
     driver.stop()
     self.assertFalse(port._filesystem.isdir(last_tmpdir))
Example #6
0
 def stop(self):
     WebKitDriver.stop(self)
     if getattr(self, '_xvfb_process', None):
         try:
             self._xvfb_process.terminate()
             self._xvfb_process.wait()
         except OSError:
             _log.warn("The driver is already terminated.")
         self._xvfb_process = None
Example #7
0
 def stop(self):
     WebKitDriver.stop(self)
     if getattr(self, '_xvfb_process', None):
         try:
             self._xvfb_process.terminate()
             self._xvfb_process.wait()
         except OSError:
             _log.warn("The driver is already terminated.")
         self._xvfb_process = None
Example #8
0
    def __init__(self, port, worker_number, pixel_tests, no_timeout=False):
        WebKitDriver.__init__(self, port, worker_number, pixel_tests,
                              no_timeout)
        self._proc = None
        self._image_path = None

        # FIXME: Delete all of this driver code once we're satisfied that it's not needed any more.
        self._test_shell = '--test-shell' in port.get_option(
            'additional_drt_flag', [])
Example #9
0
 def test_read_block(self):
     port = TestWebKitPort()
     driver = WebKitDriver(port, 0)
     driver._server_process = MockServerProcess(
         ["ActualHash: foobar", "Content-Type: my_type", "Content-Transfer-Encoding: none", "#EOF"]
     )
     content_block = driver._read_block(0)
     self.assertEquals(content_block.content_type, "my_type")
     self.assertEquals(content_block.encoding, "none")
     self.assertEquals(content_block.content_hash, "foobar")
Example #10
0
    def __init__(self, port, worker_number, pixel_tests, no_timeout=False):
        WebKitDriver.__init__(self, port, worker_number, pixel_tests, no_timeout)
        self._proc = None
        self._image_path = None

        # FIXME: Make the regular webkit driver work on win as well so we can delete all of this driver code.
        if port.host.platform.is_win():
            if not hasattr(port._options, 'additional_drt_flag'):
                port._options.additional_drt_flag = []
            if not '--test-shell' in port._options.additional_drt_flag:
                port._options.additional_drt_flag.append('--test-shell')

        self._test_shell = '--test-shell' in port.get_option('additional_drt_flag', [])
Example #11
0
 def test_read_block(self):
     port = TestWebKitPort()
     driver = WebKitDriver(port, 0, pixel_tests=False)
     driver._server_process = MockServerProcess([
         'ActualHash: foobar',
         'Content-Type: my_type',
         'Content-Transfer-Encoding: none',
         "#EOF",
     ])
     content_block = driver._read_block(0)
     self.assertEquals(content_block.content_type, 'my_type')
     self.assertEquals(content_block.encoding, 'none')
     self.assertEquals(content_block.content_hash, 'foobar')
Example #12
0
 def test_read_block(self):
     port = TestWebKitPort()
     driver = WebKitDriver(port, 0)
     driver._server_process = MockServerProcess([
         'ActualHash: foobar',
         'Content-Type: my_type',
         'Content-Transfer-Encoding: none',
         "#EOF",
     ])
     content_block = driver._read_block(0)
     self.assertEquals(content_block.content_type, 'my_type')
     self.assertEquals(content_block.encoding, 'none')
     self.assertEquals(content_block.content_hash, 'foobar')
Example #13
0
    def __init__(self, port, worker_number, pixel_tests, no_timeout=False):
        WebKitDriver.__init__(self, port, worker_number, pixel_tests, no_timeout)
        self._proc = None
        self._image_path = None

        # FIXME: Delete all of this driver code once we're satisfied that it's not needed any more.
        #if port.host.platform.os_version == 'snowleopard':
        #    if not hasattr(port._options, 'additional_drt_flag'):
        #        port._options.additional_drt_flag = []
        #    if not '--test-shell' in port._options.additional_drt_flag:
        #        port._options.additional_drt_flag.append('--test-shell')

        self._test_shell = '--test-shell' in port.get_option('additional_drt_flag', [])
Example #14
0
    def __init__(self, port, worker_number, pixel_tests, no_timeout=False):
        WebKitDriver.__init__(self, port, worker_number, pixel_tests,
                              no_timeout)
        self._proc = None
        self._image_path = None

        # FIXME: Make the regular webkit driver work on win as well so we can delete all of this driver code.
        if port.host.platform.is_win():
            if not hasattr(port._options, 'additional_drt_flag'):
                port._options.additional_drt_flag = []
            if not '--test-shell' in port._options.additional_drt_flag:
                port._options.additional_drt_flag.append('--test-shell')

        self._test_shell = '--test-shell' in port.get_option(
            'additional_drt_flag', [])
Example #15
0
    def __init__(self, port, worker_number, pixel_tests, no_timeout=False):
        WebKitDriver.__init__(self, port, worker_number, pixel_tests,
                              no_timeout)
        self._proc = None
        self._image_path = None

        # FIXME: Delete all of this driver code once we're satisfied that it's not needed any more.
        #if port.host.platform.os_version == 'snowleopard':
        #    if not hasattr(port._options, 'additional_drt_flag'):
        #        port._options.additional_drt_flag = []
        #    if not '--test-shell' in port._options.additional_drt_flag:
        #        port._options.additional_drt_flag.append('--test-shell')

        self._test_shell = '--test-shell' in port.get_option(
            'additional_drt_flag', [])
Example #16
0
 def test_read_binary_block(self):
     port = TestWebKitPort()
     driver = WebKitDriver(port, 0, pixel_tests=True)
     driver._server_process = MockServerProcess([
         'ActualHash: actual',
         'ExpectedHash: expected',
         'Content-Type: image/png',
         'Content-Length: 8',
         "12345678",
         "#EOF",
     ])
     content_block = driver._read_block(0)
     self.assertEquals(content_block.content_type, 'image/png')
     self.assertEquals(content_block.content_hash, 'actual')
     self.assertEquals(content_block.content, '12345678')
     self.assertEquals(content_block.decoded_content, '12345678')
Example #17
0
 def test_read_binary_block(self):
     port = TestWebKitPort()
     driver = WebKitDriver(port, 0, pixel_tests=True)
     driver._server_process = MockServerProcess([
         'ActualHash: actual',
         'ExpectedHash: expected',
         'Content-Type: image/png',
         'Content-Length: 8',
         "12345678",
         "#EOF",
     ])
     content_block = driver._read_block(0)
     self.assertEquals(content_block.content_type, 'image/png')
     self.assertEquals(content_block.content_hash, 'actual')
     self.assertEquals(content_block.content, '12345678')
     self.assertEquals(content_block.decoded_content, '12345678')
Example #18
0
 def test_two_starts_cleans_up_properly(self):
     port = TestWebKitPort()
     driver = WebKitDriver(port, 0, pixel_tests=True)
     driver.start(True, [])
     last_tmpdir = port._filesystem.last_tmpdir
     driver._start(True, [])
     self.assertFalse(port._filesystem.isdir(last_tmpdir))
Example #19
0
 def test_stop_cleans_up_properly(self):
     port = TestWebKitPort()
     driver = WebKitDriver(port, 0, pixel_tests=True)
     driver.start(True, [])
     last_tmpdir = port._filesystem.last_tmpdir
     self.assertNotEquals(last_tmpdir, None)
     driver.stop()
     self.assertFalse(port._filesystem.isdir(last_tmpdir))
Example #20
0
 def cmd_line(self, pixel_tests, per_test_args):
     wrapper_path = self._port.path_from_webkit_base(
         "Tools", "efl", "run-with-jhbuild")
     return [wrapper_path] + WebKitDriver.cmd_line(self, pixel_tests,
                                                   per_test_args)
Example #21
0
    def test_check_for_driver_crash(self):
        port = TestWebKitPort()
        driver = WebKitDriver(port, 0, pixel_tests=True)

        class FakeServerProcess(object):
            def __init__(self, crashed):
                self.crashed = crashed

            def pid(self):
                return 1234

            def name(self):
                return 'FakeServerProcess'

            def has_crashed(self):
                return self.crashed

        def assert_crash(driver, error_line, crashed, name, pid):
            self.assertEquals(driver._check_for_driver_crash(error_line), crashed)
            self.assertEquals(driver._crashed_process_name, name)
            self.assertEquals(driver._crashed_pid, pid)

        driver._server_process = FakeServerProcess(False)
        assert_crash(driver, '', False, None, None)

        driver._crashed_process_name = None
        driver._crashed_pid = None
        driver._server_process = FakeServerProcess(False)
        assert_crash(driver, '#CRASHED\n', True, 'FakeServerProcess', 1234)

        driver._crashed_process_name = None
        driver._crashed_pid = None
        driver._server_process = FakeServerProcess(False)
        assert_crash(driver, '#CRASHED - WebProcess\n', True, 'WebProcess', None)

        driver._crashed_process_name = None
        driver._crashed_pid = None
        driver._server_process = FakeServerProcess(False)
        assert_crash(driver, '#CRASHED - WebProcess (pid 8675)\n', True, 'WebProcess', 8675)

        driver._crashed_process_name = None
        driver._crashed_pid = None
        driver._server_process = FakeServerProcess(True)
        assert_crash(driver, '', True, 'FakeServerProcess', 1234)
Example #22
0
 def cmd_line(self, pixel_tests, per_test_args):
     wrapper_path = self._port.path_from_webkit_base("Tools", "efl", "run-with-jhbuild")
     return [wrapper_path] + WebKitDriver.cmd_line(self, pixel_tests, per_test_args)
Example #23
0
 def test_no_timeout(self):
     port = TestWebKitPort()
     driver = WebKitDriver(port, 0, pixel_tests=True, no_timeout=True)
     self.assertEquals(driver.cmd_line(True, []), [
         '/mock-build/DumpRenderTree', '--no-timeout', '--pixel-tests', '-'
     ])
Example #24
0
    def test_check_for_driver_crash(self):
        port = TestWebKitPort()
        driver = WebKitDriver(port, 0, pixel_tests=True)

        class FakeServerProcess(object):
            def __init__(self, crashed):
                self.crashed = crashed

            def pid(self):
                return 1234

            def name(self):
                return 'FakeServerProcess'

            def has_crashed(self):
                return self.crashed

        def assert_crash(driver, error_line, crashed, name, pid):
            self.assertEquals(driver._check_for_driver_crash(error_line),
                              crashed)
            self.assertEquals(driver._crashed_process_name, name)
            self.assertEquals(driver._crashed_pid, pid)

        driver._server_process = FakeServerProcess(False)
        assert_crash(driver, '', False, None, None)

        driver._crashed_process_name = None
        driver._crashed_pid = None
        driver._server_process = FakeServerProcess(False)
        assert_crash(driver, '#CRASHED\n', True, 'FakeServerProcess', 1234)

        driver._crashed_process_name = None
        driver._crashed_pid = None
        driver._server_process = FakeServerProcess(False)
        assert_crash(driver, '#CRASHED - WebProcess\n', True, 'WebProcess',
                     None)

        driver._crashed_process_name = None
        driver._crashed_pid = None
        driver._server_process = FakeServerProcess(False)
        assert_crash(driver, '#CRASHED - WebProcess (pid 8675)\n', True,
                     'WebProcess', 8675)

        driver._crashed_process_name = None
        driver._crashed_pid = None
        driver._server_process = FakeServerProcess(True)
        assert_crash(driver, '', True, 'FakeServerProcess', 1234)
Example #25
0
 def cmd_line(self):
     wrapper_path = self._port.path_from_webkit_base(
         "Tools", "gtk", "run-with-jhbuild")
     return [wrapper_path] + WebKitDriver.cmd_line(self)
Example #26
0
 def cmd_line(self):
     wrapper_path = self._port.path_from_webkit_base("Tools", "gtk", "run-with-jhbuild")
     return [wrapper_path] + WebKitDriver.cmd_line(self)
Example #27
0
 def test_no_timeout(self):
     port = TestWebKitPort()
     driver = WebKitDriver(port, 0, pixel_tests=True, no_timeout=True)
     self.assertEquals(driver.cmd_line(True, []), ['MOCK output of child process/DumpRenderTree', '--no-timeout', '--pixel-tests', '-'])
Example #28
0
 def test_creating_a_port_does_not_write_to_the_filesystem(self):
     port = TestWebKitPort()
     driver = WebKitDriver(port, 0, pixel_tests=True)
     self.assertEquals(port._filesystem.written_files, {})
     self.assertEquals(port._filesystem.last_tmpdir, None)