Java 类com.android.volley.utils.CacheTestUtils 实例源码

项目:GitHub    文件:ResponseDeliveryTest.java   
@Before public void setUp() throws Exception {
    // Make the delivery just run its posted responses immediately.
    mDelivery = new ImmediateResponseDelivery();
    mRequest = new MockRequest();
    mRequest.setSequence(1);
    byte[] data = new byte[16];
    Cache.Entry cacheEntry = CacheTestUtils.makeRandomCacheEntry(data);
    mSuccessResponse = Response.success(data, cacheEntry);
}
项目:GitHub    文件:CacheDispatcherTest.java   
@Test public void nonExpiredCacheHit() throws Exception {
    Cache.Entry entry = CacheTestUtils.makeRandomCacheEntry(null, false, false);
    mCache.setEntryToReturn(entry);
    mCacheQueue.add(mRequest);
    mCacheQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertTrue(mDelivery.postResponse_called);
    assertFalse(mDelivery.postError_called);
}
项目:GitHub    文件:CacheDispatcherTest.java   
@Test public void softExpiredCacheHit() throws Exception {
    Cache.Entry entry = CacheTestUtils.makeRandomCacheEntry(null, false, true);
    mCache.setEntryToReturn(entry);
    mCacheQueue.add(mRequest);
    mCacheQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertTrue(mDelivery.postResponse_called);
    assertFalse(mDelivery.postError_called);
    assertTrue(mNetworkQueue.size() > 0);
    Request request = mNetworkQueue.take();
    assertSame(entry, request.getCacheEntry());
}
项目:GitHub    文件:CacheDispatcherTest.java   
@Test public void expiredCacheHit() throws Exception {
    Cache.Entry entry = CacheTestUtils.makeRandomCacheEntry(null, true, true);
    mCache.setEntryToReturn(entry);
    mCacheQueue.add(mRequest);
    mCacheQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertFalse(mDelivery.wasEitherResponseCalled());
    assertTrue(mNetworkQueue.size() > 0);
    Request request = mNetworkQueue.take();
    assertSame(entry, request.getCacheEntry());
}
项目:GitHub    文件:ResponseDeliveryTest.java   
@Before public void setUp() throws Exception {
    // Make the delivery just run its posted responses immediately.
    mDelivery = new ImmediateResponseDelivery();
    mRequest = new MockRequest();
    mRequest.setSequence(1);
    byte[] data = new byte[16];
    Cache.Entry cacheEntry = CacheTestUtils.makeRandomCacheEntry(data);
    mSuccessResponse = Response.success(data, cacheEntry);
}
项目:GitHub    文件:CacheDispatcherTest.java   
@Test public void nonExpiredCacheHit() throws Exception {
    Cache.Entry entry = CacheTestUtils.makeRandomCacheEntry(null, false, false);
    mCache.setEntryToReturn(entry);
    mCacheQueue.add(mRequest);
    mCacheQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertTrue(mDelivery.postResponse_called);
    assertFalse(mDelivery.postError_called);
}
项目:GitHub    文件:CacheDispatcherTest.java   
@Test public void softExpiredCacheHit() throws Exception {
    Cache.Entry entry = CacheTestUtils.makeRandomCacheEntry(null, false, true);
    mCache.setEntryToReturn(entry);
    mCacheQueue.add(mRequest);
    mCacheQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertTrue(mDelivery.postResponse_called);
    assertFalse(mDelivery.postError_called);
    assertTrue(mNetworkQueue.size() > 0);
    Request request = mNetworkQueue.take();
    assertSame(entry, request.getCacheEntry());
}
项目:GitHub    文件:CacheDispatcherTest.java   
@Test public void expiredCacheHit() throws Exception {
    Cache.Entry entry = CacheTestUtils.makeRandomCacheEntry(null, true, true);
    mCache.setEntryToReturn(entry);
    mCacheQueue.add(mRequest);
    mCacheQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertFalse(mDelivery.wasEitherResponseCalled());
    assertTrue(mNetworkQueue.size() > 0);
    Request request = mNetworkQueue.take();
    assertSame(entry, request.getCacheEntry());
}
项目:Codeforces    文件:ResponseDeliveryTest.java   
@Before public void setUp() throws Exception {
    // Make the delivery just run its posted responses immediately.
    mDelivery = new ImmediateResponseDelivery();
    mRequest = new MockRequest();
    mRequest.setSequence(1);
    byte[] data = new byte[16];
    Cache.Entry cacheEntry = CacheTestUtils.makeRandomCacheEntry(data);
    mSuccessResponse = Response.success(data, cacheEntry);
}
项目:Codeforces    文件:CacheDispatcherTest.java   
@Test public void nonExpiredCacheHit() throws Exception {
    Cache.Entry entry = CacheTestUtils.makeRandomCacheEntry(null, false, false);
    mCache.setEntryToReturn(entry);
    mCacheQueue.add(mRequest);
    mCacheQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertTrue(mDelivery.postResponse_called);
    assertFalse(mDelivery.postError_called);
}
项目:Codeforces    文件:CacheDispatcherTest.java   
@Test public void softExpiredCacheHit() throws Exception {
    Cache.Entry entry = CacheTestUtils.makeRandomCacheEntry(null, false, true);
    mCache.setEntryToReturn(entry);
    mCacheQueue.add(mRequest);
    mCacheQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertTrue(mDelivery.postResponse_called);
    assertFalse(mDelivery.postError_called);
    assertTrue(mNetworkQueue.size() > 0);
    Request request = mNetworkQueue.take();
    assertSame(entry, request.getCacheEntry());
}
项目:Codeforces    文件:CacheDispatcherTest.java   
@Test public void expiredCacheHit() throws Exception {
    Cache.Entry entry = CacheTestUtils.makeRandomCacheEntry(null, true, true);
    mCache.setEntryToReturn(entry);
    mCacheQueue.add(mRequest);
    mCacheQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertFalse(mDelivery.wasEitherResponseCalled());
    assertTrue(mNetworkQueue.size() > 0);
    Request request = mNetworkQueue.take();
    assertSame(entry, request.getCacheEntry());
}
项目:iosched-reader    文件:ResponseDeliveryTest.java   
@Override
protected void setUp() throws Exception {
    super.setUp();

    // Make the delivery just run its posted responses immediately.
    mDelivery = new ImmediateResponseDelivery();
    mRequest = new MockRequest();
    mRequest.setSequence(1);
    byte[] data = new byte[16];
    Cache.Entry cacheEntry = CacheTestUtils.makeRandomCacheEntry(data);
    mSuccessResponse = Response.success(data, cacheEntry);
}
项目:iosched-reader    文件:CacheDispatcherTest.java   
public void testNonExpiredCacheHit() throws Exception {
    Cache.Entry entry = CacheTestUtils.makeRandomCacheEntry(null, false, false);
    mCache.setEntryToReturn(entry);
    mCacheQueue.add(mRequest);
    mCacheQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertTrue(mDelivery.postResponse_called);
    assertFalse(mDelivery.postError_called);
}
项目:iosched-reader    文件:CacheDispatcherTest.java   
public void testSoftExpiredCacheHit() throws Exception {
    Cache.Entry entry = CacheTestUtils.makeRandomCacheEntry(null, false, true);
    mCache.setEntryToReturn(entry);
    mCacheQueue.add(mRequest);
    mCacheQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertTrue(mDelivery.postResponse_called);
    assertFalse(mDelivery.postError_called);
    assertTrue(mNetworkQueue.size() > 0);
    Request request = mNetworkQueue.take();
    assertSame(entry, request.getCacheEntry());
}
项目:iosched-reader    文件:CacheDispatcherTest.java   
public void testExpiredCacheHit() throws Exception {
    Cache.Entry entry = CacheTestUtils.makeRandomCacheEntry(null, true, true);
    mCache.setEntryToReturn(entry);
    mCacheQueue.add(mRequest);
    mCacheQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertFalse(mDelivery.wasEitherResponseCalled());
    assertTrue(mNetworkQueue.size() > 0);
    Request request = mNetworkQueue.take();
    assertSame(entry, request.getCacheEntry());
}
项目:VoV    文件:ResponseDeliveryTest.java   
@Before public void setUp() throws Exception {
    // Make the delivery just run its posted responses immediately.
    mDelivery = new ImmediateResponseDelivery();
    mRequest = new MockRequest();
    mRequest.setSequence(1);
    byte[] data = new byte[16];
    Cache.Entry cacheEntry = CacheTestUtils.makeRandomCacheEntry(data);
    mSuccessResponse = Response.success(data, cacheEntry);
}
项目:VoV    文件:CacheDispatcherTest.java   
@Test public void nonExpiredCacheHit() throws Exception {
    Cache.Entry entry = CacheTestUtils.makeRandomCacheEntry(null, false, false);
    mCache.setEntryToReturn(entry);
    mCacheQueue.add(mRequest);
    mCacheQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertTrue(mDelivery.postResponse_called);
    assertFalse(mDelivery.postError_called);
}
项目:VoV    文件:CacheDispatcherTest.java   
@Test public void softExpiredCacheHit() throws Exception {
    Cache.Entry entry = CacheTestUtils.makeRandomCacheEntry(null, false, true);
    mCache.setEntryToReturn(entry);
    mCacheQueue.add(mRequest);
    mCacheQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertTrue(mDelivery.postResponse_called);
    assertFalse(mDelivery.postError_called);
    assertTrue(mNetworkQueue.size() > 0);
    Request request = mNetworkQueue.take();
    assertSame(entry, request.getCacheEntry());
}
项目:VoV    文件:CacheDispatcherTest.java   
@Test public void expiredCacheHit() throws Exception {
    Cache.Entry entry = CacheTestUtils.makeRandomCacheEntry(null, true, true);
    mCache.setEntryToReturn(entry);
    mCacheQueue.add(mRequest);
    mCacheQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertFalse(mDelivery.wasEitherResponseCalled());
    assertTrue(mNetworkQueue.size() > 0);
    Request request = mNetworkQueue.take();
    assertSame(entry, request.getCacheEntry());
}
项目:smconf-android    文件:ResponseDeliveryTest.java   
@Override
protected void setUp() throws Exception {
    super.setUp();

    // Make the delivery just run its posted responses immediately.
    mDelivery = new ImmediateResponseDelivery();
    mRequest = new MockRequest();
    mRequest.setSequence(1);
    byte[] data = new byte[16];
    Cache.Entry cacheEntry = CacheTestUtils.makeRandomCacheEntry(data);
    mSuccessResponse = Response.success(data, cacheEntry);
}
项目:smconf-android    文件:CacheDispatcherTest.java   
public void testNonExpiredCacheHit() throws Exception {
    Cache.Entry entry = CacheTestUtils.makeRandomCacheEntry(null, false, false);
    mCache.setEntryToReturn(entry);
    mCacheQueue.add(mRequest);
    mCacheQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertTrue(mDelivery.postResponse_called);
    assertFalse(mDelivery.postError_called);
}
项目:smconf-android    文件:CacheDispatcherTest.java   
public void testSoftExpiredCacheHit() throws Exception {
    Cache.Entry entry = CacheTestUtils.makeRandomCacheEntry(null, false, true);
    mCache.setEntryToReturn(entry);
    mCacheQueue.add(mRequest);
    mCacheQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertTrue(mDelivery.postResponse_called);
    assertFalse(mDelivery.postError_called);
    assertTrue(mNetworkQueue.size() > 0);
    Request request = mNetworkQueue.take();
    assertSame(entry, request.getCacheEntry());
}
项目:smconf-android    文件:CacheDispatcherTest.java   
public void testExpiredCacheHit() throws Exception {
    Cache.Entry entry = CacheTestUtils.makeRandomCacheEntry(null, true, true);
    mCache.setEntryToReturn(entry);
    mCacheQueue.add(mRequest);
    mCacheQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertFalse(mDelivery.wasEitherResponseCalled());
    assertTrue(mNetworkQueue.size() > 0);
    Request request = mNetworkQueue.take();
    assertSame(entry, request.getCacheEntry());
}
项目:volley    文件:ResponseDeliveryTest.java   
@Before public void setUp() throws Exception {
    // Make the delivery just run its posted responses immediately.
    mDelivery = new ImmediateResponseDelivery();
    mRequest = new MockRequest();
    mRequest.setSequence(1);
    byte[] data = new byte[16];
    Cache.Entry cacheEntry = CacheTestUtils.makeRandomCacheEntry(data);
    mSuccessResponse = Response.success(data, cacheEntry);
}
项目:volley    文件:CacheDispatcherTest.java   
@Test public void nonExpiredCacheHit() throws Exception {
    Cache.Entry entry = CacheTestUtils.makeRandomCacheEntry(null, false, false);
    mCache.setEntryToReturn(entry);
    mCacheQueue.add(mRequest);
    mCacheQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertTrue(mDelivery.postResponse_called);
    assertFalse(mDelivery.postError_called);
}
项目:volley    文件:CacheDispatcherTest.java   
@Test public void softExpiredCacheHit() throws Exception {
    Cache.Entry entry = CacheTestUtils.makeRandomCacheEntry(null, false, true);
    mCache.setEntryToReturn(entry);
    mCacheQueue.add(mRequest);
    mCacheQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertTrue(mDelivery.postResponse_called);
    assertFalse(mDelivery.postError_called);
    assertTrue(mNetworkQueue.size() > 0);
    Request request = mNetworkQueue.take();
    assertSame(entry, request.getCacheEntry());
}
项目:volley    文件:CacheDispatcherTest.java   
@Test public void expiredCacheHit() throws Exception {
    Cache.Entry entry = CacheTestUtils.makeRandomCacheEntry(null, true, true);
    mCache.setEntryToReturn(entry);
    mCacheQueue.add(mRequest);
    mCacheQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertFalse(mDelivery.wasEitherResponseCalled());
    assertTrue(mNetworkQueue.size() > 0);
    Request request = mNetworkQueue.take();
    assertSame(entry, request.getCacheEntry());
}
项目:InfoQ-Android-App    文件:ResponseDeliveryTest.java   
@Before public void setUp() throws Exception {
    // Make the delivery just run its posted responses immediately.
    mDelivery = new ImmediateResponseDelivery();
    mRequest = new MockRequest();
    mRequest.setSequence(1);
    byte[] data = new byte[16];
    Cache.Entry cacheEntry = CacheTestUtils.makeRandomCacheEntry(data);
    mSuccessResponse = Response.success(data, cacheEntry);
}
项目:InfoQ-Android-App    文件:CacheDispatcherTest.java   
@Test public void nonExpiredCacheHit() throws Exception {
    Cache.Entry entry = CacheTestUtils.makeRandomCacheEntry(null, false, false);
    mCache.setEntryToReturn(entry);
    mCacheQueue.add(mRequest);
    mCacheQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertTrue(mDelivery.postResponse_called);
    assertFalse(mDelivery.postError_called);
}
项目:InfoQ-Android-App    文件:CacheDispatcherTest.java   
@Test public void softExpiredCacheHit() throws Exception {
    Cache.Entry entry = CacheTestUtils.makeRandomCacheEntry(null, false, true);
    mCache.setEntryToReturn(entry);
    mCacheQueue.add(mRequest);
    mCacheQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertTrue(mDelivery.postResponse_called);
    assertFalse(mDelivery.postError_called);
    assertTrue(mNetworkQueue.size() > 0);
    Request request = mNetworkQueue.take();
    assertSame(entry, request.getCacheEntry());
}
项目:InfoQ-Android-App    文件:CacheDispatcherTest.java   
@Test public void expiredCacheHit() throws Exception {
    Cache.Entry entry = CacheTestUtils.makeRandomCacheEntry(null, true, true);
    mCache.setEntryToReturn(entry);
    mCacheQueue.add(mRequest);
    mCacheQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertFalse(mDelivery.wasEitherResponseCalled());
    assertTrue(mNetworkQueue.size() > 0);
    Request request = mNetworkQueue.take();
    assertSame(entry, request.getCacheEntry());
}
项目:volley-public-key-pinning    文件:ResponseDeliveryTest.java   
@Before public void setUp() throws Exception {
    // Make the delivery just run its posted responses immediately.
    mDelivery = new ImmediateResponseDelivery();
    mRequest = new MockRequest();
    mRequest.setSequence(1);
    byte[] data = new byte[16];
    Cache.Entry cacheEntry = CacheTestUtils.makeRandomCacheEntry(data);
    mSuccessResponse = Response.success(data, cacheEntry);
}
项目:volley-public-key-pinning    文件:CacheDispatcherTest.java   
@Test public void nonExpiredCacheHit() throws Exception {
    Cache.Entry entry = CacheTestUtils.makeRandomCacheEntry(null, false, false);
    mCache.setEntryToReturn(entry);
    mCacheQueue.add(mRequest);
    mCacheQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertTrue(mDelivery.postResponse_called);
    assertFalse(mDelivery.postError_called);
}
项目:volley-public-key-pinning    文件:CacheDispatcherTest.java   
@Test public void softExpiredCacheHit() throws Exception {
    Cache.Entry entry = CacheTestUtils.makeRandomCacheEntry(null, false, true);
    mCache.setEntryToReturn(entry);
    mCacheQueue.add(mRequest);
    mCacheQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertTrue(mDelivery.postResponse_called);
    assertFalse(mDelivery.postError_called);
    assertTrue(mNetworkQueue.size() > 0);
    Request request = mNetworkQueue.take();
    assertSame(entry, request.getCacheEntry());
}
项目:volley-public-key-pinning    文件:CacheDispatcherTest.java   
@Test public void expiredCacheHit() throws Exception {
    Cache.Entry entry = CacheTestUtils.makeRandomCacheEntry(null, true, true);
    mCache.setEntryToReturn(entry);
    mCacheQueue.add(mRequest);
    mCacheQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertFalse(mDelivery.wasEitherResponseCalled());
    assertTrue(mNetworkQueue.size() > 0);
    Request request = mNetworkQueue.take();
    assertSame(entry, request.getCacheEntry());
}
项目:device-database    文件:ResponseDeliveryTest.java   
@Before public void setUp() throws Exception {
    // Make the delivery just run its posted responses immediately.
    mDelivery = new ImmediateResponseDelivery();
    mRequest = new MockRequest();
    mRequest.setSequence(1);
    byte[] data = new byte[16];
    Cache.Entry cacheEntry = CacheTestUtils.makeRandomCacheEntry(data);
    mSuccessResponse = Response.success(data, cacheEntry);
}
项目:device-database    文件:CacheDispatcherTest.java   
@Test public void nonExpiredCacheHit() throws Exception {
    Cache.Entry entry = CacheTestUtils.makeRandomCacheEntry(null, false, false);
    mCache.setEntryToReturn(entry);
    mCacheQueue.add(mRequest);
    mCacheQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertTrue(mDelivery.postResponse_called);
    assertFalse(mDelivery.postError_called);
}
项目:device-database    文件:CacheDispatcherTest.java   
@Test public void softExpiredCacheHit() throws Exception {
    Cache.Entry entry = CacheTestUtils.makeRandomCacheEntry(null, false, true);
    mCache.setEntryToReturn(entry);
    mCacheQueue.add(mRequest);
    mCacheQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertTrue(mDelivery.postResponse_called);
    assertFalse(mDelivery.postError_called);
    assertTrue(mNetworkQueue.size() > 0);
    Request request = mNetworkQueue.take();
    assertSame(entry, request.getCacheEntry());
}
项目:device-database    文件:CacheDispatcherTest.java   
@Test public void expiredCacheHit() throws Exception {
    Cache.Entry entry = CacheTestUtils.makeRandomCacheEntry(null, true, true);
    mCache.setEntryToReturn(entry);
    mCacheQueue.add(mRequest);
    mCacheQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertFalse(mDelivery.wasEitherResponseCalled());
    assertTrue(mNetworkQueue.size() > 0);
    Request request = mNetworkQueue.take();
    assertSame(entry, request.getCacheEntry());
}