OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.download; | 5 package org.chromium.chrome.browser.download; |
6 | 6 |
7 import android.support.test.filters.SmallTest; | 7 import android.support.test.filters.SmallTest; |
8 import android.test.InstrumentationTestCase; | 8 |
| 9 import org.junit.Assert; |
| 10 import org.junit.Test; |
| 11 import org.junit.runner.RunWith; |
9 | 12 |
10 import org.chromium.base.test.util.Feature; | 13 import org.chromium.base.test.util.Feature; |
| 14 import org.chromium.chrome.test.ChromeJUnit4ClassRunner; |
11 | 15 |
12 /** | 16 /** |
13 * Tests of {@link DownloadUtils}. | 17 * Tests of {@link DownloadUtils}. |
14 */ | 18 */ |
15 public class DownloadUtilsTest extends InstrumentationTestCase { | 19 @RunWith(ChromeJUnit4ClassRunner.class) |
| 20 public class DownloadUtilsTest { |
16 /** | 21 /** |
17 * Test {@link DownloadUtils#getAbbrieviatedFileName()} method. | 22 * Test {@link DownloadUtils#getAbbrieviatedFileName()} method. |
18 */ | 23 */ |
| 24 @Test |
19 @SmallTest | 25 @SmallTest |
20 @Feature({"Download"}) | 26 @Feature({"Download"}) |
21 public void testGetAbbrieviatedFileName() { | 27 public void testGetAbbrieviatedFileName() { |
22 assertEquals("123.pdf", DownloadUtils.getAbbreviatedFileName("123.pdf",
10)); | 28 Assert.assertEquals("123.pdf", DownloadUtils.getAbbreviatedFileName("123
.pdf", 10)); |
23 assertEquals("1" + DownloadUtils.ELLIPSIS, | 29 Assert.assertEquals( |
24 DownloadUtils.getAbbreviatedFileName("123.pdf", 1)); | 30 "1" + DownloadUtils.ELLIPSIS, DownloadUtils.getAbbreviatedFileNa
me("123.pdf", 1)); |
25 assertEquals("12" + DownloadUtils.ELLIPSIS, | 31 Assert.assertEquals( |
26 DownloadUtils.getAbbreviatedFileName("1234567", 2)); | 32 "12" + DownloadUtils.ELLIPSIS, DownloadUtils.getAbbreviatedFileN
ame("1234567", 2)); |
27 assertEquals("123" + DownloadUtils.ELLIPSIS + ".pdf", | 33 Assert.assertEquals("123" + DownloadUtils.ELLIPSIS + ".pdf", |
28 DownloadUtils.getAbbreviatedFileName("1234567.pdf", 7)); | 34 DownloadUtils.getAbbreviatedFileName("1234567.pdf", 7)); |
29 } | 35 } |
30 } | 36 } |
OLD | NEW |