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

Unified Diff: docs/android_logging.md

Issue 1581983002: [doc] logging: explain how to enable it in junit tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | « base/android/java/src/org/chromium/base/Log.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: docs/android_logging.md
diff --git a/docs/android_logging.md b/docs/android_logging.md
index c8404e3ba461944780747ed9307d0920ea74ab57..382d2f19048bdcb6ec82f67f770e2504a74c83dd 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
+}
+```
« no previous file with comments | « base/android/java/src/org/chromium/base/Log.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698