1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 package org.chromium.cronet_sample_apk;
7 import android.test.InstrumentationTestCase;
8 import android.test.suitebuilder.annotation.SmallTest;
10 import org.chromium.base.test.util.Feature;
11 import org.chromium.net.HttpUrlRequestFactory;
12 import org.chromium.net.HttpUrlRequestFactoryConfig;
14 import java.util.regex.Pattern;
17 * Tests for {@link ChunkedWritableByteChannel}
19 public class HttpUrlRequestFactoryTest extends InstrumentationTestCase {
22 public void testCreateFactory() {
23 HttpUrlRequestFactoryConfig config = new HttpUrlRequestFactoryConfig();
24 HttpUrlRequestFactory factory = HttpUrlRequestFactory.createFactory(
25 getInstrumentation().getContext(), config);
26 assertNotNull("Factory should be created", factory);
27 assertTrue("Factory should be Chromium/n.n.n.n/r",
28 Pattern.matches("Chromium/\\d+\\.\\d+\\.\\d+\\.\\d+@\\d+",
34 public void testCreateLegacyFactory() {
35 HttpUrlRequestFactoryConfig config = new HttpUrlRequestFactoryConfig();
36 config.enableLegacyMode(true);
38 HttpUrlRequestFactory factory = HttpUrlRequestFactory.createFactory(
39 getInstrumentation().getContext(), config);
40 assertNotNull("Factory should be created", factory);
41 assertTrue("Factory should be HttpUrlConnection/n.n.n.n@r",
42 Pattern.matches("HttpUrlConnection/\\d+\\.\\d+\\.\\d+\\.\\d+@\\d+",