| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 static org.chromium.base.CollectionUtil.newHashSet; | 7 import static org.chromium.base.CollectionUtil.newHashSet; |
| 8 | 8 |
| 9 import android.os.ConditionVariable; | 9 import android.os.ConditionVariable; |
| 10 import android.support.test.filters.SmallTest; | 10 import android.support.test.filters.SmallTest; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 super.setUp(); | 39 super.setUp(); |
| 40 // Load library first to create MockCertVerifier. | 40 // Load library first to create MockCertVerifier. |
| 41 System.loadLibrary("cronet_tests"); | 41 System.loadLibrary("cronet_tests"); |
| 42 ExperimentalCronetEngine.Builder builder = | 42 ExperimentalCronetEngine.Builder builder = |
| 43 new ExperimentalCronetEngine.Builder(getContext()); | 43 new ExperimentalCronetEngine.Builder(getContext()); |
| 44 CronetTestUtil.setMockCertVerifierForTesting( | 44 CronetTestUtil.setMockCertVerifierForTesting( |
| 45 builder, QuicTestServer.createMockCertVerifier()); | 45 builder, QuicTestServer.createMockCertVerifier()); |
| 46 | 46 |
| 47 mTestFramework = startCronetTestFrameworkWithUrlAndCronetEngineBuilder(n
ull, builder); | 47 mTestFramework = startCronetTestFrameworkWithUrlAndCronetEngineBuilder(n
ull, builder); |
| 48 assertTrue(Http2TestServer.startHttp2TestServer( | 48 assertTrue(Http2TestServer.startHttp2TestServer( |
| 49 getContext(), QuicTestServer.getServerCert(), QuicTestServer.get
ServerCertKey())); | 49 getContext(), SERVER_CERT_PEM, SERVER_KEY_PKCS8_PEM)); |
| 50 } | 50 } |
| 51 | 51 |
| 52 @Override | 52 @Override |
| 53 protected void tearDown() throws Exception { | 53 protected void tearDown() throws Exception { |
| 54 assertTrue(Http2TestServer.shutdownHttp2TestServer()); | 54 assertTrue(Http2TestServer.shutdownHttp2TestServer()); |
| 55 if (mTestFramework.mCronetEngine != null) { | 55 if (mTestFramework.mCronetEngine != null) { |
| 56 mTestFramework.mCronetEngine.shutdown(); | 56 mTestFramework.mCronetEngine.shutdown(); |
| 57 } | 57 } |
| 58 super.tearDown(); | 58 super.tearDown(); |
| 59 } | 59 } |
| (...skipping 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1502 private static String bufferContentsToString(ByteBuffer byteBuffer, int star
t, int end) { | 1502 private static String bufferContentsToString(ByteBuffer byteBuffer, int star
t, int end) { |
| 1503 // Use a duplicate to avoid modifying byteBuffer. | 1503 // Use a duplicate to avoid modifying byteBuffer. |
| 1504 ByteBuffer duplicate = byteBuffer.duplicate(); | 1504 ByteBuffer duplicate = byteBuffer.duplicate(); |
| 1505 duplicate.position(start); | 1505 duplicate.position(start); |
| 1506 duplicate.limit(end); | 1506 duplicate.limit(end); |
| 1507 byte[] contents = new byte[duplicate.remaining()]; | 1507 byte[] contents = new byte[duplicate.remaining()]; |
| 1508 duplicate.get(contents); | 1508 duplicate.get(contents); |
| 1509 return new String(contents); | 1509 return new String(contents); |
| 1510 } | 1510 } |
| 1511 } | 1511 } |
| OLD | NEW |