• Vaclav Brozek's avatar
    Add tests for 'ForTesting' presubmit check · f01ed503
    Vaclav Brozek authored
    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/966605Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
    Commit-Queue: Vaclav Brozek <vabr@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#543783}
    f01ed503
PRESUBMIT_test.py 54.1 KB