| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2013 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 MSG_SUCCESS, | 139 MSG_SUCCESS, |
| 140 MSG_FAILURE, | 140 MSG_FAILURE, |
| 141 }; | 141 }; |
| 142 | 142 |
| 143 const char* get_key() { | 143 const char* get_key() { |
| 144 return kKeysAndCerts[key_index_].rsa_private_key_pem; | 144 return kKeysAndCerts[key_index_].rsa_private_key_pem; |
| 145 } | 145 } |
| 146 const char* get_cert() { return kKeysAndCerts[key_index_].cert_pem; } | 146 const char* get_cert() { return kKeysAndCerts[key_index_].cert_pem; } |
| 147 | 147 |
| 148 // rtc::MessageHandler implementation. | 148 // rtc::MessageHandler implementation. |
| 149 void OnMessage(rtc::Message* msg) override { | 149 void OnMessage(rtc::Message* msg) { |
| 150 MessageData* message_data = static_cast<MessageData*>(msg->pdata); | 150 MessageData* message_data = static_cast<MessageData*>(msg->pdata); |
| 151 rtc::scoped_refptr<webrtc::DtlsIdentityRequestObserver> observer = | 151 rtc::scoped_refptr<webrtc::DtlsIdentityRequestObserver> observer = |
| 152 message_data->data(); | 152 message_data->data(); |
| 153 switch (msg->message_id) { | 153 switch (msg->message_id) { |
| 154 case MSG_SUCCESS: { | 154 case MSG_SUCCESS: { |
| 155 std::string cert; | 155 std::string cert; |
| 156 std::string key; | 156 std::string key; |
| 157 rtc::SSLIdentity::PemToDer("CERTIFICATE", get_cert(), &cert); | 157 rtc::SSLIdentity::PemToDer("CERTIFICATE", get_cert(), &cert); |
| 158 rtc::SSLIdentity::PemToDer("RSA PRIVATE KEY", get_key(), &key); | 158 rtc::SSLIdentity::PemToDer("RSA PRIVATE KEY", get_key(), &key); |
| 159 observer->OnSuccess(cert, key); | 159 observer->OnSuccess(cert, key); |
| 160 break; | 160 break; |
| 161 } | 161 } |
| 162 case MSG_FAILURE: | 162 case MSG_FAILURE: |
| 163 observer->OnFailure(0); | 163 observer->OnFailure(0); |
| 164 break; | 164 break; |
| 165 } | 165 } |
| 166 delete message_data; | 166 delete message_data; |
| 167 } | 167 } |
| 168 | 168 |
| 169 bool should_fail_; | 169 bool should_fail_; |
| 170 int key_index_ = 0; | 170 int key_index_ = 0; |
| 171 }; | 171 }; |
| 172 | 172 |
| 173 #endif // WEBRTC_API_TEST_FAKEDTLSIDENTITYSERVICE_H_ | 173 #endif // WEBRTC_API_TEST_FAKEDTLSIDENTITYSERVICE_H_ |
| OLD | NEW |