Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/png.py

Issue 2014063002: Run format-webkit on webkitpy code (without string conversion). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright (C) 2012 Balazs Ankes (bank@inf.u-szeged.hu) University of Szeged 1 # Copyright (C) 2012 Balazs Ankes (bank@inf.u-szeged.hu) University of Szeged
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions 4 # modification, are permitted provided that the following conditions
5 # are met: 5 # are met:
6 # 1. Redistributions of source code must retain the above copyright 6 # 1. Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer. 7 # notice, this list of conditions and the following disclaimer.
8 # 2. Redistributions in binary form must reproduce the above copyright 8 # 2. Redistributions in binary form must reproduce the above copyright
9 # notice, this list of conditions and the following disclaimer in the 9 # notice, this list of conditions and the following disclaimer in the
10 # documentation and/or other materials provided with the distribution. 10 # documentation and/or other materials provided with the distribution.
(...skipping 13 matching lines...) Expand all
24 24
25 """Supports checking WebKit style in png files.""" 25 """Supports checking WebKit style in png files."""
26 26
27 27
28 from webkitpy.common import read_checksum_from_png 28 from webkitpy.common import read_checksum_from_png
29 from webkitpy.common.system.systemhost import SystemHost 29 from webkitpy.common.system.systemhost import SystemHost
30 from webkitpy.common.checkout.scm.detection import SCMDetector 30 from webkitpy.common.checkout.scm.detection import SCMDetector
31 31
32 32
33 class PNGChecker(object): 33 class PNGChecker(object):
34
34 """Check svn:mime-type for checking style""" 35 """Check svn:mime-type for checking style"""
35 36
36 categories = set(['image/png']) 37 categories = set(['image/png'])
37 38
38 def __init__(self, file_path, handle_style_error, host=None): 39 def __init__(self, file_path, handle_style_error, host=None):
39 self._file_path = file_path 40 self._file_path = file_path
40 self._handle_style_error = handle_style_error 41 self._handle_style_error = handle_style_error
41 self._host = host or SystemHost() 42 self._host = host or SystemHost()
42 self._fs = self._host.filesystem 43 self._fs = self._host.filesystem
43 44
44 def check(self, inline=None): 45 def check(self, inline=None):
45 errorstr = "" 46 errorstr = ""
46 config_file_path = "" 47 config_file_path = ""
47 48
48 if self._fs.exists(self._file_path) and self._file_path.endswith("-expec ted.png"): 49 if self._fs.exists(self._file_path) and self._file_path.endswith("-expec ted.png"):
49 with self._fs.open_binary_file_for_reading(self._file_path) as fileh andle: 50 with self._fs.open_binary_file_for_reading(self._file_path) as fileh andle:
50 if not read_checksum_from_png.read_checksum(filehandle): 51 if not read_checksum_from_png.read_checksum(filehandle):
51 self._handle_style_error( 52 self._handle_style_error(
52 0, 'image/png', 5, "Image lacks a checksum. Generate png s using run-webkit-tests to ensure they have a checksum.") 53 0, 'image/png', 5, "Image lacks a checksum. Generate png s using run-webkit-tests to ensure they have a checksum.")
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698