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

Unified Diff: tests/presubmit_unittest.py

Issue 9323016: [WebUI] Add some presubmit checks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 8 years, 11 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 side-by-side diff with in-line comments
Download patch
« presubmit_canned_checks.py ('K') | « presubmit_canned_checks.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/presubmit_unittest.py
diff --git a/tests/presubmit_unittest.py b/tests/presubmit_unittest.py
index 8753dc7249e91a0867cb3a2619ce2921d7997663..9a9ce450e8c473fd711416b6bb63a5641308302b 100755
--- a/tests/presubmit_unittest.py
+++ b/tests/presubmit_unittest.py
@@ -1457,27 +1457,38 @@ class CannedChecksUnittest(PresubmitTestsBase):
def testMembersChanged(self):
self.mox.ReplayAll()
members = [
- 'CheckBuildbotPendingBuilds',
- 'CheckChangeHasBugField', 'CheckChangeHasDescription',
- 'CheckChangeHasNoStrayWhitespace',
- 'CheckChangeHasOnlyOneEol', 'CheckChangeHasNoCR',
- 'CheckChangeHasNoCrAndHasOnlyOneEol', 'CheckChangeHasNoTabs',
- 'CheckChangeTodoHasOwner',
- 'CheckChangeHasQaField', 'CheckChangeHasTestedField',
- 'CheckChangeHasTestField',
- 'CheckChangeLintsClean',
- 'CheckChangeSvnEolStyle',
- 'CheckChangeWasUploaded',
- 'CheckDoNotSubmit',
- 'CheckDoNotSubmitInDescription', 'CheckDoNotSubmitInFiles',
- 'CheckLongLines', 'CheckTreeIsOpen', 'PanProjectChecks',
- 'CheckLicense',
- 'CheckOwners',
- 'CheckRietveldTryJobExecution',
- 'CheckSvnModifiedDirectories',
- 'CheckSvnForCommonMimeTypes', 'CheckSvnProperty',
- 'RunPythonUnitTests', 'RunPylint',
- 'RunUnitTests', 'RunUnitTestsInDirectory',
+ 'CheckBuildbotPendingBuilds',
+ 'CheckChangeHasBugField',
+ 'CheckChangeHasDescription',
+ 'CheckChangeHasNoCR',
+ 'CheckChangeHasNoCrAndHasOnlyOneEol',
+ 'CheckChangeHasNoStrayWhitespace',
+ 'CheckChangeHasNoTabs',
+ 'CheckChangeHasOnlyOneEol',
+ 'CheckChangeHasQaField',
+ 'CheckChangeHasTestedField',
+ 'CheckChangeHasTestField',
+ 'CheckChangeLintsClean',
+ 'CheckChangeSvnEolStyle',
+ 'CheckChangeTodoHasOwner',
+ 'CheckChangeWasUploaded',
+ 'CheckDoNotSubmit',
+ 'CheckDoNotSubmitInDescription',
+ 'CheckDoNotSubmitInFiles',
+ 'CheckLicense',
+ 'CheckLongLines', 'CheckTreeIsOpen',
+ 'CheckOwners',
+ 'CheckRietveldTryJobExecution',
+ 'CheckSvnForCommonMimeTypes',
+ 'CheckSvnModifiedDirectories',
+ 'CheckSvnProperty',
+ 'CheckWebDevStyleGuide',
+ 'PanProjectChecks',
+ 're',
+ 'RunPylint',
+ 'RunPythonUnitTests',
+ 'RunUnitTests',
+ 'RunUnitTestsInDirectory',
]
# If this test fails, you should add the relevant test.
self.compareMembers(presubmit_canned_checks, members)
@@ -2286,6 +2297,44 @@ class CannedChecksUnittest(PresubmitTestsBase):
'Found line ending with white spaces in:', results[0]._message)
self.checkstdout('')
+ def testCheckWebDevStyleGuide(self):
+ fake_file = 'fake.css'
+ fake_contents = """
+/* Comment */
+.badClass, #anotherSelector {
+ color:hsl(0, 5, 0%) #777777;
+ background: #369 0px 10px; /* comment */ }
+
+@media print /*
+ Comment.
+ */
+{
+ @-webkit-keyframe {
+ 0% {
+ blah: blah;
+ }
+ 0%{blar: blug;}
+ }
+} /** comment **/
+
+.app-contents:active:not(.suppress-active),
+.app:not(.click-focus):focus .app-contents:not(.suppress-active),
+html[dir="rtl"] .drag-representation:not(.placing) .app-contents {
+ border-radius: 10px;
+ -webkit-border-radius: 5px;
+}"""
+
+ change = presubmit.Change('fu', 'bar', self.fake_root_dir, None, 0, 0, None)
+ input_api = self.MockInputApi(change, False)
+ input_api.AffectedSourceFiles(mox.IgnoreArg()).AndReturn([fake_file])
+ input_api.ReadFile(fake_file).MultipleTimes().AndReturn(fake_contents)
+
+ self.mox.ReplayAll()
+
+ output = presubmit_canned_checks._CheckWebDevStyleGuide(
+ input_api, presubmit.OutputApi, None)
+
+ print "%s" % output
if __name__ == '__main__':
import unittest
« presubmit_canned_checks.py ('K') | « presubmit_canned_checks.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698