0
Commit Graph

33 Commits

Author SHA1 Message Date
Chris Hall
59f8d0c7c6 Add presubmit check for relnotes field in accessibility changes.
R=akihiroota,dmazzoni,jam,dpranke

Change-Id: I37d5035967941da1d2e3d671426133668b87f0f3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2162427
Commit-Queue: Chris Hall <chrishall@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Reviewed-by: Akihiro Ota <akihiroota@chromium.org>
Cr-Commit-Position: refs/heads/master@{#764594}
2020-05-01 07:31:19 +00:00
Dan Beam
35b10c1a1f Remove --color from ESLint output when running in presubmit
Fixed: 862792
Change-Id: I250e91a1db5f8df71fff33c17c7a04a9fd6c8739
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1937584
Commit-Queue: Dan Beam <dbeam@chromium.org>
Auto-Submit: Dan Beam <dbeam@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Demetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#719450}
2019-11-27 01:17:34 +00:00
Alexei Svitkine
137d4c668b Fix PRESUMBIT_tests.py on Windows.
MockInputApi was returning MockFile objects instead of strings
from LocalPaths() API, which apparently trips up Windows Python
APIs, but not Unix ones.

Bug: 984360
Change-Id: I0a14cc07a9406d84d6b20d104d002fe67cc4ae86
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1706577
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Commit-Queue: Alexei Svitkine <asvitkine@chromium.org>
Cr-Commit-Position: refs/heads/master@{#678454}
2019-07-17 21:28:24 +00:00
Julian Pastarmov
4f7af53fcb Fix the PRESUBMIT.py script to properly invoke grit
The grd reader is invoked from _GetGrdMessages with defines which
specify "chromium" build.

Drive-by fix for the MockFile to support basename on Windows.

BUG=984910
TEST=A modified grd fail doesn't trip the presubmit run.

Change-Id: I1b30dcaf8b91d40292e631ba854b4f0dfa54de69
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1705799
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Commit-Queue: Julian Pastarmov <pastarmovj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#678407}
2019-07-17 19:25:37 +00:00
Wei-Yin Chen (陳威尹)
b1ce35493b Check parameter types in FilterSourceFile() mock
Parameters |white_list| and |black_list| in FilterSourceFile()
should be iterables, and it's fairly easy to wrongly pass a string
instead.

This checking caught _CheckCrbugLinksHaveHttps in unit tests.

Bug: 869103
Change-Id: I1cd6d62c3fa2b1500d9d7b6b35794f40e35378af
Reviewed-on: https://chromium-review.googlesource.com/1155379
Commit-Queue: Wei-Yin Chen (陳威尹) <wychen@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579288}
2018-07-31 02:37:01 +00:00
Vaclav Brozek
f01ed503dc Add tests for 'ForTesting' presubmit check
The root PRESUBMIT.py contains
_CheckNoProductionCodeUsingTestOnlyFunctions which checks against
including a call to a 'for testing only' method in production code.
That check has not been tested. This CL adds two tests for it.

Additionally, the CL also fixes two issues in the presubmit tests:
 * FilterSourceFile in PRESUBMIT_test_mocks.py did not match the
   production version from tools/depot_tools/presubmit_support.py: the
   production requires the filename to be in the whitelist, while the
   mock version was OK with just not being in the blacklist. The CL
   modifies the mock version to match the production.
 * The test for _CheckAndroidTestJUnitInheritance did not adhere to
   the whitelisted filename pattern (*Test.java). This CL changes the
   names of the fake files to match the pattern.

Bug: 821981
Change-Id: I65edf07ddb2ae26ad7d08ceb7cf4d51b482b5e56
Reviewed-on: https://chromium-review.googlesource.com/966605
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Vaclav Brozek <vabr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543783}
2018-03-16 19:38:24 +00:00
Zhiling Huang
45cabf3788 Run pydeps check only in src.
Bug: 803245
Change-Id: I645e82663991cd012ced5f19a056d08bbc2c797d
Reviewed-on: https://chromium-review.googlesource.com/952281
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Zhiling Huang <hzl@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542297}
2018-03-10 00:50:03 +00:00
Sylvain Defresne
a8b73d2584 Ensure autorelease pool is drained between tests
The testing::Test fixture (used by TEST macro) does not drain the
autorelease pool after a test. PlatformTest should be used.

