Пример #1
0
    def compare_output(self, port, filename, output, test_args, configuration):
        """Implementation of CompareOutput that checks the output text against
        the expected text from the LayoutTest directory."""
        failures = []

        # If we're generating a new baseline, we pass.
        if test_args.new_baseline or test_args.reset_results:
            # Although all test_shell/DumpRenderTree output should be utf-8,
            # we do not ever decode it inside run-webkit-tests.  For some tests
            # DumpRenderTree may not output utf-8 text (e.g. webarchives).
            self._save_baseline_data(filename, output, ".txt", encoding=None,
                                     generate_new_baseline=test_args.new_baseline)
            return failures

        # Normalize text to diff
        output = self._get_normalized_output_text(output)
        expected = self._get_normalized_expected_text(filename)

        # Write output files for new tests, too.
        if port.compare_text(output, expected):
            # Text doesn't match, write output files.
            self.write_output_files(port, filename, ".txt", output,
                                    expected, encoding=None,
                                    print_text_diffs=True)

            if expected == '':
                failures.append(test_failures.FailureMissingResult())
            else:
                failures.append(test_failures.FailureTextMismatch(True))

        return failures
Пример #2
0
 def _compare_text(self, actual_text, expected_text):
     failures = []
     if (expected_text and actual_text and
             # Assuming expected_text is already normalized.
             self._port.compare_text(
                 self._get_normalized_output_text(actual_text),
                 expected_text)):
         failures.append(test_failures.FailureTextMismatch())
     elif actual_text and not expected_text:
         failures.append(test_failures.FailureMissingResult())
     return failures
Пример #3
0
 def _compare_text(self, actual_text, expected_text):
     failures = []
     if self._port.compare_text(
             self._get_normalized_output_text(actual_text),
             # Assuming expected_text is already normalized.
             expected_text):
         if expected_text == '':
             failures.append(test_failures.FailureMissingResult())
         else:
             failures.append(test_failures.FailureTextMismatch())
     return failures
Пример #4
0
 def _failures_from_row(cls, row, table_title):
     if table_title == cls.fail_key:
         return cls._failures_from_fail_row(row)
     if table_title == cls.crash_key:
         return [test_failures.FailureCrash()]
     if table_title == cls.webprocess_crash_key:
         return [test_failures.FailureCrash()]
     if table_title == cls.timeout_key:
         return [test_failures.FailureTimeout()]
     if table_title == cls.missing_key:
         return [test_failures.FailureMissingResult(), test_failures.FailureMissingImageHash(), test_failures.FailureMissingImage()]
     return None
Пример #5
0
    def test_parse_layout_test_results(self):
        failures = [
            test_failures.FailureMissingResult(),
            test_failures.FailureMissingImageHash(),
            test_failures.FailureMissingImage()
        ]
        testname = 'fast/repaint/no-caret-repaint-in-non-content-editable-element.html'
        expected_results = [test_results.TestResult(testname, failures)]

        results = LayoutTestResults._parse_results_html(
            self._example_results_html)
        self.assertEqual(expected_results, results)