Beispiel #1
0
    def _compare_output(self, expected_driver_output, driver_output):
        failures = []
        failures.extend(self._handle_error(driver_output))

        if driver_output.crash:
            # Don't continue any more if we already have a crash.
            # In case of timeouts, we continue since we still want to see the text and image output.
            return TestResult(
                self._test_name, failures, driver_output.test_time, driver_output.has_stderr(), pid=driver_output.pid
            )

        is_testharness_test, testharness_failures = self._compare_testharness_test(
            driver_output, expected_driver_output
        )
        if is_testharness_test:
            failures.extend(testharness_failures)
        else:
            failures.extend(self._compare_text(expected_driver_output.text, driver_output.text))
        failures.extend(self._compare_audio(expected_driver_output.audio, driver_output.audio))
        if self._should_run_pixel_test:
            failures.extend(self._compare_image(expected_driver_output, driver_output))
        has_repaint_overlay = repaint_overlay.result_contains_repaint_rects(
            expected_driver_output.text
        ) or repaint_overlay.result_contains_repaint_rects(driver_output.text)
        return TestResult(
            self._test_name,
            failures,
            driver_output.test_time,
            driver_output.has_stderr(),
            pid=driver_output.pid,
            has_repaint_overlay=has_repaint_overlay,
        )
Beispiel #2
0
    def _compare_output(self, expected_driver_output, driver_output):
        failures = []
        failures.extend(self._handle_error(driver_output))

        if driver_output.crash:
            # Don't continue any more if we already have a crash.
            # In case of timeouts, we continue since we still want to see the text and image output.
            return TestResult(self._test_name,
                              failures,
                              driver_output.test_time,
                              driver_output.has_stderr(),
                              pid=driver_output.pid,
                              crash_site=driver_output.crash_site)

        is_testharness_test, testharness_failures = self._compare_testharness_test(
            driver_output, expected_driver_output)
        if is_testharness_test:
            failures.extend(testharness_failures)

        compare_functions = []
        compare_image_fn = (self._compare_image, (expected_driver_output,
                                                  driver_output))
        compare_txt_fn = (self._compare_text, (expected_driver_output.text,
                                               driver_output.text))
        compare_audio_fn = (self._compare_audio, (expected_driver_output.audio,
                                                  driver_output.audio))

        if self._should_run_pixel_test_first:
            if driver_output.image_hash and self._should_run_pixel_test:
                compare_functions.append(compare_image_fn)
            elif not is_testharness_test:
                compare_functions.append(compare_txt_fn)
        else:
            if not is_testharness_test:
                compare_functions.append(compare_txt_fn)
            if self._should_run_pixel_test:
                compare_functions.append(compare_image_fn)
        compare_functions.append(compare_audio_fn)

        for func, args in compare_functions:
            failures.extend(func(*args))

        has_repaint_overlay = (repaint_overlay.result_contains_repaint_rects(
            expected_driver_output.text) or
                               repaint_overlay.result_contains_repaint_rects(
                                   driver_output.text))
        return TestResult(self._test_name,
                          failures,
                          driver_output.test_time,
                          driver_output.has_stderr(),
                          pid=driver_output.pid,
                          has_repaint_overlay=has_repaint_overlay)
    def test_generate_repaint_overlay_html(self):
        test_name = 'paint/invalidation/repaint-overlay/layers.html'
        host = Host()
        port = host.port_factory.get()
        layer_tree_file = port.expected_filename(test_name, '.txt')
        if not layer_tree_file or not host.filesystem.exists(layer_tree_file):
            # This can happen if the scripts are not in the standard blink directory.
            return

        layer_tree = str(host.filesystem.read_text_file(layer_tree_file))
        self.assertTrue(repaint_overlay.result_contains_repaint_rects(layer_tree))
        overlay_html = (
            '<!-- Generated by Tools/Scripts/test-webkitpy\n' +
            ' test case: TestRepaintOverlay.test_generate_repaint_overlay_html. -->\n' +
            repaint_overlay.generate_repaint_overlay_html(test_name, layer_tree, layer_tree))

        results_directory = port.results_directory()
        host.filesystem.maybe_make_directory(results_directory)
        actual_overlay_html_file = host.filesystem.join(results_directory, 'layers-overlay.html')
        host.filesystem.write_text_file(actual_overlay_html_file, overlay_html)

        overlay_html_file = port.abspath_for_test('paint/invalidation/repaint-overlay/layers-overlay.html')
        expected = host.filesystem.read_text_file(overlay_html_file)

        self.assertEquals(
            expected, overlay_html,
            'This failure is probably caused by changed repaint_overlay.py. '
            'Please examine the diffs:\n  diff %s %s\n'
            'If the diffs are valid, update the file:\n  cp %s %s\n'
            'then update layers-overlay-expected.html in the same directory if needed,'
            ' and commit the files together with the changed repaint_overlay.py.' %
            (overlay_html_file, actual_overlay_html_file, actual_overlay_html_file, overlay_html_file))
