Search in sources :

Example 1 with CacheListener

use of android.net.wifi.WifiNetworkScoreCache.CacheListener in project platform_frameworks_base by android.

the class WifiNetworkScoreCacheTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    when(mockContext.getApplicationContext()).thenReturn(mockApplicationContext);
    mValidScoredNetwork = buildScoredNetwork(VALID_KEY, mockRssiCurve);
    mScoreCache = new WifiNetworkScoreCache(mockContext);
    initializeCacheWithValidScoredNetwork();
    HandlerThread thread = new HandlerThread("WifiNetworkScoreCacheTest Handler Thread");
    thread.start();
    mHandler = new Handler(thread.getLooper());
    mLatch = new CountDownLatch(1);
    mCacheListener = new CacheListener(mHandler) {

        @Override
        public void networkCacheUpdated(List<ScoredNetwork> updatedNetworks) {
            mUpdatedNetworksCaptor = updatedNetworks;
            mLatch.countDown();
        }
    };
}
Also used : HandlerThread(android.os.HandlerThread) ScoredNetwork(android.net.ScoredNetwork) Handler(android.os.Handler) CountDownLatch(java.util.concurrent.CountDownLatch) CacheListener(android.net.wifi.WifiNetworkScoreCache.CacheListener) Before(org.junit.Before)

Aggregations

ScoredNetwork (android.net.ScoredNetwork)1 CacheListener (android.net.wifi.WifiNetworkScoreCache.CacheListener)1 Handler (android.os.Handler)1 HandlerThread (android.os.HandlerThread)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 Before (org.junit.Before)1