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

Unified Diff: components/cronet/android/test/javatests/src/org/chromium/net/HttpUrlRequestFactoryTest.java

Issue 1363723002: [Cronet] Create Builders, rename UrlRequestContext to CronetEngine (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: make old API work without renaming Created 5 years, 2 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/test/javatests/src/org/chromium/net/HttpUrlRequestFactoryTest.java
diff --git a/components/cronet/android/test/javatests/src/org/chromium/net/HttpUrlRequestFactoryTest.java b/components/cronet/android/test/javatests/src/org/chromium/net/HttpUrlRequestFactoryTest.java
index 7dbfbcadbe881d04041b11fe22f7a3ae21c4398f..7c34bdd64dae9c35dbf47050ab92a49278a26d77 100644
--- a/components/cronet/android/test/javatests/src/org/chromium/net/HttpUrlRequestFactoryTest.java
+++ b/components/cronet/android/test/javatests/src/org/chromium/net/HttpUrlRequestFactoryTest.java
@@ -23,7 +23,7 @@ public class HttpUrlRequestFactoryTest extends CronetTestBase {
@SmallTest
@Feature({"Cronet"})
public void testCreateFactory() throws Throwable {
- HttpUrlRequestFactoryConfig config = new HttpUrlRequestFactoryConfig();
+ HttpUrlRequestFactoryConfig config = new HttpUrlRequestFactoryConfig(null);
mef 2015/10/02 16:46:58 Is it possible to get these tests to build an pass
pauljensen 2015/10/02 18:23:15 Done.
config.enableQUIC(true);
config.addQuicHint("www.google.com", 443, 443);
config.addQuicHint("www.youtube.com", 443, 443);
@@ -44,11 +44,11 @@ public class HttpUrlRequestFactoryTest extends CronetTestBase {
@SmallTest
@Feature({"Cronet"})
public void testCreateLegacyFactory() {
- HttpUrlRequestFactoryConfig config = new HttpUrlRequestFactoryConfig();
+ HttpUrlRequestFactoryConfig config =
+ new HttpUrlRequestFactoryConfig(getInstrumentation().getTargetContext());
config.enableLegacyMode(true);
- HttpUrlRequestFactory factory = HttpUrlRequestFactory.createFactory(
- getInstrumentation().getTargetContext(), config);
+ HttpUrlRequestFactory factory = HttpUrlRequestFactory.createFactory(config);
assertNotNull("Factory should be created", factory);
assertTrue("Factory should be HttpUrlConnection/n.n.n.n@r but is "
+ factory.getName(),
@@ -67,12 +67,12 @@ public class HttpUrlRequestFactoryTest extends CronetTestBase {
@SmallTest
@Feature({"Cronet"})
- public void testCreateLegacyFactoryUsingUrlRequestContextConfig() {
- UrlRequestContextConfig config = new UrlRequestContextConfig();
- config.enableLegacyMode(true);
+ public void testCreateLegacyFactoryUsingCronetEngineBuilder() {
+ CronetEngine.Builder builder =
+ new CronetEngine.Builder(getInstrumentation().getTargetContext());
+ builder.enableLegacyMode(true);
- HttpUrlRequestFactory factory = HttpUrlRequestFactory.createFactory(
- getInstrumentation().getTargetContext(), config);
+ HttpUrlRequestFactory factory = HttpUrlRequestFactory.createFactory(builder);
assertNotNull("Factory should be created", factory);
assertTrue("Factory should be HttpUrlConnection/n.n.n.n@r but is "
+ factory.getName(),
@@ -92,7 +92,7 @@ public class HttpUrlRequestFactoryTest extends CronetTestBase {
@SmallTest
@Feature({"Cronet"})
public void testQuicHintHost() {
- HttpUrlRequestFactoryConfig config = new HttpUrlRequestFactoryConfig();
+ HttpUrlRequestFactoryConfig config = new HttpUrlRequestFactoryConfig(null);
config.addQuicHint("www.google.com", 443, 443);
try {
config.addQuicHint("https://www.google.com", 443, 443);
@@ -105,13 +105,13 @@ public class HttpUrlRequestFactoryTest extends CronetTestBase {
@SmallTest
@Feature({"Cronet"})
public void testConfigUserAgent() throws Throwable {
- HttpUrlRequestFactoryConfig config = new HttpUrlRequestFactoryConfig();
+ HttpUrlRequestFactoryConfig config =
+ new HttpUrlRequestFactoryConfig(getInstrumentation().getTargetContext());
String userAgentName = "User-Agent";
String userAgentValue = "User-Agent-Value";
config.setUserAgent(userAgentValue);
config.setLibraryName("cronet_tests");
- HttpUrlRequestFactory factory = HttpUrlRequestFactory.createFactory(
- getInstrumentation().getTargetContext(), config);
+ HttpUrlRequestFactory factory = HttpUrlRequestFactory.createFactory(config);
assertTrue(NativeTestServer.startNativeTestServer(
getInstrumentation().getTargetContext()));
String url = NativeTestServer.getEchoHeaderURL(userAgentName);
@@ -128,13 +128,13 @@ public class HttpUrlRequestFactoryTest extends CronetTestBase {
@SmallTest
@Feature({"Cronet"})
public void testConfigUserAgentLegacy() throws Throwable {
- HttpUrlRequestFactoryConfig config = new HttpUrlRequestFactoryConfig();
+ HttpUrlRequestFactoryConfig config =
+ new HttpUrlRequestFactoryConfig(getInstrumentation().getTargetContext());
String userAgentName = "User-Agent";
String userAgentValue = "User-Agent-Value";
config.setUserAgent(userAgentValue);
config.enableLegacyMode(true);
- HttpUrlRequestFactory factory = HttpUrlRequestFactory.createFactory(
- getInstrumentation().getTargetContext(), config);
+ HttpUrlRequestFactory factory = HttpUrlRequestFactory.createFactory(config);
assertTrue("Factory should be HttpUrlConnection/n.n.n.n@r but is "
+ factory.getName(),
Pattern.matches(
@@ -159,7 +159,7 @@ public class HttpUrlRequestFactoryTest extends CronetTestBase {
@SmallTest
@Feature({"Cronet"})
public void testEnableHttpCache() {
- HttpUrlRequestFactoryConfig config = new HttpUrlRequestFactoryConfig();
+ HttpUrlRequestFactoryConfig config = new HttpUrlRequestFactoryConfig(null);
config.enableHttpCache(HttpUrlRequestFactoryConfig.HTTP_CACHE_DISABLED, 0);
config.enableHttpCache(HttpUrlRequestFactoryConfig.HTTP_CACHE_IN_MEMORY, 0);
try {

Powered by Google App Engine
This is Rietveld 408576698