OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 void set_should_fail(bool should_fail) { | 76 void set_should_fail(bool should_fail) { |
77 should_fail_ = should_fail; | 77 should_fail_ = should_fail; |
78 } | 78 } |
79 | 79 |
80 void RequestIdentity( | 80 void RequestIdentity( |
81 rtc::KeyType key_type, | 81 rtc::KeyType key_type, |
82 const rtc::scoped_refptr<webrtc::DtlsIdentityRequestObserver>& | 82 const rtc::scoped_refptr<webrtc::DtlsIdentityRequestObserver>& |
83 observer) override { | 83 observer) override { |
84 // TODO(hbos): Should be able to generate KT_ECDSA too. | 84 // TODO(hbos): Should be able to generate KT_ECDSA too. |
85 DCHECK(key_type == rtc::KT_RSA || should_fail_); | 85 RTC_DCHECK(key_type == rtc::KT_RSA || should_fail_); |
86 MessageData* msg = new MessageData( | 86 MessageData* msg = new MessageData( |
87 rtc::scoped_refptr<webrtc::DtlsIdentityRequestObserver>(observer)); | 87 rtc::scoped_refptr<webrtc::DtlsIdentityRequestObserver>(observer)); |
88 rtc::Thread::Current()->Post( | 88 rtc::Thread::Current()->Post( |
89 this, should_fail_ ? MSG_FAILURE : MSG_SUCCESS, msg); | 89 this, should_fail_ ? MSG_FAILURE : MSG_SUCCESS, msg); |
90 } | 90 } |
91 | 91 |
92 static rtc::scoped_refptr<rtc::RTCCertificate> GenerateCertificate() { | 92 static rtc::scoped_refptr<rtc::RTCCertificate> GenerateCertificate() { |
93 std::string cert; | 93 std::string cert; |
94 std::string key; | 94 std::string key; |
95 rtc::SSLIdentity::PemToDer("CERTIFICATE", kCERT_PEM, &cert); | 95 rtc::SSLIdentity::PemToDer("CERTIFICATE", kCERT_PEM, &cert); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 observer->OnFailure(0); | 134 observer->OnFailure(0); |
135 break; | 135 break; |
136 } | 136 } |
137 delete message_data; | 137 delete message_data; |
138 } | 138 } |
139 | 139 |
140 bool should_fail_; | 140 bool should_fail_; |
141 }; | 141 }; |
142 | 142 |
143 #endif // TALK_APP_WEBRTC_TEST_FAKEDTLSIDENTITYSERVICE_H_ | 143 #endif // TALK_APP_WEBRTC_TEST_FAKEDTLSIDENTITYSERVICE_H_ |
OLD | NEW |