Chromium Code Reviews| Index: chrome/browser/web_dev_style/css_checker_test.py |
| diff --git a/chrome/browser/web_dev_style/css_checker_test.py b/chrome/browser/web_dev_style/css_checker_test.py |
| index 84acc79490a44f2b58987d73b3c8890a481aee57..100547cbc5c336c2d8c0075b6369ff024a85a1da 100755 |
| --- a/chrome/browser/web_dev_style/css_checker_test.py |
| +++ b/chrome/browser/web_dev_style/css_checker_test.py |
| @@ -20,12 +20,9 @@ class CssCheckerTest(SuperMoxTestBase): |
| def setUp(self): |
| SuperMoxTestBase.setUp(self) |
| - self.fake_file_name = 'fake.css' |
| - |
| self.fake_file = self.mox.CreateMockAnything() |
| + # Actual calls to NewContents() and LocalPath() are defined in each test. |
| self.mox.StubOutWithMock(self.fake_file, 'LocalPath') |
| - self.fake_file.LocalPath().AndReturn(self.fake_file_name) |
| - # Actual calls to NewContents() are defined in each test. |
| self.mox.StubOutWithMock(self.fake_file, 'NewContents') |
| self.input_api = self.mox.CreateMockAnything() |
| @@ -43,13 +40,18 @@ class CssCheckerTest(SuperMoxTestBase): |
| self.mox.StubOutWithMock(self.output_api, 'PresubmitNotifyResult', |
| use_mock_anything=True) |
| - def VerifyContentsIsValid(self, contents): |
| + def CreateFile(self, contents, filename): |
|
Dan Beam
2016/01/27 02:50:45
nit: this should probably be _create_file or __cre
tsergeant
2016/01/27 03:12:14
Done.
|
| + self.fake_file_name = filename |
| + self.fake_file.LocalPath().AndReturn(self.fake_file_name) |
| self.fake_file.NewContents().AndReturn(contents.splitlines()) |
| + |
| + def VerifyContentsIsValid(self, contents, filename='fake.css'): |
|
Dan Beam
2016/01/27 02:50:45
nit: "contents are" or "content is"
tsergeant
2016/01/27 03:12:14
Done.
|
| + self.CreateFile(contents, filename) |
| self.mox.ReplayAll() |
| css_checker.CSSChecker(self.input_api, self.output_api).RunChecks() |
| - def VerifyContentsProducesOutput(self, contents, output): |
| - self.fake_file.NewContents().AndReturn(contents.splitlines()) |
| + def VerifyContentsProducesOutput(self, contents, output, filename='fake.css'): |
| + self.CreateFile(contents, filename) |
| self.output_api.PresubmitPromptWarning( |
| self.fake_file_name + ':\n' + output.strip()).AndReturn(None) |
| self.mox.ReplayAll() |
| @@ -428,6 +430,28 @@ body.alternate-logo #logo { |
| width: 0in; |
| """) |
| + def testHtmlInlineStyle(self): |
| + self.VerifyContentsProducesOutput("""<!doctype html> |
| +<html> |
| +<head> |
| + <!-- Don't warn about problems outside of style tags |
| + html, |
| + body { |
| + margin: 0; |
| + height: 100%; |
| + } |
| + --> |
| + <style> |
| + body { |
| + flex-direction:column; |
| + } |
| + </style> |
| +</head> |
| +</html>""", """ |
| +- Colons (:) should have a space after them. |
| + flex-direction:column; |
| +""", filename='test.html') |
| + |
| if __name__ == '__main__': |
| unittest.main() |