| Index: components/cronet/android/test/javatests/src/org/chromium/net/urlconnection/CronetHttpURLConnectionTest.java | 
| diff --git a/components/cronet/android/test/javatests/src/org/chromium/net/urlconnection/CronetHttpURLConnectionTest.java b/components/cronet/android/test/javatests/src/org/chromium/net/urlconnection/CronetHttpURLConnectionTest.java | 
| index f4ff70cdb0c693ecf60c9f532007ec18eb8a7ffc..b32eab9d21a3fd114861f6557028a7bf25946853 100644 | 
| --- a/components/cronet/android/test/javatests/src/org/chromium/net/urlconnection/CronetHttpURLConnectionTest.java | 
| +++ b/components/cronet/android/test/javatests/src/org/chromium/net/urlconnection/CronetHttpURLConnectionTest.java | 
| @@ -18,6 +18,8 @@ import java.io.ByteArrayOutputStream; | 
| import java.io.FileNotFoundException; | 
| import java.io.IOException; | 
| import java.io.InputStream; | 
| +import java.io.OutputStream; | 
| +import java.lang.reflect.Method; | 
| import java.net.HttpURLConnection; | 
| import java.net.MalformedURLException; | 
| import java.net.URL; | 
| @@ -73,6 +75,51 @@ public class CronetHttpURLConnectionTest extends CronetTestBase { | 
| urlConnection.disconnect(); | 
| } | 
|  | 
| +    /** | 
| +     * Tests that using reflection to find {@code fixedContentLengthLong} works. | 
| +     */ | 
| +    @SmallTest | 
| +    @Feature({"Cronet"}) | 
| +    @OnlyRunCronetHttpURLConnection | 
| +    public void testSetFixedLengthStreamingModeLong() throws Exception { | 
| +        URL url = new URL(NativeTestServer.getEchoBodyURL()); | 
| +        HttpURLConnection connection = | 
| +                (HttpURLConnection) url.openConnection(); | 
| +        connection.setDoOutput(true); | 
| +        connection.setRequestMethod("POST"); | 
| +        if (Build.VERSION.SDK_INT >= 19) { | 
| +            String dataString = "some very important data"; | 
| +            byte[] data = dataString.getBytes(); | 
| +            Class<?> c = connection.getClass(); | 
| +            Method method = c.getMethod("setFixedLengthStreamingMode", | 
| +                    new Class[] {long.class}); | 
| +            method.invoke(connection, (long) data.length); | 
| +            OutputStream out = connection.getOutputStream(); | 
| +            out.write(data); | 
| +            assertEquals(200, connection.getResponseCode()); | 
| +            assertEquals("OK", connection.getResponseMessage()); | 
| +            assertEquals(dataString, getResponseAsString(connection)); | 
| +            connection.disconnect(); | 
| +        } | 
| +    } | 
| + | 
| +    @SmallTest | 
| +    @Feature({"Cronet"}) | 
| +    @OnlyRunCronetHttpURLConnection | 
| +    // TODO(xunjieli): Change the test after chunked support is added. | 
| +    public void testPostChunked() throws Exception { | 
| +        URL url = new URL(NativeTestServer.getEchoBodyURL()); | 
| +        HttpURLConnection connection = | 
| +                (HttpURLConnection) url.openConnection(); | 
| +        connection.setDoOutput(true); | 
| +        connection.setRequestMethod("POST"); | 
| +        try { | 
| +            connection.setChunkedStreamingMode(0); | 
| +        } catch (UnsupportedOperationException e) { | 
| +            assertEquals("Chunked mode not supported yet", e.getMessage()); | 
| +        } | 
| +    } | 
| + | 
| @SmallTest | 
| @Feature({"Cronet"}) | 
| @CompareDefaultWithCronet | 
|  |