OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.net; | 5 package org.chromium.net; |
6 | 6 |
7 import android.support.test.filters.SmallTest; | 7 import android.support.test.filters.SmallTest; |
8 | 8 |
9 import org.chromium.base.test.util.Feature; | 9 import org.chromium.base.test.util.Feature; |
10 | 10 |
11 /** | 11 /** |
12 * Simple test for Brotli support. | 12 * Simple test for Brotli support. |
13 */ | 13 */ |
14 public class BrotliTest extends CronetTestBase { | 14 public class BrotliTest extends CronetTestBase { |
15 private CronetTestFramework mTestFramework; | 15 private CronetTestFramework mTestFramework; |
16 | 16 |
17 @Override | 17 @Override |
18 protected void setUp() throws Exception { | 18 protected void setUp() throws Exception { |
19 super.setUp(); | 19 super.setUp(); |
20 // Load library first to create MockCertVerifier. | 20 // Load library first to create MockCertVerifier. |
21 System.loadLibrary("cronet_tests"); | 21 System.loadLibrary("cronet_tests"); |
22 assertTrue(Http2TestServer.startHttp2TestServer( | 22 assertTrue(Http2TestServer.startHttp2TestServer( |
23 getContext(), QuicTestServer.getServerCert(), QuicTestServer.get
ServerCertKey())); | 23 getContext(), SERVER_CERT_PEM, SERVER_KEY_PKCS8_PEM)); |
24 } | 24 } |
25 | 25 |
26 @Override | 26 @Override |
27 protected void tearDown() throws Exception { | 27 protected void tearDown() throws Exception { |
28 assertTrue(Http2TestServer.shutdownHttp2TestServer()); | 28 assertTrue(Http2TestServer.shutdownHttp2TestServer()); |
29 mTestFramework.mCronetEngine.shutdown(); | 29 mTestFramework.mCronetEngine.shutdown(); |
30 super.tearDown(); | 30 super.tearDown(); |
31 } | 31 } |
32 | 32 |
33 @SmallTest | 33 @SmallTest |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 private TestUrlRequestCallback startAndWaitForComplete(String url) { | 82 private TestUrlRequestCallback startAndWaitForComplete(String url) { |
83 TestUrlRequestCallback callback = new TestUrlRequestCallback(); | 83 TestUrlRequestCallback callback = new TestUrlRequestCallback(); |
84 UrlRequest.Builder builder = mTestFramework.mCronetEngine.newUrlRequestB
uilder( | 84 UrlRequest.Builder builder = mTestFramework.mCronetEngine.newUrlRequestB
uilder( |
85 url, callback, callback.getExecutor()); | 85 url, callback, callback.getExecutor()); |
86 builder.build().start(); | 86 builder.build().start(); |
87 callback.blockForDone(); | 87 callback.blockForDone(); |
88 return callback; | 88 return callback; |
89 } | 89 } |
90 } | 90 } |
OLD | NEW |