Search in sources :

Example 1 with MockNetwork

use of com.android.volley.mock.MockNetwork in project FastDev4Android by jiangqqlmj.

the class NetworkDispatcherTest method setUp.

@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();
}
Also used : MockResponseDelivery(com.android.volley.mock.MockResponseDelivery) WaitableQueue(com.android.volley.mock.WaitableQueue) MockNetwork(com.android.volley.mock.MockNetwork) MockRequest(com.android.volley.mock.MockRequest) MockCache(com.android.volley.mock.MockCache) Before(org.junit.Before)

Example 2 with MockNetwork

use of com.android.volley.mock.MockNetwork in project android-volley by mcxiaoke.

the class NetworkDispatcherTest method setUp.

@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();
}
Also used : MockResponseDelivery(com.android.volley.mock.MockResponseDelivery) WaitableQueue(com.android.volley.mock.WaitableQueue) MockNetwork(com.android.volley.mock.MockNetwork) MockRequest(com.android.volley.mock.MockRequest) MockCache(com.android.volley.mock.MockCache) Before(org.junit.Before)

Example 3 with MockNetwork

use of com.android.volley.mock.MockNetwork in project iosched by google.

the class NetworkDispatcherTest method setUp.

@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();
}
Also used : MockResponseDelivery(com.android.volley.mock.MockResponseDelivery) WaitableQueue(com.android.volley.mock.WaitableQueue) MockNetwork(com.android.volley.mock.MockNetwork) MockRequest(com.android.volley.mock.MockRequest) MockCache(com.android.volley.mock.MockCache)

Example 4 with MockNetwork

use of com.android.volley.mock.MockNetwork in project iosched by google.

the class RequestQueueTest method testCancelAll_onlyCorrectTag.

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);
    // A
    queue.add(req1);
    // B
    queue.add(req2);
    // A
    queue.add(req3);
    queue.cancelAll(tagA);
    // A
    queue.add(req4);
    // A cancelled
    assertTrue(req1.cancel_called);
    // B not cancelled
    assertFalse(req2.cancel_called);
    // A cancelled
    assertTrue(req3.cancel_called);
    // A added after cancel not cancelled
    assertFalse(req4.cancel_called);
}
Also used : MockNetwork(com.android.volley.mock.MockNetwork) MockRequest(com.android.volley.mock.MockRequest) NoCache(com.android.volley.toolbox.NoCache)

Example 5 with MockNetwork

use of com.android.volley.mock.MockNetwork in project TaEmCasa by Dionen.

the class NetworkDispatcherTest method setUp.

@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();
}
Also used : MockResponseDelivery(com.android.volley.mock.MockResponseDelivery) WaitableQueue(com.android.volley.mock.WaitableQueue) MockNetwork(com.android.volley.mock.MockNetwork) MockRequest(com.android.volley.mock.MockRequest) MockCache(com.android.volley.mock.MockCache) Before(org.junit.Before)

Aggregations

MockNetwork (com.android.volley.mock.MockNetwork)5 MockRequest (com.android.volley.mock.MockRequest)5 MockCache (com.android.volley.mock.MockCache)4 MockResponseDelivery (com.android.volley.mock.MockResponseDelivery)4 WaitableQueue (com.android.volley.mock.WaitableQueue)4 Before (org.junit.Before)3 NoCache (com.android.volley.toolbox.NoCache)1