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

Side by Side Diff: chrome/browser/resources/test_presubmit.py

Issue 9808002: [WebUI] Make CSS presubmit play nice with grit XML. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: dpranke review Created 8 years, 9 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 | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Unit tests for Web Development Style Guide checker.""" 6 """Unit tests for Web Development Style Guide checker."""
7 7
8 import os 8 import os
9 import re 9 import re
10 import sys 10 import sys
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 202
203 def VerifyContentsProducesOutput(self, contents, output): 203 def VerifyContentsProducesOutput(self, contents, output):
204 self.fake_file.NewContents().AndReturn(contents.splitlines()) 204 self.fake_file.NewContents().AndReturn(contents.splitlines())
205 self.output_api.PresubmitError( 205 self.output_api.PresubmitError(
206 self.fake_file_name + ':\n' + output.strip()).AndReturn(None) 206 self.fake_file_name + ':\n' + output.strip()).AndReturn(None)
207 self.mox.ReplayAll() 207 self.mox.ReplayAll()
208 css_checker.CSSChecker(self.input_api, self.output_api).RunChecks() 208 css_checker.CSSChecker(self.input_api, self.output_api).RunChecks()
209 209
210 def testCssAlphaWithAtBlock(self): 210 def testCssAlphaWithAtBlock(self):
211 self.VerifyContentsProducesOutput(""" 211 self.VerifyContentsProducesOutput("""
212 <include src="../shared/css/cr/ui/overlay.css">
213 <include src="chrome://resources/totally-cool.css" />
214
212 /* A hopefully safely ignored comment and @media statement. /**/ 215 /* A hopefully safely ignored comment and @media statement. /**/
213 @media print { 216 @media print {
214 div { 217 div {
215 display: block; 218 display: block;
216 color: red; 219 color: red;
217 } 220 }
218 }""", """ 221 <if expr="not is macosx">
222 background-image: url(chrome://resources/BLAH); /* TODO(dbeam): Fix this. */
223 background-color: rgb(235, 239, 249);
224 </if>
225 <if expr="is_macosx">
226 background-color: white;
227 background-image: url(chrome://resources/BLAH2);
228 </if>
229 }
230
231 <if expr="is_macosx">
232 .language-options-right {
233 visibility: hidden;
234 opacity: 1; /* TODO(dbeam): Fix this. */
235 }
236 </if>""", """
219 - Alphabetize properties and list vendor specific (i.e. -webkit) above standard. 237 - Alphabetize properties and list vendor specific (i.e. -webkit) above standard.
220 display: block; 238 display: block;
221 color: red;""") 239 color: red;""")
222 240
223 def testCssAlphaWithNonStandard(self): 241 def testCssAlphaWithNonStandard(self):
224 self.VerifyContentsProducesOutput(""" 242 self.VerifyContentsProducesOutput("""
225 div { 243 div {
226 /* A hopefully safely ignored comment and @media statement. /**/ 244 /* A hopefully safely ignored comment and @media statement. /**/
227 color: red; 245 color: red;
228 -webkit-margin-start: 5px; 246 -webkit-margin-start: 5px;
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 background-position-x: 0em; 429 background-position-x: 0em;
412 background-position-y: 0ex; 430 background-position-y: 0ex;
413 border-width: 0em; 431 border-width: 0em;
414 border-width: 0mm; 432 border-width: 0mm;
415 height: 0cm; 433 height: 0cm;
416 width: 0in; 434 width: 0in;
417 """) 435 """)
418 436
419 if __name__ == '__main__': 437 if __name__ == '__main__':
420 unittest.main() 438 unittest.main()
OLDNEW
« no previous file with comments | « chrome/browser/resources/PRESUBMIT.py ('k') | chrome/browser/resources/web_dev_style/css_checker.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698