Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Unified Diff: net/cronet/android/javatests/src/org/chromium/net/UrlRequestTest.java

Issue 145213003: Initial upload of cronet for Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: NET_EXPORT RequestPriorityToString to avoid buildbot errors. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/cronet/android/javatests/src/org/chromium/net/UrlRequestTest.java
diff --git a/net/cronet/android/javatests/src/org/chromium/net/UrlRequestTest.java b/net/cronet/android/javatests/src/org/chromium/net/UrlRequestTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..b1e6d80aef73fb35d8a3008eb3bf6aa5e71a22d0
--- /dev/null
+++ b/net/cronet/android/javatests/src/org/chromium/net/UrlRequestTest.java
@@ -0,0 +1,52 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.net;
+
+import android.content.Context;
+import android.test.InstrumentationTestCase;
+import android.test.suitebuilder.annotation.SmallTest;
+
+import org.chromium.base.test.util.Feature;
+
+import java.io.FileOutputStream;
+import java.nio.channels.WritableByteChannel;
+import java.util.HashMap;
+
+/**
+ * Test of Network request using the native http stack implementation.
+ */
+public class UrlRequestTest extends InstrumentationTestCase {
+ UrlRequestContext mRequestContext;
+
+ public UrlRequestTest() {
+ Context context = getInstrumentation().getTargetContext();
+ mRequestContext = new UrlRequestContext(context,
+ "Cronet Unit Test",
+ UrlRequestContext.LOG_VERBOSE);
mmenke 2014/02/27 23:06:02 This should use two space indent.
mef 2014/03/03 19:15:13 Done. Deleted the module. :-)
+ }
+
+ @Override
+ public void setUp() {
+ }
+
+ /**
+ * Test creation of new request.
+ *
+ * @throws Exception
+ */
+ @SmallTest
+ @Feature({"Cronet"})
+ public void testNewRequest() throws Exception {
+ HashMap<String, String> headers = new HashMap<String, String>();
+ WritableByteChannel sink = new FileOutputStream("out.xml").getChannel();
+ UrlRequest request = new UrlRequest(mRequestContext,
+ "test_url",
+ UrlRequest.REQUEST_PRIORITY_MEDIUM,
+ headers,
+ sink);
+ assertTrue(request != null);
mmenke 2014/02/27 23:06:02 Also two space ident.
mef 2014/03/03 19:15:13 Done.
+ }
+}
+

Powered by Google App Engine
This is Rietveld 408576698