Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 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
| |
| 6 | |
| 7 import static org.junit.Assert.assertFalse; | |
| 8 | |
| 9 import org.chromium.testing.local.LocalRobolectricTestRunner; | |
| 10 import org.junit.Test; | |
| 11 import org.junit.runner.RunWith; | |
| 12 import org.robolectric.annotation.Config; | |
| 13 | |
| 14 @RunWith(LocalRobolectricTestRunner.class) | |
| 15 @Config(manifest = Config.NONE) | |
| 16 public class LogTest { | |
| 17 @Test(expected = IllegalArgumentException.class) | |
| 18 public void tooLongTagExceptionTest() { | |
| 19 new Log("OneCharTooLong!"); | |
| 20 } | |
| 21 | |
| 22 @Test | |
| 23 public void allowedTagsNoExceptionTest() { | |
| 24 // See android.util.Log#isLoggable(String, int)}'s doc. | |
| 25 final int maxAllowedTagLength = 23; | |
| 26 assertFalse(new Log(null).mTag.length() > maxAllowedTagLength); | |
| 27 assertFalse(new Log("").mTag.length() > maxAllowedTagLength); | |
| 28 assertFalse(new Log("Foo").mTag.length() > maxAllowedTagLength); | |
| 29 assertFalse(new Log("LongestAllowed").mTag.length() > maxAllowedTagLengt h); | |
| 30 } | |
| 31 } | |
| OLD | NEW |