Exemple #1
0
    def _generate_baseline_links(self, test_basename, suffix, platform):
        """Generate links for baseline results (old, new and diff).

        Args:
          test_basename: base filename of the test
          suffix: baseline file suffixes: '.txt', '.png'
          platform: win, linux or mac

        Returns:
          html links for showing baseline results (old, new and diff)
        """

        baseline_filename = '%s-expected%s' % (test_basename, suffix)
        logging.debug('    baseline filename: "%s"', baseline_filename)

        new_file = get_result_file_fullpath(self._html_directory,
                                            baseline_filename, platform, 'new')
        logging.info('    New baseline file: "%s"', new_file)
        if not os.path.exists(new_file):
            logging.info('    No new baseline file: "%s"', new_file)
            return ''

        old_file = get_result_file_fullpath(self._html_directory,
                                            baseline_filename, platform, 'old')
        logging.info('    Old baseline file: "%s"', old_file)
        if suffix == '.png':
            html_td_link = self.HTML_TD_LINK_IMG
        else:
            html_td_link = self.HTML_TD_LINK

        links = ''
        if os.path.exists(old_file):
            links += html_td_link % {
                'uri': path_utils.filename_to_uri(old_file),
                'name': baseline_filename
            }
        else:
            logging.info('    No old baseline file: "%s"', old_file)
            links += self.HTML_TD_NOLINK % ''

        links += html_td_link % {
            'uri': path_utils.filename_to_uri(new_file),
            'name': baseline_filename
        }

        diff_file = get_result_file_fullpath(self._html_directory,
                                             baseline_filename, platform,
                                             'diff')
        logging.info('    Baseline diff file: "%s"', diff_file)
        if os.path.exists(diff_file):
            links += html_td_link % {
                'uri': path_utils.filename_to_uri(diff_file),
                'name': 'Diff'
            }
        else:
            logging.info('    No baseline diff file: "%s"', diff_file)
            links += self.HTML_TD_NOLINK % ''

        return links
    def _generate_baseline_links(self, test_basename, suffix, platform):
        """Generate links for baseline results (old, new and diff).

        Args:
          test_basename: base filename of the test
          suffix: baseline file suffixes: '.txt', '.png'
          platform: win, linux or mac

        Returns:
          html links for showing baseline results (old, new and diff)
        """

        baseline_filename = '%s-expected%s' % (test_basename, suffix)
        logging.debug('    baseline filename: "%s"', baseline_filename)

        new_file = get_result_file_fullpath(self._html_directory,
                                            baseline_filename, platform, 'new')
        logging.info('    New baseline file: "%s"', new_file)
        if not os.path.exists(new_file):
            logging.info('    No new baseline file: "%s"', new_file)
            return ''

        old_file = get_result_file_fullpath(self._html_directory,
                                            baseline_filename, platform, 'old')
        logging.info('    Old baseline file: "%s"', old_file)
        if suffix == '.png':
            html_td_link = self.HTML_TD_LINK_IMG
        else:
            html_td_link = self.HTML_TD_LINK

        links = ''
        if os.path.exists(old_file):
            links += html_td_link % {
                'uri': path_utils.filename_to_uri(old_file),
                'name': baseline_filename}
        else:
            logging.info('    No old baseline file: "%s"', old_file)
            links += self.HTML_TD_NOLINK % ''

        links += html_td_link % {'uri': path_utils.filename_to_uri(new_file),
                                 'name': baseline_filename}

        diff_file = get_result_file_fullpath(self._html_directory,
                                             baseline_filename, platform,
                                             'diff')
        logging.info('    Baseline diff file: "%s"', diff_file)
        if os.path.exists(diff_file):
            links += html_td_link % {'uri': path_utils.filename_to_uri(
                diff_file), 'name': 'Diff'}
        else:
            logging.info('    No baseline diff file: "%s"', diff_file)
            links += self.HTML_TD_NOLINK % ''

        return links
    def show_html(self):
        """Launch the rebaselining html in brwoser."""

        logging.info('Launching html: "%s"', self._html_file)

        html_uri = path_utils.filename_to_uri(self._html_file)
        webbrowser.open(html_uri, 1)

        logging.info('Html launched.')
Exemple #4
0
    def show_html(self):
        """Launch the rebaselining html in brwoser."""

        logging.info('Launching html: "%s"', self._html_file)

        html_uri = path_utils.filename_to_uri(self._html_file)
        webbrowser.open(html_uri, 1)

        logging.info('Html launched.')
    def _generate_html_for_one_test(self, test):
        """Generate html for one rebaselining test.

        Args:
          test: layout test name

        Returns:
          html that compares baseline results for the test.
        """

        test_basename = os.path.basename(os.path.splitext(test)[0])
        logging.info('  basename: "%s"', test_basename)
        rows = []
        for suffix in BASELINE_SUFFIXES:
            if suffix == '.checksum':
                continue

            logging.info('  Checking %s files', suffix)
            for platform in self._platforms:
                links = self._generate_baseline_links(test_basename, suffix,
                    platform)
                if links:
                    row = self.HTML_TD_NOLINK % self._get_baseline_result_type(
                        suffix)
                    row += self.HTML_TD_NOLINK % platform
                    row += links
                    logging.debug('    html row: %s', row)

                    rows.append(self.HTML_TR % row)

        if rows:
            test_path = os.path.join(path_utils.layout_tests_dir(), test)
            html = self.HTML_TR_TEST % (path_utils.filename_to_uri(test_path),
                test)
            html += self.HTML_TEST_DETAIL % ' '.join(rows)

            logging.debug('    html for test: %s', html)
            return self.HTML_TABLE_TEST % html

        return ''
Exemple #6
0
    def _generate_html_for_one_test(self, test):
        """Generate html for one rebaselining test.

        Args:
          test: layout test name

        Returns:
          html that compares baseline results for the test.
        """

        test_basename = os.path.basename(os.path.splitext(test)[0])
        logging.info('  basename: "%s"', test_basename)
        rows = []
        for suffix in BASELINE_SUFFIXES:
            if suffix == '.checksum':
                continue

            logging.info('  Checking %s files', suffix)
            for platform in self._platforms:
                links = self._generate_baseline_links(test_basename, suffix,
                                                      platform)
                if links:
                    row = self.HTML_TD_NOLINK % self._get_baseline_result_type(
                        suffix)
                    row += self.HTML_TD_NOLINK % platform
                    row += links
                    logging.debug('    html row: %s', row)

                    rows.append(self.HTML_TR % row)

        if rows:
            test_path = os.path.join(path_utils.layout_tests_dir(), test)
            html = self.HTML_TR_TEST % (path_utils.filename_to_uri(test_path),
                                        test)
            html += self.HTML_TEST_DETAIL % ' '.join(rows)

            logging.debug('    html for test: %s', html)
            return self.HTML_TABLE_TEST % html

        return ''