⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 118884 in webkit


Ignore:
Timestamp:
May 29, 2012, 8:15:25 PM (14 years ago)
Author:
ojan@chromium.org
Message:

Add a linter error for pngs that lack an embedded checksum
https://bugs.webkit.org/show_bug.cgi?id=87793

Reviewed by Dirk Pranke.

  • Scripts/read-checksum-from-png:
  • Scripts/webkitpy/common/read_checksum_from_png.py: Renamed from Tools/Scripts/webkitpy/layout_tests/read_checksum_from_png.py.

(read_checksum):

  • Scripts/webkitpy/common/read_checksum_from_png_unittest.py: Renamed from Tools/Scripts/webkitpy/layout_tests/read_checksum_from_png_unittest.py.

(ReadChecksumFromPngTest):
(ReadChecksumFromPngTest.test_read_checksum):

  • Scripts/webkitpy/layout_tests/port/base.py:
  • Scripts/webkitpy/style/checkers/png.py:

(PNGChecker.check):

  • Scripts/webkitpy/style/checkers/png_unittest.py:

(PNGCheckerTest.test_check):

Location:
trunk/Tools
Files:
5 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r118860 r118884  
     12012-05-29  Ojan Vafai  <ojan@chromium.org>
     2
     3        Add a linter error for pngs that lack an embedded checksum
     4        https://bugs.webkit.org/show_bug.cgi?id=87793
     5
     6        Reviewed by Dirk Pranke.
     7
     8        * Scripts/read-checksum-from-png:
     9        * Scripts/webkitpy/common/read_checksum_from_png.py: Renamed from Tools/Scripts/webkitpy/layout_tests/read_checksum_from_png.py.
     10        (read_checksum):
     11        * Scripts/webkitpy/common/read_checksum_from_png_unittest.py: Renamed from Tools/Scripts/webkitpy/layout_tests/read_checksum_from_png_unittest.py.
     12        (ReadChecksumFromPngTest):
     13        (ReadChecksumFromPngTest.test_read_checksum):
     14        * Scripts/webkitpy/layout_tests/port/base.py:
     15        * Scripts/webkitpy/style/checkers/png.py:
     16        (PNGChecker.check):
     17        * Scripts/webkitpy/style/checkers/png_unittest.py:
     18        (PNGCheckerTest.test_check):
     19
    1202012-05-29  Stephanie Lewis  <slewis@apple.com>
    221
  • trunk/Tools/Scripts/read-checksum-from-png

    r82279 r118884  
    3131import sys
    3232
    33 from webkitpy.layout_tests import read_checksum_from_png
     33from webkitpy.common import read_checksum_from_png
    3434
    3535
  • trunk/Tools/Scripts/webkitpy/common/read_checksum_from_png_unittest.py

    r118883 r118884  
    2525import StringIO
    2626import unittest
    27 from webkitpy.layout_tests import read_checksum_from_png
     27from webkitpy.common import read_checksum_from_png
    2828
    2929
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py

    r118408 r118884  
    3737import re
    3838
     39from webkitpy.common import find_files
     40from webkitpy.common import read_checksum_from_png
    3941from webkitpy.common.memoized import memoized
    4042from webkitpy.common.system import path
    41 from webkitpy.common import find_files
    4243from webkitpy.common.system import logutils
    4344from webkitpy.common.system.executive import ScriptError
    4445from webkitpy.common.system.systemhost import SystemHost
    45 from webkitpy.layout_tests import read_checksum_from_png
    4646from webkitpy.layout_tests.models.test_configuration import TestConfiguration
    4747from webkitpy.layout_tests.port import config as port_config
  • trunk/Tools/Scripts/webkitpy/style/checkers/png.py

    r116947 r118884  
    2828import re
    2929
     30from webkitpy.common import read_checksum_from_png
    3031from webkitpy.common.system.systemhost import SystemHost
    3132from webkitpy.common.checkout.scm.detection import SCMDetector
    32 
    3333
    3434class PNGChecker(object):
     
    4848        config_file_path = ""
    4949        detection = self._detector.display_name()
     50
     51        if self._fs.exists(self._file_path):
     52            with self._fs.open_binary_file_for_reading(self._file_path) as filehandle:
     53                if not read_checksum_from_png.read_checksum(filehandle):
     54                    self._handle_style_error(0, 'image/png', 5, "Image lacks a checksum. Generate pngs using run-webkit-tests to ensure they have a checksum.")
    5055
    5156        if detection == "git":
  • trunk/Tools/Scripts/webkitpy/style/checkers/png_unittest.py

    r115900 r118884  
    114114        self.assertEquals(len(errors), 1)
    115115
     116        file_path = "foo.png"
     117        fs.write_binary_file(file_path, "Dummy binary data")
     118        scm = MockSCMDetector('git')
     119        errors = []
     120        checker = PNGChecker(file_path, mock_handle_style_error, scm, MockSystemHost(os_name='linux', filesystem=fs))
     121        checker.check()
     122        self.assertEquals(len(errors), 2)
     123        self.assertEquals(errors[0], (0, 'image/png', 5, 'Image lacks a checksum. Generate pngs using run-webkit-tests to ensure they have a checksum.'))
    116124
    117125if __name__ == '__main__':
Note: See TracChangeset for help on using the changeset viewer.