Java 类com.android.volley.mock.MockNetwork 实例源码

项目:iosched-reader    文件:RequestQueueTest.java   
public void testCancelAll_onlyCorrectTag() throws Exception {
    MockNetwork network = new MockNetwork();
    RequestQueue queue = new RequestQueue(new NoCache(), network, 3, mDelivery);
    Object tagA = new Object();
    Object tagB = new Object();
    MockRequest req1 = new MockRequest();
    req1.setTag(tagA);
    MockRequest req2 = new MockRequest();
    req2.setTag(tagB);
    MockRequest req3 = new MockRequest();
    req3.setTag(tagA);
    MockRequest req4 = new MockRequest();
    req4.setTag(tagA);

    queue.add(req1); // A
    queue.add(req2); // B
    queue.add(req3); // A
    queue.cancelAll(tagA);
    queue.add(req4); // A

    assertTrue(req1.cancel_called); // A cancelled
    assertFalse(req2.cancel_called); // B not cancelled
    assertTrue(req3.cancel_called); // A cancelled
    assertFalse(req4.cancel_called); // A added after cancel not cancelled
}
项目:smconf-android    文件:RequestQueueTest.java   
public void testCancelAll_onlyCorrectTag() throws Exception {
    MockNetwork network = new MockNetwork();
    RequestQueue queue = new RequestQueue(new NoCache(), network, 3, mDelivery);
    Object tagA = new Object();
    Object tagB = new Object();
    MockRequest req1 = new MockRequest();
    req1.setTag(tagA);
    MockRequest req2 = new MockRequest();
    req2.setTag(tagB);
    MockRequest req3 = new MockRequest();
    req3.setTag(tagA);
    MockRequest req4 = new MockRequest();
    req4.setTag(tagA);

    queue.add(req1); // A
    queue.add(req2); // B
    queue.add(req3); // A
    queue.cancelAll(tagA);
    queue.add(req4); // A

    assertTrue(req1.cancel_called); // A cancelled
    assertFalse(req2.cancel_called); // B not cancelled
    assertTrue(req3.cancel_called); // A cancelled
    assertFalse(req4.cancel_called); // A added after cancel not cancelled
}
项目:2015-Google-I-O-app    文件:RequestQueueTest.java   
public void testCancelAll_onlyCorrectTag() throws Exception {
    MockNetwork network = new MockNetwork();
    RequestQueue queue = new RequestQueue(new NoCache(), network, 3, mDelivery);
    Object tagA = new Object();
    Object tagB = new Object();
    MockRequest req1 = new MockRequest();
    req1.setTag(tagA);
    MockRequest req2 = new MockRequest();
    req2.setTag(tagB);
    MockRequest req3 = new MockRequest();
    req3.setTag(tagA);
    MockRequest req4 = new MockRequest();
    req4.setTag(tagA);

    queue.add(req1); // A
    queue.add(req2); // B
    queue.add(req3); // A
    queue.cancelAll(tagA);
    queue.add(req4); // A

    assertTrue(req1.cancel_called); // A cancelled
    assertFalse(req2.cancel_called); // B not cancelled
    assertTrue(req3.cancel_called); // A cancelled
    assertFalse(req4.cancel_called); // A added after cancel not cancelled
}
项目:android-project-wo2b    文件:RequestQueueTest.java   
public void testCancelAll_onlyCorrectTag() throws Exception {
    MockNetwork network = new MockNetwork();
    RequestQueue queue = new RequestQueue(new NoCache(), network, 3, mDelivery);
    Object tagA = new Object();
    Object tagB = new Object();
    MockRequest req1 = new MockRequest();
    req1.setTag(tagA);
    MockRequest req2 = new MockRequest();
    req2.setTag(tagB);
    MockRequest req3 = new MockRequest();
    req3.setTag(tagA);
    MockRequest req4 = new MockRequest();
    req4.setTag(tagA);

    queue.add(req1); // A
    queue.add(req2); // B
    queue.add(req3); // A
    queue.cancelAll(tagA);
    queue.add(req4); // A

    assertTrue(req1.cancel_called); // A cancelled
    assertFalse(req2.cancel_called); // B not cancelled
    assertTrue(req3.cancel_called); // A cancelled
    assertFalse(req4.cancel_called); // A added after cancel not cancelled
}
项目:FMTech    文件:RequestQueueTest.java   
public void testCancelAll_onlyCorrectTag() throws Exception {
    MockNetwork network = new MockNetwork();
    RequestQueue queue = new RequestQueue(new NoCache(), network, 3, mDelivery);
    Object tagA = new Object();
    Object tagB = new Object();
    MockRequest req1 = new MockRequest();
    req1.setTag(tagA);
    MockRequest req2 = new MockRequest();
    req2.setTag(tagB);
    MockRequest req3 = new MockRequest();
    req3.setTag(tagA);
    MockRequest req4 = new MockRequest();
    req4.setTag(tagA);

    queue.add(req1); // A
    queue.add(req2); // B
    queue.add(req3); // A
    queue.cancelAll(tagA);
    queue.add(req4); // A

    assertTrue(req1.cancel_called); // A cancelled
    assertFalse(req2.cancel_called); // B not cancelled
    assertTrue(req3.cancel_called); // A cancelled
    assertFalse(req4.cancel_called); // A added after cancel not cancelled
}
项目:saarang-iosched    文件:RequestQueueTest.java   
public void testCancelAll_onlyCorrectTag() throws Exception {
    MockNetwork network = new MockNetwork();
    RequestQueue queue = new RequestQueue(new NoCache(), network, 3, mDelivery);
    Object tagA = new Object();
    Object tagB = new Object();
    MockRequest req1 = new MockRequest();
    req1.setTag(tagA);
    MockRequest req2 = new MockRequest();
    req2.setTag(tagB);
    MockRequest req3 = new MockRequest();
    req3.setTag(tagA);
    MockRequest req4 = new MockRequest();
    req4.setTag(tagA);

    queue.add(req1); // A
    queue.add(req2); // B
    queue.add(req3); // A
    queue.cancelAll(tagA);
    queue.add(req4); // A

    assertTrue(req1.cancel_called); // A cancelled
    assertFalse(req2.cancel_called); // B not cancelled
    assertTrue(req3.cancel_called); // A cancelled
    assertFalse(req4.cancel_called); // A added after cancel not cancelled
}
项目:AppDevFestSudeste2015    文件:RequestQueueTest.java   
public void testCancelAll_onlyCorrectTag() throws Exception {
    MockNetwork network = new MockNetwork();
    RequestQueue queue = new RequestQueue(new NoCache(), network, 3, mDelivery);
    Object tagA = new Object();
    Object tagB = new Object();
    MockRequest req1 = new MockRequest();
    req1.setTag(tagA);
    MockRequest req2 = new MockRequest();
    req2.setTag(tagB);
    MockRequest req3 = new MockRequest();
    req3.setTag(tagA);
    MockRequest req4 = new MockRequest();
    req4.setTag(tagA);

    queue.add(req1); // A
    queue.add(req2); // B
    queue.add(req3); // A
    queue.cancelAll(tagA);
    queue.add(req4); // A

    assertTrue(req1.cancel_called); // A cancelled
    assertFalse(req2.cancel_called); // B not cancelled
    assertTrue(req3.cancel_called); // A cancelled
    assertFalse(req4.cancel_called); // A added after cancel not cancelled
}
项目:JJCamera    文件:RequestQueueTest.java   
public void testCancelAll_onlyCorrectTag() throws Exception {
    MockNetwork network = new MockNetwork();
    RequestQueue queue = new RequestQueue(new NoCache(), network, 3, mDelivery);
    Object tagA = new Object();
    Object tagB = new Object();
    MockRequest req1 = new MockRequest();
    req1.setTag(tagA);
    MockRequest req2 = new MockRequest();
    req2.setTag(tagB);
    MockRequest req3 = new MockRequest();
    req3.setTag(tagA);
    MockRequest req4 = new MockRequest();
    req4.setTag(tagA);

    queue.add(req1); // A
    queue.add(req2); // B
    queue.add(req3); // A
    queue.cancelAll(tagA);
    queue.add(req4); // A

    assertTrue(req1.cancel_called); // A cancelled
    assertFalse(req2.cancel_called); // B not cancelled
    assertTrue(req3.cancel_called); // A cancelled
    assertFalse(req4.cancel_called); // A added after cancel not cancelled
}
项目:android-discourse    文件:RequestQueueTest.java   
public void testCancelAll_onlyCorrectTag() throws Exception {
    MockNetwork network = new MockNetwork();
    RequestQueue queue = new RequestQueue(new NoCache(), network, 3, mDelivery);
    Object tagA = new Object();
    Object tagB = new Object();
    MockRequest req1 = new MockRequest();
    req1.setTag(tagA);
    MockRequest req2 = new MockRequest();
    req2.setTag(tagB);
    MockRequest req3 = new MockRequest();
    req3.setTag(tagA);
    MockRequest req4 = new MockRequest();
    req4.setTag(tagA);

    queue.add(req1); // A
    queue.add(req2); // B
    queue.add(req3); // A
    queue.cancelAll(tagA);
    queue.add(req4); // A

    assertTrue(req1.cancel_called); // A cancelled
    assertFalse(req2.cancel_called); // B not cancelled
    assertTrue(req3.cancel_called); // A cancelled
    assertFalse(req4.cancel_called); // A added after cancel not cancelled
}
项目:iosched    文件:RequestQueueTest.java   
public void testCancelAll_onlyCorrectTag() throws Exception {
    MockNetwork network = new MockNetwork();
    RequestQueue queue = new RequestQueue(new NoCache(), network, 3, mDelivery);
    Object tagA = new Object();
    Object tagB = new Object();
    MockRequest req1 = new MockRequest();
    req1.setTag(tagA);
    MockRequest req2 = new MockRequest();
    req2.setTag(tagB);
    MockRequest req3 = new MockRequest();
    req3.setTag(tagA);
    MockRequest req4 = new MockRequest();
    req4.setTag(tagA);

    queue.add(req1); // A
    queue.add(req2); // B
    queue.add(req3); // A
    queue.cancelAll(tagA);
    queue.add(req4); // A

    assertTrue(req1.cancel_called); // A cancelled
    assertFalse(req2.cancel_called); // B not cancelled
    assertTrue(req3.cancel_called); // A cancelled
    assertFalse(req4.cancel_called); // A added after cancel not cancelled
}
项目:devfestnorte-app    文件:RequestQueueTest.java   
public void testCancelAll_onlyCorrectTag() throws Exception {
    MockNetwork network = new MockNetwork();
    RequestQueue queue = new RequestQueue(new NoCache(), network, 3, mDelivery);
    Object tagA = new Object();
    Object tagB = new Object();
    MockRequest req1 = new MockRequest();
    req1.setTag(tagA);
    MockRequest req2 = new MockRequest();
    req2.setTag(tagB);
    MockRequest req3 = new MockRequest();
    req3.setTag(tagA);
    MockRequest req4 = new MockRequest();
    req4.setTag(tagA);

    queue.add(req1); // A
    queue.add(req2); // B
    queue.add(req3); // A
    queue.cancelAll(tagA);
    queue.add(req4); // A

    assertTrue(req1.cancel_called); // A cancelled
    assertFalse(req2.cancel_called); // B not cancelled
    assertTrue(req3.cancel_called); // A cancelled
    assertFalse(req4.cancel_called); // A added after cancel not cancelled
}
项目:GomeOnline    文件:RequestQueueTest.java   
public void testCancelAll_onlyCorrectTag() throws Exception {
    MockNetwork network = new MockNetwork();
    RequestQueue queue = new RequestQueue(new NoCache(), network, 3, mDelivery);
    Object tagA = new Object();
    Object tagB = new Object();
    MockRequest req1 = new MockRequest();
    req1.setTag(tagA);
    MockRequest req2 = new MockRequest();
    req2.setTag(tagB);
    MockRequest req3 = new MockRequest();
    req3.setTag(tagA);
    MockRequest req4 = new MockRequest();
    req4.setTag(tagA);

    queue.add(req1); // A
    queue.add(req2); // B
    queue.add(req3); // A
    queue.cancelAll(tagA);
    queue.add(req4); // A

    assertTrue(req1.cancel_called); // A cancelled
    assertFalse(req2.cancel_called); // B not cancelled
    assertTrue(req3.cancel_called); // A cancelled
    assertFalse(req4.cancel_called); // A added after cancel not cancelled
}
项目:saarang-iosched    文件:RequestQueueTest.java   
public void testCancelAll_onlyCorrectTag() throws Exception {
    MockNetwork network = new MockNetwork();
    RequestQueue queue = new RequestQueue(new NoCache(), network, 3, mDelivery);
    Object tagA = new Object();
    Object tagB = new Object();
    MockRequest req1 = new MockRequest();
    req1.setTag(tagA);
    MockRequest req2 = new MockRequest();
    req2.setTag(tagB);
    MockRequest req3 = new MockRequest();
    req3.setTag(tagA);
    MockRequest req4 = new MockRequest();
    req4.setTag(tagA);

    queue.add(req1); // A
    queue.add(req2); // B
    queue.add(req3); // A
    queue.cancelAll(tagA);
    queue.add(req4); // A

    assertTrue(req1.cancel_called); // A cancelled
    assertFalse(req2.cancel_called); // B not cancelled
    assertTrue(req3.cancel_called); // A cancelled
    assertFalse(req4.cancel_called); // A added after cancel not cancelled
}
项目:ipz2014    文件:RequestQueueTest.java   
public void testCancelAll_onlyCorrectTag() throws Exception {
    MockNetwork network = new MockNetwork();
    RequestQueue queue = new RequestQueue(new NoCache(), network, 3, mDelivery);
    Object tagA = new Object();
    Object tagB = new Object();
    MockRequest req1 = new MockRequest();
    req1.setTag(tagA);
    MockRequest req2 = new MockRequest();
    req2.setTag(tagB);
    MockRequest req3 = new MockRequest();
    req3.setTag(tagA);
    MockRequest req4 = new MockRequest();
    req4.setTag(tagA);

    queue.add(req1); // A
    queue.add(req2); // B
    queue.add(req3); // A
    queue.cancelAll(tagA);
    queue.add(req4); // A

    assertTrue(req1.cancel_called); // A cancelled
    assertFalse(req2.cancel_called); // B not cancelled
    assertTrue(req3.cancel_called); // A cancelled
    assertFalse(req4.cancel_called); // A added after cancel not cancelled
}
项目:upes-academics    文件:RequestQueueTest.java   
public void testCancelAll_onlyCorrectTag() throws Exception {
    MockNetwork network = new MockNetwork();
    RequestQueue queue = new RequestQueue(new NoCache(), network, 3, mDelivery);
    Object tagA = new Object();
    Object tagB = new Object();
    MockRequest req1 = new MockRequest();
    req1.setTag(tagA);
    MockRequest req2 = new MockRequest();
    req2.setTag(tagB);
    MockRequest req3 = new MockRequest();
    req3.setTag(tagA);
    MockRequest req4 = new MockRequest();
    req4.setTag(tagA);

    queue.add(req1); // A
    queue.add(req2); // B
    queue.add(req3); // A
    queue.cancelAll(tagA);
    queue.add(req4); // A

    assertTrue(req1.cancel_called); // A cancelled
    assertFalse(req2.cancel_called); // B not cancelled
    assertTrue(req3.cancel_called); // A cancelled
    assertFalse(req4.cancel_called); // A added after cancel not cancelled
}
项目:egg-android    文件:RequestQueueTest.java   
public void testCancelAll_onlyCorrectTag() throws Exception {
    MockNetwork network = new MockNetwork();
    RequestQueue queue = new RequestQueue(new NoCache(), network, 3, mDelivery);
    Object tagA = new Object();
    Object tagB = new Object();
    MockRequest req1 = new MockRequest();
    req1.setTag(tagA);
    MockRequest req2 = new MockRequest();
    req2.setTag(tagB);
    MockRequest req3 = new MockRequest();
    req3.setTag(tagA);
    MockRequest req4 = new MockRequest();
    req4.setTag(tagA);

    queue.add(req1); // A
    queue.add(req2); // B
    queue.add(req3); // A
    queue.cancelAll(tagA);
    queue.add(req4); // A

    assertTrue(req1.cancel_called); // A cancelled
    assertFalse(req2.cancel_called); // B not cancelled
    assertTrue(req3.cancel_called); // A cancelled
    assertFalse(req4.cancel_called); // A added after cancel not cancelled
}
项目:CS492-FA13    文件:RequestQueueTest.java   
public void testCancelAll_onlyCorrectTag() throws Exception {
    MockNetwork network = new MockNetwork();
    RequestQueue queue = new RequestQueue(new NoCache(), network, 3, mDelivery);
    Object tagA = new Object();
    Object tagB = new Object();
    MockRequest req1 = new MockRequest();
    req1.setTag(tagA);
    MockRequest req2 = new MockRequest();
    req2.setTag(tagB);
    MockRequest req3 = new MockRequest();
    req3.setTag(tagA);
    MockRequest req4 = new MockRequest();
    req4.setTag(tagA);

    queue.add(req1); // A
    queue.add(req2); // B
    queue.add(req3); // A
    queue.cancelAll(tagA);
    queue.add(req4); // A

    assertTrue(req1.cancel_called); // A cancelled
    assertFalse(req2.cancel_called); // B not cancelled
    assertTrue(req3.cancel_called); // A cancelled
    assertFalse(req4.cancel_called); // A added after cancel not cancelled
}
项目:GitHub    文件:NetworkDispatcherTest.java   
@Before public void setUp() throws Exception {
    mDelivery = new MockResponseDelivery();
    mNetworkQueue = new WaitableQueue();
    mNetwork = new MockNetwork();
    mCache = new MockCache();
    mRequest = new MockRequest();
    mDispatcher = new NetworkDispatcher(mNetworkQueue, mNetwork, mCache, mDelivery);
    mDispatcher.start();
}
项目:GitHub    文件:NetworkDispatcherTest.java   
@Test public void exceptionPostsError() throws Exception {
    mNetwork.setNumExceptionsToThrow(MockNetwork.ALWAYS_THROW_EXCEPTIONS);
    mNetworkQueue.add(mRequest);
    mNetworkQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertFalse(mDelivery.postResponse_called);
    assertTrue(mDelivery.postError_called);
}
项目:GitHub    文件:NetworkDispatcherTest.java   
@Before public void setUp() throws Exception {
    mDelivery = new MockResponseDelivery();
    mNetworkQueue = new WaitableQueue();
    mNetwork = new MockNetwork();
    mCache = new MockCache();
    mRequest = new MockRequest();
    mDispatcher = new NetworkDispatcher(mNetworkQueue, mNetwork, mCache, mDelivery);
    mDispatcher.start();
}
项目:GitHub    文件:NetworkDispatcherTest.java   
@Test public void exceptionPostsError() throws Exception {
    mNetwork.setNumExceptionsToThrow(MockNetwork.ALWAYS_THROW_EXCEPTIONS);
    mNetworkQueue.add(mRequest);
    mNetworkQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertFalse(mDelivery.postResponse_called);
    assertTrue(mDelivery.postError_called);
}
项目:Codeforces    文件:NetworkDispatcherTest.java   
@Before public void setUp() throws Exception {
    mDelivery = new MockResponseDelivery();
    mNetworkQueue = new WaitableQueue();
    mNetwork = new MockNetwork();
    mCache = new MockCache();
    mRequest = new MockRequest();
    mDispatcher = new NetworkDispatcher(mNetworkQueue, mNetwork, mCache, mDelivery);
    mDispatcher.start();
}
项目:Codeforces    文件:NetworkDispatcherTest.java   
@Test public void exceptionPostsError() throws Exception {
    mNetwork.setNumExceptionsToThrow(MockNetwork.ALWAYS_THROW_EXCEPTIONS);
    mNetworkQueue.add(mRequest);
    mNetworkQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertFalse(mDelivery.postResponse_called);
    assertTrue(mDelivery.postError_called);
}
项目:iosched-reader    文件:NetworkDispatcherTest.java   
@Override
protected void setUp() throws Exception {
    super.setUp();

    mDelivery = new MockResponseDelivery();
    mNetworkQueue = new WaitableQueue();
    mNetwork = new MockNetwork();
    mCache = new MockCache();
    mRequest = new MockRequest();
    mDispatcher = new NetworkDispatcher(mNetworkQueue, mNetwork, mCache, mDelivery);
    mDispatcher.start();
}
项目:iosched-reader    文件:NetworkDispatcherTest.java   
public void testExceptionPostsError() throws Exception {
    mNetwork.setNumExceptionsToThrow(MockNetwork.ALWAYS_THROW_EXCEPTIONS);
    mNetworkQueue.add(mRequest);
    mNetworkQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertFalse(mDelivery.postResponse_called);
    assertTrue(mDelivery.postError_called);
}
项目:VoV    文件:NetworkDispatcherTest.java   
@Before public void setUp() throws Exception {
    mDelivery = new MockResponseDelivery();
    mNetworkQueue = new WaitableQueue();
    mNetwork = new MockNetwork();
    mCache = new MockCache();
    mRequest = new MockRequest();
    mDispatcher = new NetworkDispatcher(mNetworkQueue, mNetwork, mCache, mDelivery);
    mDispatcher.start();
}
项目:VoV    文件:NetworkDispatcherTest.java   
@Test public void exceptionPostsError() throws Exception {
    mNetwork.setNumExceptionsToThrow(MockNetwork.ALWAYS_THROW_EXCEPTIONS);
    mNetworkQueue.add(mRequest);
    mNetworkQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertFalse(mDelivery.postResponse_called);
    assertTrue(mDelivery.postError_called);
}
项目:smconf-android    文件:NetworkDispatcherTest.java   
@Override
protected void setUp() throws Exception {
    super.setUp();

    mDelivery = new MockResponseDelivery();
    mNetworkQueue = new WaitableQueue();
    mNetwork = new MockNetwork();
    mCache = new MockCache();
    mRequest = new MockRequest();
    mDispatcher = new NetworkDispatcher(mNetworkQueue, mNetwork, mCache, mDelivery);
    mDispatcher.start();
}
项目:smconf-android    文件:NetworkDispatcherTest.java   
public void testExceptionPostsError() throws Exception {
    mNetwork.setNumExceptionsToThrow(MockNetwork.ALWAYS_THROW_EXCEPTIONS);
    mNetworkQueue.add(mRequest);
    mNetworkQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertFalse(mDelivery.postResponse_called);
    assertTrue(mDelivery.postError_called);
}
项目:volley    文件:NetworkDispatcherTest.java   
@Before public void setUp() throws Exception {
    mDelivery = new MockResponseDelivery();
    mNetworkQueue = new WaitableQueue();
    mNetwork = new MockNetwork();
    mCache = new MockCache();
    mRequest = new MockRequest();
    mDispatcher = new NetworkDispatcher(mNetworkQueue, mNetwork, mCache, mDelivery);
    mDispatcher.start();
}
项目:volley    文件:NetworkDispatcherTest.java   
@Test public void exceptionPostsError() throws Exception {
    mNetwork.setNumExceptionsToThrow(MockNetwork.ALWAYS_THROW_EXCEPTIONS);
    mNetworkQueue.add(mRequest);
    mNetworkQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertFalse(mDelivery.postResponse_called);
    assertTrue(mDelivery.postError_called);
}
项目:InfoQ-Android-App    文件:NetworkDispatcherTest.java   
@Before public void setUp() throws Exception {
    mDelivery = new MockResponseDelivery();
    mNetworkQueue = new WaitableQueue();
    mNetwork = new MockNetwork();
    mCache = new MockCache();
    mRequest = new MockRequest();
    mDispatcher = new NetworkDispatcher(mNetworkQueue, mNetwork, mCache, mDelivery);
    mDispatcher.start();
}
项目:InfoQ-Android-App    文件:NetworkDispatcherTest.java   
@Test public void exceptionPostsError() throws Exception {
    mNetwork.setNumExceptionsToThrow(MockNetwork.ALWAYS_THROW_EXCEPTIONS);
    mNetworkQueue.add(mRequest);
    mNetworkQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertFalse(mDelivery.postResponse_called);
    assertTrue(mDelivery.postError_called);
}
项目:volley-public-key-pinning    文件:NetworkDispatcherTest.java   
@Before public void setUp() throws Exception {
    mDelivery = new MockResponseDelivery();
    mNetworkQueue = new WaitableQueue();
    mNetwork = new MockNetwork();
    mCache = new MockCache();
    mRequest = new MockRequest();
    mDispatcher = new NetworkDispatcher(mNetworkQueue, mNetwork, mCache, mDelivery);
    mDispatcher.start();
}
项目:volley-public-key-pinning    文件:NetworkDispatcherTest.java   
@Test public void exceptionPostsError() throws Exception {
    mNetwork.setNumExceptionsToThrow(MockNetwork.ALWAYS_THROW_EXCEPTIONS);
    mNetworkQueue.add(mRequest);
    mNetworkQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertFalse(mDelivery.postResponse_called);
    assertTrue(mDelivery.postError_called);
}
项目:device-database    文件:NetworkDispatcherTest.java   
@Before public void setUp() throws Exception {
    mDelivery = new MockResponseDelivery();
    mNetworkQueue = new WaitableQueue();
    mNetwork = new MockNetwork();
    mCache = new MockCache();
    mRequest = new MockRequest();
    mDispatcher = new NetworkDispatcher(mNetworkQueue, mNetwork, mCache, mDelivery);
    mDispatcher.start();
}
项目:device-database    文件:NetworkDispatcherTest.java   
@Test public void exceptionPostsError() throws Exception {
    mNetwork.setNumExceptionsToThrow(MockNetwork.ALWAYS_THROW_EXCEPTIONS);
    mNetworkQueue.add(mRequest);
    mNetworkQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertFalse(mDelivery.postResponse_called);
    assertTrue(mDelivery.postError_called);
}
项目:ShoppingApp    文件:NetworkDispatcherTest.java   
@Before public void setUp() throws Exception {
    mDelivery = new MockResponseDelivery();
    mNetworkQueue = new WaitableQueue();
    mNetwork = new MockNetwork();
    mCache = new MockCache();
    mRequest = new MockRequest();
    mDispatcher = new NetworkDispatcher(mNetworkQueue, mNetwork, mCache, mDelivery);
    mDispatcher.start();
}
项目:ShoppingApp    文件:NetworkDispatcherTest.java   
@Test public void exceptionPostsError() throws Exception {
    mNetwork.setNumExceptionsToThrow(MockNetwork.ALWAYS_THROW_EXCEPTIONS);
    mNetworkQueue.add(mRequest);
    mNetworkQueue.waitUntilEmpty(TIMEOUT_MILLIS);
    assertFalse(mDelivery.postResponse_called);
    assertTrue(mDelivery.postError_called);
}
项目:2015-Google-I-O-app    文件:NetworkDispatcherTest.java   
@Override
protected void setUp() throws Exception {
    super.setUp();

    mDelivery = new MockResponseDelivery();
    mNetworkQueue = new WaitableQueue();
    mNetwork = new MockNetwork();
    mCache = new MockCache();
    mRequest = new MockRequest();
    mDispatcher = new NetworkDispatcher(mNetworkQueue, mNetwork, mCache, mDelivery);
    mDispatcher.start();
}