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

Unified Diff: net/cronet/android/sample/javatests/src/org/chromium/cronet_sample_apk/CronetSampleUrlTest.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/sample/javatests/src/org/chromium/cronet_sample_apk/CronetSampleUrlTest.java
diff --git a/net/cronet/android/sample/javatests/src/org/chromium/cronet_sample_apk/CronetSampleUrlTest.java b/net/cronet/android/sample/javatests/src/org/chromium/cronet_sample_apk/CronetSampleUrlTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..1a0ebb7e8c6a3139d8d39615b13351abfa1b841d
--- /dev/null
+++ b/net/cronet/android/sample/javatests/src/org/chromium/cronet_sample_apk/CronetSampleUrlTest.java
@@ -0,0 +1,47 @@
+// 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.cronet_sample_apk;
+
+import android.test.suitebuilder.annotation.SmallTest;
+
+import org.chromium.base.test.util.Feature;
+
+/**
+ * Example test that just starts the cronet sample.
+ */
+public class CronetSampleUrlTest extends CronetSampleTestBase {
+ // URL used for base tests.
+ private static final String URL = "http://127.0.0.1:8000";
+
+ @SmallTest
+ @Feature({"Main"})
+ public void testLoadUrl() throws Exception {
+ CronetSampleActivity activity = launchCronetSampleWithUrl(URL);
+
+ // Make sure the activity was created as expected.
+ assertNotNull(activity);
+
+ waitForActiveShellToBeDoneLoading();
+
+ // Make sure that the URL is set as expected.
+ assertEquals(URL, activity.getUrl());
+ assertEquals(200, activity.getHttpStatusCode());
mmenke 2014/02/27 23:06:02 2-space indent.
mef 2014/03/03 19:15:13 Done.
+ }
mmenke 2014/02/27 23:06:02 2-space indent.
mef 2014/03/03 19:15:13 Done.
+
+ @SmallTest
+ @Feature({"Main"})
+ public void testInvalidUrl() throws Exception {
+ CronetSampleActivity activity = launchCronetSampleWithUrl("127.0.0.1:8000");
mmenke 2014/02/27 23:06:02 Wrap line.
mef 2014/03/03 19:15:13 Done.
+
+ // Make sure the activity was created as expected.
+ assertNotNull(activity);
+
+ waitForActiveShellToBeDoneLoading();
+
+ // The load should fail.
+ assertEquals(0, activity.getHttpStatusCode());
+ }
mmenke 2014/02/27 23:06:02 2-space indent (x2)
mef 2014/03/03 19:15:13 Done.
+
+}

Powered by Google App Engine
This is Rietveld 408576698