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

Unified Diff: PRESUBMIT_test.py

Issue 2768063004: Don't require DEPS OWNERS when moving lines around in a DEPS file. (Closed)
Patch Set: Revert test DEPS change Created 3 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 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 7f3ee91a4bbdbd2d71952a974c6e0e810ffdb21e..fdca995486edb691cee55783fb426ecec215ba7b 100755
--- a/PRESUBMIT_test.py
+++ b/PRESUBMIT_test.py
@@ -3,6 +3,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import os.path
import re
import subprocess
import unittest
@@ -469,41 +470,77 @@ class InvalidIfDefinedMacroNamesTest(unittest.TestCase):
class CheckAddedDepsHaveTetsApprovalsTest(unittest.TestCase):
- def testFilesToCheckForIncomingDeps(self):
- changed_lines = [
- '"+breakpad",',
- '"+chrome/installer",',
- '"+chrome/plugin/chrome_content_plugin_client.h",',
- '"+chrome/utility/chrome_content_utility_client.h",',
- '"+chromeos/chromeos_paths.h",',
- '"+components/crash/content",',
- '"+components/nacl/common",',
- '"+content/public/browser/render_process_host.h",',
- '"+jni/fooblat.h",',
- '"+grit", # For generated headers',
- '"+grit/generated_resources.h",',
- '"+grit/",',
- '"+policy", # For generated headers and source',
- '"+sandbox",',
- '"+tools/memory_watcher",',
- '"+third_party/lss/linux_syscall_support.h",',
+
+ def calculate(self, old_include_rules, old_specific_include_rules,
+ new_include_rules, new_specific_include_rules):
+ return PRESUBMIT._CalculateAddedDeps(
+ os.path, 'include_rules = %r\nspecific_include_rules = %r' % (
+ old_include_rules, old_specific_include_rules),
+ 'include_rules = %r\nspecific_include_rules = %r' % (
+ new_include_rules, new_specific_include_rules))
+
+ def testCalculateAddedDeps(self):
+ old_include_rules = [
+ '+base',
+ '-chrome',
+ '+content',
+ '-grit',
+ '-grit/",',
+ '+jni/fooblat.h',
+ '!sandbox',
]
- files_to_check = PRESUBMIT._FilesToCheckForIncomingDeps(re, changed_lines)
+ old_specific_include_rules = {
+ 'compositor\.*': {
+ '+cc',
+ },
+ }
+
+ new_include_rules = [
+ '-ash',
+ '+base',
+ '+chrome',
+ '+components',
+ '+content',
+ '+grit',
+ '+grit/generated_resources.h",',
+ '+grit/",',
+ '+jni/fooblat.h',
+ '+policy',
+ '+third_party/WebKit',
+ ]
+ new_specific_include_rules = {
+ 'compositor\.*': {
+ '+cc',
+ },
+ 'widget\.*': {
+ '+gpu',
+ },
+ }
+
expected = set([
- 'breakpad/DEPS',
- 'chrome/installer/DEPS',
- 'chrome/plugin/chrome_content_plugin_client.h',
- 'chrome/utility/chrome_content_utility_client.h',
- 'chromeos/chromeos_paths.h',
- 'components/crash/content/DEPS',
- 'components/nacl/common/DEPS',
- 'content/public/browser/render_process_host.h',
- 'policy/DEPS',
- 'sandbox/DEPS',
- 'tools/memory_watcher/DEPS',
- 'third_party/lss/linux_syscall_support.h',
+ 'chrome/DEPS',
+ 'gpu/DEPS',
+ 'components/DEPS',
+ 'policy/DEPS',
+ 'third_party/WebKit/DEPS',
])
- self.assertEqual(expected, files_to_check);
+ self.assertEqual(
+ expected,
+ self.calculate(old_include_rules, old_specific_include_rules,
+ new_include_rules, new_specific_include_rules))
+
+ def testCalculateAddedDepsIgnoresPermutations(self):
+ old_include_rules = [
+ '+base',
+ '+chrome',
+ ]
+ new_include_rules = [
+ '+chrome',
+ '+base',
+ ]
+ self.assertEqual(set(),
+ self.calculate(old_include_rules, {}, new_include_rules,
+ {}))
class JSONParsingTest(unittest.TestCase):
« 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