Add a PRESUBMIT check that neither TEST nor testing::Test is used
in iOS Objective-C++ test files. Files are assumed to be iOS if
either their base name match '\bios\b' or one of the component in
the path is 'ios'.

Expand MockInputApi to filter files in mocks of AffectedFiles and
AffectedSourceFiles function, adding missing mocked functions too.
Fix unit tests that were failing after the filtering is correctly
implemented.

Bug: none
Change-Id: I0af99b6658b8e15888dfcfb94345eb879ab9fd37
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Reviewed-on: https://chromium-review.googlesource.com/937204
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: Rohit Rao <rohitrao@chromium.org>
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#539829}
2018-02-28 15:45:54 +00:00
Daniel Cheng
7052cdff01 Auto-CC ipc-security-reviews@ when changing IPC-related files.
Bug: 786386
Change-Id: I28d5809389aa86ee274b17725ca5312d4b8bb3ae
Reviewed-on: https://chromium-review.googlesource.com/776411
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#518329}
2017-11-21 19:23:29 +00:00
Daniel Cheng
264a447d21 Add tests for enforcing C++ dependencies in PRESUBMIT
This CL omits tests for directories where dependencies aren't checked:
PRESUBMIT test mocks is missing support for FileSourceFilter. This will
be added to test mocks along with the missing tests in a followup CL.

Bug: 763980
Change-Id: Ibf9265911f32d24f446e690d9ec05ddb7a61f198
Reviewed-on: https://chromium-review.googlesource.com/671812
Reviewed-by: Kent Tamura <tkent@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#505189}
2017-09-28 22:17:59 +00:00
Yoland Yan
b92fa52719 Add Presubmit Warnings for Junit4
These presubmit warnings prevent people from adding new JUnit3 tests or
use inheritance in JUnit4 testing, it also prevent people from using
the deprecated JUnit framework.

For more on JUnit4 migration, please check
//testing/android/docs/junit4.md

Bug: 640116
Change-Id: I941b595f6fbc01ac60a2647ab0af64482596d9cc
Reviewed-on: https://chromium-review.googlesource.com/634603
Commit-Queue: Yoland Yan <yolandyan@chromium.org>
Reviewed-by: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#497790}
2017-08-28 17:37:06 +00:00
Daniel Cheng
13ca61a886 Enforce that mojo manifests are covered by security reviewers.
Since mojo manifests don't have a consistent naming convention, this
simply looks for JSON files with the "interface_provider_specs" key:
there are some manifests that don't specify this, but the important
part for security review is auditing what's exposed between processes.

Bug: 695922
Change-Id: Id30dae51ecc0cbfa35650ead14ef2dfd081c23d7
Reviewed-on: https://chromium-review.googlesource.com/621707
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Ken Rockot <rockot@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#497410}
2017-08-25 15:11:25 +00:00
dpapad
5c9c24ec6d js_checker.py: Restore smoke tests for linting violations.
Restoring test to ensure that document.getElementById() calls are flagged as
style violations, now that these checks are performed via ESLint. These tests
are not meant to be exhaustive, instead they just validate that our PRESUBMIT
integration with ESLint works.

BUG=720034

