Chromium Code Reviews| Index: content/public/android/junit/src/org/chromium/base/LogTest.java |
| diff --git a/content/public/android/junit/src/org/chromium/base/LogTest.java b/content/public/android/junit/src/org/chromium/base/LogTest.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..89da608aa0710b4c8d21b291826201bba253d751 |
| --- /dev/null |
| +++ b/content/public/android/junit/src/org/chromium/base/LogTest.java |
| @@ -0,0 +1,31 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +package org.chromium.base; |
|
Yaron
2015/04/01 20:47:31
This should be in a base/ folder if it's package b
dgn
2015/04/02 12:47:20
It's a unit test, no apk required to run it. I can
Yaron
2015/04/02 14:29:47
Ok, sounds good
|
| + |
| +import static org.junit.Assert.assertFalse; |
| + |
| +import org.chromium.testing.local.LocalRobolectricTestRunner; |
| +import org.junit.Test; |
| +import org.junit.runner.RunWith; |
| +import org.robolectric.annotation.Config; |
| + |
| +@RunWith(LocalRobolectricTestRunner.class) |
| +@Config(manifest = Config.NONE) |
| +public class LogTest { |
| + @Test(expected = IllegalArgumentException.class) |
| + public void tooLongTagExceptionTest() { |
| + new Log("OneCharTooLong!"); |
| + } |
| + |
| + @Test |
| + public void allowedTagsNoExceptionTest() { |
| + // See android.util.Log#isLoggable(String, int)}'s doc. |
| + final int maxAllowedTagLength = 23; |
| + assertFalse(new Log(null).mTag.length() > maxAllowedTagLength); |
| + assertFalse(new Log("").mTag.length() > maxAllowedTagLength); |
| + assertFalse(new Log("Foo").mTag.length() > maxAllowedTagLength); |
| + assertFalse(new Log("LongestAllowed").mTag.length() > maxAllowedTagLength); |
| + } |
| +} |