Index: chrome/test/data/webrtc/peerconnection.js |
diff --git a/chrome/test/data/webrtc/peerconnection.js b/chrome/test/data/webrtc/peerconnection.js |
index d236dc51303ae40b6170ca66954d0e2ebea9c268..22963b43f09fcf0a8b429b9be8a976bd40c1152b 100644 |
--- a/chrome/test/data/webrtc/peerconnection.js |
+++ b/chrome/test/data/webrtc/peerconnection.js |
@@ -245,6 +245,30 @@ function verifyDefaultCodecs(sessionDescJson) { |
returnToTest('ok-verified'); |
} |
+/** |
+ * Verifies that the peer connection's local description contains one of |
+ * |certificate|'s fingerprints. |
+ * |
+ * Returns 'ok-verified' on success. |
+ */ |
+function verifyLocalDescriptionContainsCertificate(certificate) { |
+ let localDescription = peerConnection_().localDescription; |
+ if (localDescription == null) |
+ throw failTest('localDescription is null.'); |
+ for (let i = 0; i < certificate.getFingerprints().length; ++i) { |
+ let fingerprintSdp = 'a=fingerprint:' + |
+ certificate.getFingerprints()[i].algorithm + ' ' + |
+ certificate.getFingerprints()[i].value.toUpperCase(); |
+ if (localDescription.sdp.includes(fingerprintSdp)) { |
+ returnToTest('ok-verified'); |
+ return; |
+ } |
+ } |
+ if (!localDescription.sdp.includes('a=fingerprint')) |
+ throw failTest('localDescription does not contain any fingerprints.'); |
+ throw failTest('Certificate fingerprint not found in localDescription.'); |
+} |
+ |
/** |
* Asks this page to accept an answer generated by the peer in response to a |
* previous offer by this page |