Tweak Java and C++ test-only documentation.

Bug: 1079253
Change-Id: I30a45ef2eebcf946eecde0d5806478b4a4c3cbfa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2186364
Reviewed-by: Jeremy Roman <[email protected]>
Reviewed-by: Andrew Grieve <[email protected]>
Commit-Queue: Jeremy Roman <[email protected]>
Auto-Submit: Caitlin Fischer <[email protected]>
Cr-Commit-Position: refs/heads/master@{#766552}
diff --git a/styleguide/java/java.md b/styleguide/java/java.md
index f3ee6e0..f3e3195c 100644
--- a/styleguide/java/java.md
+++ b/styleguide/java/java.md
@@ -213,6 +213,15 @@
 1. java
 1. javax
 
+## Test-only Code
+Functions used only for testing should be restricted to test-only usages
+with the testing suffixes supported by
+[PRESUMBIT.py](https://chromium.googlesource.com/chromium/src/+/master/
+PRESUBMIT.py).
+`ForTesting` is the conventional suffix although similar patterns, such as
+`ForTest`, are also accepted. These suffixes are checked at presubmit time
+to ensure the functions are called only by test files.
+
 ## Location
 "Top level directories" are defined as directories with a GN file, such as
 [//base](https://chromium.googlesource.com/chromium/src/+/master/base/)