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..70c0a2f45e85403d303ec04926dddd0bcae68f0d 100644 |
--- a/chrome/test/data/webrtc/peerconnection.js |
+++ b/chrome/test/data/webrtc/peerconnection.js |
@@ -246,6 +246,30 @@ function verifyDefaultCodecs(sessionDescJson) { |
} |
/** |
+ * 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.fingerprints.length; ++i) { |
+ let fingerprintSdp = 'a=fingerprint:' + |
+ certificate.fingerprints[i].algorithm + ' ' + |
+ certificate.fingerprints[i].value; |
+ 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 |
* |