Review-Url: https://codereview.chromium.org/2917473002
Cr-Commit-Position: refs/heads/master@{#476014}
2017-05-31 20:51:34 +00:00
jbriance
2c51e821a6 Presubmit: Skip third_party for fwd decl warning
Skip presubmit warning when the introduced useless forward
declaration is made in third_party (with the exception of
blink). Take the opportunity to fix one test and style.

BUG=662195
TEST=PRESUBMIT_test.py ForwardDeclarationTest

Review-Url: https://codereview.chromium.org/2568473002
Cr-Commit-Position: refs/heads/master@{#437833}
2016-12-12 08:27:18 +00:00
jbriance
9e12f16d49 Presubmit: Warn about useless forward declarations
Checks that added or removed lines in affected header files
do not lead to new useless class or struct forward declaration.

BUG=662195
TEST=PRESUBMIT_test.py ForwardDeclarationTest

Review-Url: https://codereview.chromium.org/2532583002
Cr-Commit-Position: refs/heads/master@{#434449}
2016-11-25 07:59:45 +00:00
pastarmovj
89f7ee10f0 Adds new logging type SYSLOG which logs to the system log.
On Windows this type logs to the Event Log and on POSIX systems it logs to the messages log (or its equvalent).

As a side effect of adding the presubmit check for it this
CL fixes running the presumbit checks tests on Windows.

BUG=642115

Review-Url: https://codereview.chromium.org/2296783002
Cr-Commit-Position: refs/heads/master@{#419758}
2016-09-20 14:59:43 +00:00
rdevlin.cronin
1136682513 [Closure Externs] Fix presubmit check
Have the presubmit script check all affected files instead of only
those in the presubmit directory. Avoids false positives.

BUG=469920

Review-Url: https://codereview.chromium.org/1925273002
Cr-Commit-Position: refs/heads/master@{#390968}
2016-05-02 17:07:22 +00:00
agrieve
bb9c5b47a3 Skip the .pydeps presubmit check on windows
BUG=600604

Review URL: https://codereview.chromium.org/1911813002

Cr-Commit-Position: refs/heads/master@{#389109}
2016-04-22 15:14:34 +00:00
agrieve
f32bcc73df Reland of Include isolate.py in data for Android unit tests
Now unconditionally including some directory trees to capture imports that differ based on python version (at least those that have come up so far).

BUG=589318, 599692

Review URL: https://codereview.chromium.org/1846103005

Cr-Commit-Position: refs/heads/master@{#384907}
2016-04-04 14:59:51 +00:00
sergiyb
b4f617bded Revert of Include isolate.py in data for Android unit tests (patchset id:200001 of https://codereview.chromium.org/1840113002/ )
Reason for revert:
Speculative revert, see http://crbug.com/599692.

Original issue's description:
> Reland of Include isolate.py in data for Android unit tests
>
> Now with check disabled for non-android checkouts.
>
> This is required for any test that uses an .isolate to push files to the
> device (e.g. base_unittests).
>
> BUG=589318
>
> Committed: https://crrev.com/4b6084284590609810fb2c0653fd1b42c6fcaddb
> Cr-Commit-Position: refs/heads/master@{#384039}

TBR=jochen@chromium.org,jbudorick@chromium.org,agrieve@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=589318, 599692

Review URL: https://codereview.chromium.org/1851773002

Cr-Commit-Position: refs/heads/master@{#384557}
2016-04-01 12:03:44 +00:00
agrieve
4b60842845 Reland of Include isolate.py in data for Android unit tests
Now with check disabled for non-android checkouts.

This is required for any test that uses an .isolate to push files to the
device (e.g. base_unittests).

BUG=589318

Review URL: https://codereview.chromium.org/1840113002

Cr-Commit-Position: refs/heads/master@{#384039}
2016-03-30 18:52:08 +00:00
agrieve
e33676c3fa Revert of Include isolate.py in data for Android unit tests (patchset id:80001 of https://codereview.chromium.org/1784373002/ )
Reason for revert:
PRESUBMIT isn't working for non-android checkouts, as shown by:

https://codereview.chromium.org/1840913002/diff/1/build/android/test_runner.pydeps#oldcode138

Original issue's description:
> Include isolate.py in data for Android unit tests
>
> This is required for any test that uses an .isolate to push files to the
> device (e.g. base_unittests).
>
> BUG=589318
>
> Committed: https://crrev.com/9e299ea6bbf87415d64d9d84003162d71304ccb9
> Cr-Commit-Position: refs/heads/master@{#383127}

TBR=jochen@chromium.org,jbudorick@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=589318

Review URL: https://codereview.chromium.org/1839103002

Cr-Commit-Position: refs/heads/master@{#383733}
2016-03-29 15:48:24 +00:00
agrieve
9e299ea6bb Include isolate.py in data for Android unit tests
This is required for any test that uses an .isolate to push files to the
device (e.g. base_unittests).

BUG=589318

Review URL: https://codereview.chromium.org/1784373002

Cr-Commit-Position: refs/heads/master@{#383127}
2016-03-24 20:08:06 +00:00
rdevlin.cronin
9ab806c3e9 [Extern Generation] Add a presubmit script to check externs not being updated
Add a presubmit script that checks for when extension api files are touched, but
the corresponding extern file is not. Right now, this is very simple - it only
checks that the extern is modified in some way (doesn't validate that it's the
*right* way), and is only a warning (because sometimes api file changes don't
cause extern changes). As an improvement, we would validate that the extern
files contain the proper content - let's do that later.

This will also be rolled out piecemeal, since many APIs don't currently have a
dedicated extern file. This change only imposes the check on bluetooth (because
it was handy) - if all goes well, we'll roll this out to all api files.

Also establish a dedicated extern folder, since it's silly for chrome-generated
externs to live in third_party/.

BUG=469920

Review URL: https://codereview.chromium.org/1718243003

Cr-Commit-Position: refs/heads/master@{#378018}
2016-02-26 23:18:40 +00:00
dbeam
37e8e740cb Add presubmit warning about deprecated compiled_resources.gyp
Just use v2 instead ;) (compiled_resources2.gyp)

R=maruel@chromium.org,cpu@chromium.org
BUG=585553

Review URL: https://codereview.chromium.org/1686663002

Cr-Commit-Position: refs/heads/master@{#374762}
2016-02-10 23:00:46 +00:00
davileen
e0426257f8 Add PRESUBMIT tests for _CheckUserActionUpdate function.
Presubmit does not contain any tests for the _CheckUserActionUpdate
function. This commit adds a test to check against an action in
actions.xml and one that is not found there. To do this we have to
improve the MockInputApi and MockFile classes.

BUG=462814

Review URL: https://codereview.chromium.org/966703003

Cr-Commit-Position: refs/heads/master@{#318759}
2015-03-02 21:11:31 +00:00
gayane
940df072ba Presubmit for chrome/browser/resources matches multiline metric type.
Also added a testcase for it and a nice print of errors.

BUG=443026

Review URL: https://codereview.chromium.org/809053003

Cr-Commit-Position: refs/heads/master@{#317794}
2015-02-24 14:29:00 +00:00
glider
e61efad3b3 Reland https://codereview.chromium.org/929043002/: Add a presubmit check that warns about declaring Singleton<T> in header files
Add a presubmit check that warns about declaring Singleton<T> in header files
(except for base/memory/singleton.h)
This check is copied from presubmit_canned_checks.py in depot_tools/ with an
added exception for base/memory/singleton.h.
The corresponding code will be removed from presubmit_canned_checks.py afterwards.

BUG=349861

Review URL: https://codereview.chromium.org/933253002

Cr-Commit-Position: refs/heads/master@{#316852}
2015-02-18 17:40:14 +00:00
glider
99aac94df7 Revert of Add a presubmit check that warns about declaring Singleton<T> in header files (patchset id:20001 of https://codereview.chromium.org/929043002/)
Reason for revert:
Reverting because of presubmit crashes:

Traceback (most recent call last):
  File "/usr/local/google/ssd/depot_tools/git_cl.py", line 2983, in <module>
    sys.exit(main(sys.argv[1:]))
  File "/usr/local/google/ssd/depot_tools/git_cl.py", line 2969, in main
    return dispatcher.execute(OptionParser(), argv)
  File "/usr/local/google/ssd/depot_tools/subcommand.py", line 245, in execute
    return command(parser, args[1:])
  File "/usr/local/google/ssd/depot_tools/git_cl.py", line 1614, in CMDpresubmit
    change=cl.GetChange(base_branch, None))
  File "/usr/local/google/ssd/depot_tools/git_cl.py", line 936, in RunHook
    rietveld_obj=self.RpcServer())
  File "/usr/local/google/ssd/depot_tools/presubmit_support.py", line 1396, in DoPresubmitChecks
    results += executer.ExecPresubmitScript(presubmit_script, filename)
  File "/usr/local/google/ssd/depot_tools/presubmit_support.py", line 1313, in ExecPresubmitScript
    result = eval(function_name + '(*__args)', context)
  File "<string>", line 1, in <module>
  File "<string>", line 1727, in CheckChangeOnCommit
  File "<string>", line 1455, in _CommonChecks
  File "<string>", line 1322, in _CheckSingletonInHeaders
  File "/usr/local/google/ssd/depot_tools/presubmit_support.py", line 472, in ReadFile
    raise IOError('Access outside the repository root is denied.')
IOError: Access outside the repository root is denied.

Original issue's description:
> Add a presubmit check that warns about declaring Singleton<T> in header files
> (except for base/memory/singleton.h)
> This check is copied from presubmit_canned_checks.py in depot_tools/ with an
> added exception for base/memory/singleton.h.
> The corresponding code will be removed from presubmit_canned_checks.py afterwards.
>
> BUG=349861
> R=phajdan.jr@chromium.org,
>
> Committed: https://crrev.com/9b73d0393037452d13358f4e2766cb62adbdede8
> Cr-Commit-Position: refs/heads/master@{#316546}

TBR=phajdan.jr@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=349861

Review URL: https://codereview.chromium.org/934723003

Cr-Commit-Position: refs/heads/master@{#316559}
2015-02-17 11:19:16 +00:00
glider
9b73d03930 Add a presubmit check that warns about declaring Singleton<T> in header files
(except for base/memory/singleton.h)
This check is copied from presubmit_canned_checks.py in depot_tools/ with an
added exception for base/memory/singleton.h.
The corresponding code will be removed from presubmit_canned_checks.py afterwards.

BUG=349861
R=phajdan.jr@chromium.org,

Review URL: https://codereview.chromium.org/929043002

Cr-Commit-Position: refs/heads/master@{#316546}
2015-02-17 09:27:05 +00:00
gayane
e170266793 Looking into all changed files to find actions.xml.
In case actions.xml is included in the changelist the chrome/browser/resources/PRESUBMIT.py shouldn't run because the presubmit for actions.xml will do more complete job.

Fixing the bug to look into all changed files in the CL where previously it was only looking at subdirectories of current presubmit script to find actions.xml

BUG=439978

Review URL: https://codereview.chromium.org/760163004

Cr-Commit-Position: refs/heads/master@{#308244}
2014-12-13 03:49:29 +00:00
gayane
860db5c331 Fixing bugs introduced by new presubmit changes
Fixing issues introduced by https://codereview.chromium.org/719463003/.

- Fixing the constant suffix in case of boolean action
- comment fix for mocks.

BUG=439328

TBR=phajdan.jr@chromium.org, brettw@chromium.org

Review URL: https://codereview.chromium.org/757233004

Cr-Commit-Position: refs/heads/master@{#307030}
2014-12-05 16:18:18 +00:00
gayane
3dff8c2676 Presubmit checks for user actions introduced in HTML files.
This presubmit task will catch the case when HTML files are modified with new user action and action.xml is not updated

BUG=431393

Review URL: https://codereview.chromium.org/719463003

Cr-Commit-Position: refs/heads/master@{#306842}
2014-12-04 17:10:50 +00:00