Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Side by Side Diff: content/renderer/media/rtc_certificate_generator.cc

Issue 2432493002: Handle RTCCertificate::fromPEM returning nullptr, with a unit test. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "content/renderer/media/rtc_certificate_generator.h" 5 #include "content/renderer/media/rtc_certificate_generator.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 return WebRTCKeyParamsToKeyParams(key_params).IsValid(); 159 return WebRTCKeyParamsToKeyParams(key_params).IsValid();
160 } 160 }
161 161
162 std::unique_ptr<blink::WebRTCCertificate> RTCCertificateGenerator::fromPEM( 162 std::unique_ptr<blink::WebRTCCertificate> RTCCertificateGenerator::fromPEM(
163 blink::WebString pem_private_key, 163 blink::WebString pem_private_key,
164 blink::WebString pem_certificate) { 164 blink::WebString pem_certificate) {
165 rtc::scoped_refptr<rtc::RTCCertificate> certificate = 165 rtc::scoped_refptr<rtc::RTCCertificate> certificate =
166 rtc::RTCCertificate::FromPEM( 166 rtc::RTCCertificate::FromPEM(
167 rtc::RTCCertificatePEM(pem_private_key.utf8(), 167 rtc::RTCCertificatePEM(pem_private_key.utf8(),
168 pem_certificate.utf8())); 168 pem_certificate.utf8()));
169 return std::unique_ptr<blink::WebRTCCertificate>( 169 if (!certificate)
170 new RTCCertificate(certificate)); 170 return nullptr;
171 return base::MakeUnique<RTCCertificate>(certificate);
171 } 172 }
172 173
173 } // namespace content 174 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/test/test_blink_web_unit_test_support.cc » ('j') | content/test/test_blink_web_unit_test_support.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698