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

Unified Diff: components/cronet/android/sample/javatests/src/org/chromium/cronet_sample_apk/CronetSampleTest.java

Issue 512953002: Use proguard.cfg in cronet sample apk. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated CronetSampleTest to use proguard. Created 6 years, 3 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: components/cronet/android/sample/javatests/src/org/chromium/cronet_sample_apk/CronetSampleTest.java
diff --git a/components/cronet/android/sample/javatests/src/org/chromium/cronet_sample_apk/CronetSampleTestBase.java b/components/cronet/android/sample/javatests/src/org/chromium/cronet_sample_apk/CronetSampleTest.java
similarity index 74%
rename from components/cronet/android/sample/javatests/src/org/chromium/cronet_sample_apk/CronetSampleTestBase.java
rename to components/cronet/android/sample/javatests/src/org/chromium/cronet_sample_apk/CronetSampleTest.java
index eb44b56edd1666b5e3ea2ab8f43a17b95eb56e77..098431ff845b3b64bd01d333ccb12a1570514307 100644
--- a/components/cronet/android/sample/javatests/src/org/chromium/cronet_sample_apk/CronetSampleTestBase.java
+++ b/components/cronet/android/sample/javatests/src/org/chromium/cronet_sample_apk/CronetSampleTest.java
@@ -8,18 +8,19 @@ import android.content.ComponentName;
import android.content.Intent;
import android.net.Uri;
import android.test.ActivityInstrumentationTestCase2;
+import android.test.suitebuilder.annotation.SmallTest;
import android.text.TextUtils;
import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout;
-import org.chromium.base.test.util.UrlUtils;
+import org.chromium.base.test.util.Feature;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* Base test class for all CronetSample based tests.
*/
-public class CronetSampleTestBase extends
+public class CronetSampleTest extends
ActivityInstrumentationTestCase2<CronetSampleActivity> {
/**
@@ -31,10 +32,25 @@ public class CronetSampleTestBase extends
protected static final long
WAIT_PAGE_LOADING_TIMEOUT_SECONDS = scaleTimeout(15);
- public CronetSampleTestBase() {
+ // URL used for base tests.
+ private static final String URL = "http://127.0.0.1:8000";
+
+ public CronetSampleTest() {
super(CronetSampleActivity.class);
}
+ @SmallTest
+ @Feature({"Cronet"})
+ public void testLoadUrl() throws Exception {
+ CronetSampleActivity activity = launchCronetSampleWithUrl(URL);
+
+ // Make sure the activity was created as expected.
+ assertNotNull(activity);
+ // Make sure that the URL is set as expected.
+ assertEquals(URL, activity.getUrl());
+ assertEquals(200, activity.getHttpStatusCode());
+ }
+
/**
* Starts the CronetSample activity and loads the given URL. The URL can be
* null, in which case will default to
@@ -67,39 +83,6 @@ public class CronetSampleTestBase extends
return getActivity();
}
- // TODO(cjhopman): These functions are inconsistent with
- // launchCronetSample***. Should be startCronetSample*** and should use the
- // url exactly without the getTestFileUrl call. Possibly these two ways of
- // starting the activity (launch* and start*) should be merged into one.
- /**
- * Starts the content shell activity with the provided test url. The url is
- * synchronously loaded.
- *
- * @param url Test url to load.
- */
- protected void startActivityWithTestUrl(String url) throws Throwable {
- launchCronetSampleWithUrl(UrlUtils.getTestFileUrl(url));
- assertNotNull(getActivity());
- assertTrue(waitForActiveShellToBeDoneLoading());
- assertEquals(UrlUtils.getTestFileUrl(url), getActivity().getUrl());
- }
-
- /**
- * Starts the content shell activity with the provided test url and optional
- * command line arguments to append. The url is synchronously loaded.
- *
- * @param url Test url to load.
- * @param commandLineArgs Optional command line args to append when
- * launching the activity.
- */
- protected void startActivityWithTestUrlAndCommandLineArgs(String url,
- String[] commandLineArgs) throws Throwable {
- launchCronetSampleWithUrlAndCommandLineArgs(
- UrlUtils.getTestFileUrl(url), commandLineArgs);
- assertNotNull(getActivity());
- assertTrue(waitForActiveShellToBeDoneLoading());
- }
-
/**
* Waits for the Active shell to finish loading. This times out after
* WAIT_FOR_ACTIVE_SHELL_LOADING_TIMEOUT milliseconds and it shouldn't be

Powered by Google App Engine
This is Rietveld 408576698