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

Unified Diff: PRESUBMIT_test.py

Issue 1403673003: Add additional hosts to hard-coded service URL presubmit check (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « PRESUBMIT.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: PRESUBMIT_test.py
diff --git a/PRESUBMIT_test.py b/PRESUBMIT_test.py
index 4d40d8f9712239289a44046608b0f4c8d04e9cf8..2d04d119a337142fc4dbd3a340684cf51f984bd1 100755
--- a/PRESUBMIT_test.py
+++ b/PRESUBMIT_test.py
@@ -944,6 +944,35 @@ class LogUsageTest(unittest.TestCase):
self.assertTrue('HasDottedTag.java' in msgs[4].items)
self.assertTrue('HasOldTag.java' in msgs[4].items)
+class HardcodedGoogleHostsTest(unittest.TestCase):
+
+ def testWarnOnAssignedLiterals(self):
+ input_api = MockInputApi()
+ input_api.files = [
+ MockFile('content/file.cc',
+ ['char* host = "https://www.google.com";']),
+ MockFile('content/file.cc',
+ ['char* host = "https://www.googleapis.com";']),
+ MockFile('content/file.cc',
+ ['char* host = "https://clients1.google.com";']),
+ ]
+
+ warnings = PRESUBMIT._CheckHardcodedGoogleHostsInLowerLayers(
+ input_api, MockOutputApi())
+ self.assertEqual(1, len(warnings))
+ self.assertEqual(3, len(warnings[0].items))
+
+ def testAllowInComment(self):
+ input_api = MockInputApi()
+ input_api.files = [
+ MockFile('content/file.cc',
+ ['char* host = "https://www.aol.com"; // google.com'])
+ ]
+
+ warnings = PRESUBMIT._CheckHardcodedGoogleHostsInLowerLayers(
+ input_api, MockOutputApi())
+ self.assertEqual(0, len(warnings))
+
if __name__ == '__main__':
unittest.main()
« no previous file with comments | « PRESUBMIT.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698