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

Side by Side Diff: components/cronet/android/test/javatests/src/org/chromium/net/QuicTest.java

Issue 1039693003: [Cronet] Add support to run quic_simple_server (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Suppress fb warning Created 5 years, 8 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 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.
4
5 package org.chromium.net;
6
7 import android.test.suitebuilder.annotation.SmallTest;
8
9 import org.chromium.base.test.util.Feature;
10
11 import java.util.HashMap;
12
13 /**
14 * Tests making requests using QUIC.
15 */
16 public class QuicTest extends CronetTestBase {
17
18 @Override
19 protected void setUp() throws Exception {
20 super.setUp();
21 // Loads library first since native functions are used to retrieve
22 // QuicTestServer info before config is constructed.
23 System.loadLibrary("cronet_tests");
24 }
25
26 @SmallTest
27 @Feature({"Cronet"})
28 public void testQuicLoadUrl() throws Exception {
29 HttpUrlRequestFactoryConfig config = new HttpUrlRequestFactoryConfig();
30 String quicURL = QuicTestServer.getServerURL() + "/simple.txt";
31 config.enableQUIC(true);
32 config.setLibraryName("cronet_tests");
33 config.addQuicHint(QuicTestServer.getServerHost(),
34 QuicTestServer.getServerPort(), QuicTestServer.getServerPort());
35 config.setExperimentalQuicConnectionOptions("PACE,IW10,FOO,DEADBEEF");
36
37 String[] commandLineArgs = {
38 CronetTestActivity.CONFIG_KEY, config.toString() };
39 CronetTestActivity activity =
40 launchCronetTestAppWithUrlAndCommandLineArgs(null,
41 commandLineArgs);
42 QuicTestServer.startQuicTestServer(activity.getApplicationContext());
43 activity.startNetLog();
44
45 HashMap<String, String> headers = new HashMap<String, String>();
46 TestHttpUrlRequestListener listener = new TestHttpUrlRequestListener();
47
48 HttpUrlRequest request =
49 activity.mRequestFactory.createRequest(
50 quicURL,
51 HttpUrlRequest.REQUEST_PRIORITY_MEDIUM,
52 headers,
53 listener);
54 request.start();
55 listener.blockForComplete();
56 assertEquals(200, listener.mHttpStatusCode);
57 assertEquals(
58 "This is a simple text file served by QUIC.\n", listener.mRespon seAsString);
59 assertEquals("quic/1+spdy/3", listener.mNegotiatedProtocol);
60 activity.stopNetLog();
61 QuicTestServer.shutdownQuicTestServer();
62 }
63 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698