Start using MockStreamResponse.
Jeff Sharkey [Thu, 21 Mar 2013 21:24:25 +0000 (14:24 -0700)]
Change-Id: Ida4a0a85883ccd6763b07e958ddc6ecf7eedf790

tests/src/com/android/providers/downloads/AbstractDownloadProviderFunctionalTest.java
tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java

index 3b93738..e59aff0 100644 (file)
@@ -34,6 +34,7 @@ import android.test.mock.MockContentResolver;
 import android.util.Log;
 
 import com.google.mockwebserver.MockResponse;
+import com.google.mockwebserver.MockStreamResponse;
 import com.google.mockwebserver.MockWebServer;
 import com.google.mockwebserver.RecordedRequest;
 import com.google.mockwebserver.SocketPolicy;
@@ -220,6 +221,10 @@ public abstract class AbstractDownloadProviderFunctionalTest extends
         mServer.enqueue(resp);
     }
 
+    void enqueueResponse(MockStreamResponse resp) {
+        mServer.enqueue(resp);
+    }
+
     MockResponse buildResponse(int status, String body) {
         return new MockResponse().setResponseCode(status).setBody(body)
                 .setHeader("Content-type", "text/plain")
index bde9581..b6fd611 100644 (file)
@@ -50,6 +50,7 @@ import android.test.suitebuilder.annotation.Suppress;
 import android.text.format.DateUtils;
 
 import com.google.mockwebserver.MockResponse;
+import com.google.mockwebserver.MockStreamResponse;
 import com.google.mockwebserver.RecordedRequest;
 import com.google.mockwebserver.SocketPolicy;
 
@@ -140,7 +141,7 @@ public class PublicApiFunctionalTest extends AbstractPublicApiTest {
         final long length = 3 * GB_IN_BYTES;
         final InputStream body = new FakeInputStream(length);
 
-        enqueueResponse(new MockResponse().setResponseCode(HTTP_OK).setBody(body, length)
+        enqueueResponse(new MockStreamResponse().setResponseCode(HTTP_OK).setBody(body, length)
                 .setHeader("Content-type", "text/plain")
                 .setSocketPolicy(SocketPolicy.DISCONNECT_AT_END));