Index: third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-generateCertificate.html |
diff --git a/third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-generateCertificate.html b/third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-generateCertificate.html |
index 65e2837c9bc1f44aa7da90be469660ebd458565b..b7d2945e987d15398aea5ce756436f84b6ce3f92 100644 |
--- a/third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-generateCertificate.html |
+++ b/third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-generateCertificate.html |
@@ -13,12 +13,13 @@ var dayInMs = 24 * 60 * minuteInMs; |
// Signature of the last generateCertificate call. |
var generateCallString = null; |
-// Global certificate variables so that the "should..." methods can evaluate them. |
+// Global variables so that the "should..." methods can evaluate them. |
var certRSA = null; |
var certECDSA = null; |
var certExpiresNegativeOneDay = null; |
var certExpiresZero = null; |
var certExpiresPositiveOneDay = null; |
+var fingerprints = null; |
// 1: RSA-2048 using public exponent = 65537. |
function generate1RSA() |
@@ -101,6 +102,23 @@ function certificateSanityCheck(certVariableName) |
{ |
shouldBeNonNull(certVariableName); |
shouldBeTrue('new Date().getTime() < ' + certVariableName + '.expires'); |
+ shouldBeTrue(certVariableName + '.getFingerprints().length == 1'); |
+ shouldBeTrue(certVariableName + '.getFingerprints()[0].algorithm === "sha-256"'); |
+ shouldBeTrue('isFingerprintValue(' + certVariableName + '.getFingerprints()[0].value)'); |
+ // Fingerprints are dictionaries, a copy should be returned each time. |
+ shouldBeTrue(certVariableName + '.getFingerprints()[0] != ' + certVariableName + '.getFingerprints()[0]'); |
+} |
+function isFingerprintValue(fingerprint) { |
+ // / Begin regex |
+ // ^ Start of line |
+ // (?: Non-capturing parenthesis |
+ // [a-z0-9]{2} 2 lowercase alphanumeric characters |
+ // \: The : character |
+ // )+ End of parenthesis, match 1 or more times |
+ // [a-z0-9]{2} 2 lowercase alphanumeric characters |
+ // $ End of line |
+ // / End of regex |
+ return /^(?:[a-z0-9]{2}\:)+[a-z0-9]{2}$/.test(fingerprint); |
} |
// Run each generate test sequentially. The ith generate method will make sure |