| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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.precache; | 5 package org.chromium.chrome.browser.precache; |
| 6 | 6 |
| 7 import android.support.test.filters.SmallTest; | 7 import android.support.test.filters.SmallTest; |
| 8 | 8 |
| 9 import org.junit.Assert; | 9 import org.junit.Assert; |
| 10 import org.junit.Rule; | 10 import org.junit.Rule; |
| 11 import org.junit.Test; | 11 import org.junit.Test; |
| 12 import org.junit.runner.RunWith; | 12 import org.junit.runner.RunWith; |
| 13 | 13 |
| 14 import org.chromium.base.ContextUtils; | 14 import org.chromium.base.ContextUtils; |
| 15 import org.chromium.base.library_loader.LibraryLoader; | 15 import org.chromium.base.library_loader.LibraryLoader; |
| 16 import org.chromium.base.test.BaseJUnit4ClassRunner; | |
| 17 import org.chromium.base.test.util.Feature; | 16 import org.chromium.base.test.util.Feature; |
| 18 import org.chromium.base.test.util.MetricsUtils.HistogramDelta; | 17 import org.chromium.base.test.util.MetricsUtils.HistogramDelta; |
| 19 import org.chromium.base.test.util.RetryOnFailure; | 18 import org.chromium.base.test.util.RetryOnFailure; |
| 19 import org.chromium.chrome.test.ChromeJUnit4ClassRunner; |
| 20 import org.chromium.content.browser.test.NativeLibraryTestRule; | 20 import org.chromium.content.browser.test.NativeLibraryTestRule; |
| 21 | 21 |
| 22 import java.util.ArrayList; | 22 import java.util.ArrayList; |
| 23 import java.util.Arrays; | 23 import java.util.Arrays; |
| 24 import java.util.List; | 24 import java.util.List; |
| 25 | 25 |
| 26 /** | 26 /** |
| 27 * Tests of {@link PrecacheUMA}. | 27 * Tests of {@link PrecacheUMA}. |
| 28 */ | 28 */ |
| 29 @RunWith(BaseJUnit4ClassRunner.class) | 29 @RunWith(ChromeJUnit4ClassRunner.class) |
| 30 public class PrecacheUMATest { | 30 public class PrecacheUMATest { |
| 31 @Rule | 31 @Rule |
| 32 public NativeLibraryTestRule mActivityTestRule = new NativeLibraryTestRule()
; | 32 public NativeLibraryTestRule mActivityTestRule = new NativeLibraryTestRule()
; |
| 33 | 33 |
| 34 @Test | 34 @Test |
| 35 @SmallTest | 35 @SmallTest |
| 36 @Feature({"Precache"}) | 36 @Feature({"Precache"}) |
| 37 public void testUMAEventBitPositionAndMask() { | 37 public void testUMAEventBitPositionAndMask() { |
| 38 // Test the bitmask and bit position of all UMA Events. | 38 // Test the bitmask and bit position of all UMA Events. |
| 39 for (int event = PrecacheUMA.Event.EVENT_START; event < PrecacheUMA.Even
t.EVENT_END; | 39 for (int event = PrecacheUMA.Event.EVENT_START; event < PrecacheUMA.Even
t.EVENT_END; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 if (events.contains(event)) { | 144 if (events.contains(event)) { |
| 145 Assert.assertEquals( | 145 Assert.assertEquals( |
| 146 1, histograms[PrecacheUMA.Event.getBitPosition(event)].g
etDelta()); | 146 1, histograms[PrecacheUMA.Event.getBitPosition(event)].g
etDelta()); |
| 147 } else { | 147 } else { |
| 148 Assert.assertEquals( | 148 Assert.assertEquals( |
| 149 0, histograms[PrecacheUMA.Event.getBitPosition(event)].g
etDelta()); | 149 0, histograms[PrecacheUMA.Event.getBitPosition(event)].g
etDelta()); |
| 150 } | 150 } |
| 151 } | 151 } |
| 152 } | 152 } |
| 153 } | 153 } |
| OLD | NEW |