Chromium Code Reviews| 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 #include "mock_cert_verifier.h" | 5 #include "mock_cert_verifier.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 // Calculate the public key hash and add it to the verify_result. | 67 // Calculate the public key hash and add it to the verify_result. |
| 68 net::HashValue hashValue; | 68 net::HashValue hashValue; |
| 69 CHECK(CalculatePublicKeySha256(*verify_result.verified_cert.get(), | 69 CHECK(CalculatePublicKeySha256(*verify_result.verified_cert.get(), |
| 70 &hashValue)); | 70 &hashValue)); |
| 71 verify_result.public_key_hashes.push_back(hashValue); | 71 verify_result.public_key_hashes.push_back(hashValue); |
| 72 | 72 |
| 73 mock_cert_verifier->AddResultForCert(verify_result.verified_cert.get(), | 73 mock_cert_verifier->AddResultForCert(verify_result.verified_cert.get(), |
| 74 verify_result, net::OK); | 74 verify_result, net::OK); |
| 75 } | 75 } |
| 76 | 76 |
| 77 if (certs.empty()) | |
| 78 mock_cert_verifier->set_default_result(net::OK); | |
|
mef
2015/12/08 02:42:30
This will likely be unnecessary if we can run serv
| |
| 79 | |
| 77 return reinterpret_cast<jlong>(mock_cert_verifier); | 80 return reinterpret_cast<jlong>(mock_cert_verifier); |
| 78 } | 81 } |
| 79 | 82 |
| 80 bool RegisterMockCertVerifier(JNIEnv* env) { | 83 bool RegisterMockCertVerifier(JNIEnv* env) { |
| 81 return RegisterNativesImpl(env); | 84 return RegisterNativesImpl(env); |
| 82 } | 85 } |
| 83 | 86 |
| 84 } // namespace cronet | 87 } // namespace cronet |
| OLD | NEW |