Beispiel #4
0
    def _compare_output(self, expected_driver_output, driver_output):
        failures = []
        failures.extend(self._handle_error(driver_output))

        if driver_output.crash:
            # Don't continue any more if we already have a crash.
            # In case of timeouts, we continue since we still want to see the text and image output.
            return TestResult(self._test_name, failures, driver_output.test_time, driver_output.has_stderr(),
                              pid=driver_output.pid)

        is_testharness_test, testharness_failures = self._compare_testharness_test(driver_output, expected_driver_output)
        if is_testharness_test:
            failures.extend(testharness_failures)
        else:
            failures.extend(self._compare_text(expected_driver_output.text, driver_output.text))
            failures.extend(self._compare_audio(expected_driver_output.audio, driver_output.audio))
            if self._should_run_pixel_test:
                failures.extend(self._compare_image(expected_driver_output, driver_output))
        has_repaint_overlay = (repaint_overlay.result_contains_repaint_rects(expected_driver_output.text) or
                               repaint_overlay.result_contains_repaint_rects(driver_output.text))
        return TestResult(self._test_name, failures, driver_output.test_time, driver_output.has_stderr(),
                          pid=driver_output.pid, has_repaint_overlay=has_repaint_overlay)
    def test_generate_repaint_overlay_html(self):
        test_name = 'paint/invalidation/repaint-overlay/layers.html'
        host = Host()
        port = host.port_factory.get()
        layer_tree_file = port.expected_filename(test_name, '.txt')
        if not layer_tree_file or not host.filesystem.exists(layer_tree_file):
            # This can happen if the scripts are not in the standard blink directory.
            return

        layer_tree = str(host.filesystem.read_text_file(layer_tree_file))
        self.assertTrue(
            repaint_overlay.result_contains_repaint_rects(layer_tree))
        overlay_html = (
            '<!-- Generated by Tools/Scripts/test-webkitpy\n' +
            ' test case: TestRepaintOverlay.test_generate_repaint_overlay_html. -->\n'
            + repaint_overlay.generate_repaint_overlay_html(
                test_name, layer_tree, layer_tree))
        overlay_html_test_name = 'paint/invalidation/repaint-overlay/layers-overlay.html'
        overlay_html_file = port.abspath_for_test(overlay_html_test_name)
        host.filesystem.write_text_file(overlay_html_file, overlay_html)
 def test_result_contains_repaint_rects(self):
     self.assertTrue(repaint_overlay.result_contains_repaint_rects(EXPECTED_TEXT))
     self.assertTrue(repaint_overlay.result_contains_repaint_rects(ACTUAL_TEXT))
     self.assertFalse(repaint_overlay.result_contains_repaint_rects('ABCD'))
 def test_result_contains_repaint_rects(self):
     self.assertTrue(
         repaint_overlay.result_contains_repaint_rects(LAYER_TREE))
     self.assertFalse(repaint_overlay.result_contains_repaint_rects('ABCD'))
 def test_result_contains_repaint_rects(self):
     self.assertTrue(repaint_overlay.result_contains_repaint_rects(LAYER_TREE))
     self.assertFalse(repaint_overlay.result_contains_repaint_rects('ABCD'))
Beispiel #9
0
 def test_result_contains_repaint_rects(self):
     self.assertTrue(
         repaint_overlay.result_contains_repaint_rects(EXPECTED_TEXT))
     self.assertTrue(
         repaint_overlay.result_contains_repaint_rects(ACTUAL_TEXT))
     self.assertFalse(repaint_overlay.result_contains_repaint_rects('ABCD'))