| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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.customtabs; | 5 package org.chromium.chrome.browser.customtabs; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.os.Process; | 8 import android.os.Process; |
| 9 import android.support.customtabs.CustomTabsSessionToken; | 9 import android.support.customtabs.CustomTabsSessionToken; |
| 10 import android.support.test.InstrumentationRegistry; | 10 import android.support.test.InstrumentationRegistry; |
| 11 import android.support.test.filters.SmallTest; | 11 import android.support.test.filters.SmallTest; |
| 12 | 12 |
| 13 import org.junit.Assert; | 13 import org.junit.Assert; |
| 14 import org.junit.Before; | 14 import org.junit.Before; |
| 15 import org.junit.Rule; | 15 import org.junit.Rule; |
| 16 import org.junit.Test; | 16 import org.junit.Test; |
| 17 import org.junit.runner.RunWith; | 17 import org.junit.runner.RunWith; |
| 18 | 18 |
| 19 import org.chromium.base.metrics.RecordHistogram; | 19 import org.chromium.base.metrics.RecordHistogram; |
| 20 import org.chromium.base.test.BaseJUnit4ClassRunner; | |
| 21 import org.chromium.base.test.util.MetricsUtils; | 20 import org.chromium.base.test.util.MetricsUtils; |
| 22 import org.chromium.base.test.util.RetryOnFailure; | 21 import org.chromium.base.test.util.RetryOnFailure; |
| 22 import org.chromium.chrome.test.ChromeJUnit4ClassRunner; |
| 23 import org.chromium.content.browser.test.NativeLibraryTestRule; | 23 import org.chromium.content.browser.test.NativeLibraryTestRule; |
| 24 | 24 |
| 25 /** Tests for ClientManager. */ | 25 /** Tests for ClientManager. */ |
| 26 @RunWith(BaseJUnit4ClassRunner.class) | 26 @RunWith(ChromeJUnit4ClassRunner.class) |
| 27 public class ClientManagerTest { | 27 public class ClientManagerTest { |
| 28 @Rule | 28 @Rule |
| 29 public NativeLibraryTestRule mActivityTestRule = new NativeLibraryTestRule()
; | 29 public NativeLibraryTestRule mActivityTestRule = new NativeLibraryTestRule()
; |
| 30 | 30 |
| 31 private static final String URL = "https://www.android.com"; | 31 private static final String URL = "https://www.android.com"; |
| 32 private ClientManager mClientManager; | 32 private ClientManager mClientManager; |
| 33 private CustomTabsSessionToken mSession = | 33 private CustomTabsSessionToken mSession = |
| 34 CustomTabsSessionToken.createDummySessionTokenForTesting(); | 34 CustomTabsSessionToken.createDummySessionTokenForTesting(); |
| 35 private int mUid = Process.myUid(); | 35 private int mUid = Process.myUid(); |
| 36 | 36 |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 | 232 |
| 233 // Low and High confidence, same call. | 233 // Low and High confidence, same call. |
| 234 RequestThrottler.purgeAllEntriesForTesting(context); | 234 RequestThrottler.purgeAllEntriesForTesting(context); |
| 235 bothDelta = new MetricsUtils.HistogramDelta(name, ClientManager.BOTH); | 235 bothDelta = new MetricsUtils.HistogramDelta(name, ClientManager.BOTH); |
| 236 Assert.assertTrue( | 236 Assert.assertTrue( |
| 237 mClientManager.updateStatsAndReturnWhetherAllowed(mSession, mUid
, URL, true)); | 237 mClientManager.updateStatsAndReturnWhetherAllowed(mSession, mUid
, URL, true)); |
| 238 mClientManager.registerLaunch(mSession, URL); | 238 mClientManager.registerLaunch(mSession, URL); |
| 239 Assert.assertEquals(1, bothDelta.getDelta()); | 239 Assert.assertEquals(1, bothDelta.getDelta()); |
| 240 } | 240 } |
| 241 } | 241 } |
| OLD | NEW |