summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authordgn <dgn@chromium.org>2016-01-21 05:38:57 -0800
committerCommit bot <commit-bot@chromium.org>2016-01-21 13:39:56 +0000
commit0325c0f7584b37796d7c20e3c9a8c859b3063577 (patch)
tree35977e296b12bb140c08a10d324045ae96f4faf3 /docs
parent435741872d39afd2ed06142d4bbdeef2bac6a41e (diff)
downloadchromium_src-0325c0f7584b37796d7c20e3c9a8c859b3063577.zip
chromium_src-0325c0f7584b37796d7c20e3c9a8c859b3063577.tar.gz
chromium_src-0325c0f7584b37796d7c20e3c9a8c859b3063577.tar.bz2
[doc] logging: explain how to enable it in junit tests
BUG= Review URL: https://codereview.chromium.org/1581983002 Cr-Commit-Position: refs/heads/master@{#370682}
Diffstat (limited to 'docs')
-rw-r--r--docs/android_logging.md20
1 files changed, 20 insertions, 0 deletions
diff --git a/docs/android_logging.md b/docs/android_logging.md
index c8404e3..382d2f1 100644
--- a/docs/android_logging.md
+++ b/docs/android_logging.md
@@ -206,3 +206,23 @@ further.
For more, see the [related page on developer.android.com]
(http://developer.android.com/tools/debugging/debugging-log.html#filteringOutput)
+
+## Logs in JUnit tests
+
+We use [robolectric](http://robolectric.org/) to run our JUnit tests. It
+replaces some of the Android framework classes with "Shadow" classes
+to ensure that we can run our code in a regular JVM. `android.util.Log` is one
+of those replaced classes, and by default calling `Log` methods doesn't print
+anything.
+
+That default is not changed in the normal configuration, but if you need to
+enable logging locally or for a specific test, just add those few lines to your
+test:
+
+```java
+@Before
+public void setUp() {
+ ShadowLog.stream = System.out;
+ //you other setup here
+}
+```