| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.content.Context; | 7 import android.content.Context; |
| 8 import android.content.Intent; | 8 import android.content.Intent; |
| 9 import android.net.ConnectivityManager; | 9 import android.net.ConnectivityManager; |
| 10 import android.telephony.TelephonyManager; | 10 import android.telephony.TelephonyManager; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 * Tests for org.chromium.net.X509Util. | 29 * Tests for org.chromium.net.X509Util. |
| 30 */ | 30 */ |
| 31 public class X509UtilTest extends InstrumentationTestCase { | 31 public class X509UtilTest extends InstrumentationTestCase { |
| 32 private static final String CERTS_DIRECTORY = | 32 private static final String CERTS_DIRECTORY = |
| 33 PathUtils.getExternalStorageDirectory() + "/net/data/ssl/certificates/"; | 33 PathUtils.getExternalStorageDirectory() + "/net/data/ssl/certificates/"; |
| 34 private static final String BAD_EKU_TEST_ROOT = "eku-test-root.pem"; | 34 private static final String BAD_EKU_TEST_ROOT = "eku-test-root.pem"; |
| 35 private static final String CRITICAL_CODE_SIGNING_EE = "crit-codeSigning-cha
in.pem"; | 35 private static final String CRITICAL_CODE_SIGNING_EE = "crit-codeSigning-cha
in.pem"; |
| 36 private static final String NON_CRITICAL_CODE_SIGNING_EE = "non-crit-codeSig
ning-chain.pem"; | 36 private static final String NON_CRITICAL_CODE_SIGNING_EE = "non-crit-codeSig
ning-chain.pem"; |
| 37 private static final String WEB_CLIENT_AUTH_EE = "invalid_key_usage_cert.der
"; | 37 private static final String WEB_CLIENT_AUTH_EE = "invalid_key_usage_cert.der
"; |
| 38 private static final String OK_CERT = "ok_cert.pem"; | 38 private static final String OK_CERT = "ok_cert.pem"; |
| 39 private static final String GOOD_ROOT_CA = "root_ca_cert.crt"; | 39 private static final String GOOD_ROOT_CA = "root_ca_cert.pem"; |
| 40 | 40 |
| 41 private static final String BEGIN_MARKER = "-----BEGIN CERTIFICATE-----"; | 41 private static final String BEGIN_MARKER = "-----BEGIN CERTIFICATE-----"; |
| 42 private static final String END_MARKER = "-----END CERTIFICATE-----"; | 42 private static final String END_MARKER = "-----END CERTIFICATE-----"; |
| 43 | 43 |
| 44 private static byte[] pemToDer(String pemPathname) throws IOException { | 44 private static byte[] pemToDer(String pemPathname) throws IOException { |
| 45 BufferedReader reader = new BufferedReader(new FileReader(pemPathname)); | 45 BufferedReader reader = new BufferedReader(new FileReader(pemPathname)); |
| 46 StringBuilder builder = new StringBuilder(); | 46 StringBuilder builder = new StringBuilder(); |
| 47 | 47 |
| 48 // Skip past leading junk lines, if any. | 48 // Skip past leading junk lines, if any. |
| 49 String line = reader.readLine(); | 49 String line = reader.readLine(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 pemToDer(CERTS_DIRECTORY + OK_CERT)))); | 93 pemToDer(CERTS_DIRECTORY + OK_CERT)))); |
| 94 | 94 |
| 95 try { | 95 try { |
| 96 X509Util.clearTestRootCertificates(); | 96 X509Util.clearTestRootCertificates(); |
| 97 } catch (Exception e) { | 97 } catch (Exception e) { |
| 98 fail("Could not clear test root certificates: " + e.toString()); | 98 fail("Could not clear test root certificates: " + e.toString()); |
| 99 } | 99 } |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 | 102 |
| OLD | NEW |