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

Unified Diff: third_party/WebKit/LayoutTests/fast/mediastream/RTCPeerConnection-generateCertificate.html

Issue 1373023002: RTCCertificate, RTCPeerConnection.generateCertificate (WebRTC JavaScript) added. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed jochen's comments Created 5 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/mediastream/RTCPeerConnection-generateCertificate.html
diff --git a/third_party/WebKit/LayoutTests/fast/mediastream/RTCPeerConnection-generateCertificate.html b/third_party/WebKit/LayoutTests/fast/mediastream/RTCPeerConnection-generateCertificate.html
new file mode 100644
index 0000000000000000000000000000000000000000..108fc0a497b7c6b1498240ebc518db25e52b186f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/mediastream/RTCPeerConnection-generateCertificate.html
@@ -0,0 +1,72 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../../resources/js-test.js"></script>
+</head>
+<body>
+<script>
+description("Tests RTCPeerConnection.generateCertificate RSA/ECDSA.");
+
+// Signature of the last generateCertificate call.
+var generateCallString = null;
+// Global certificate variables so that the "should..." methods can evaluate them.
+var certRSA = null;
+var certECDSA = null;
+
+// 1: RSA-2048 using public exponent = 65537.
+function generate1RSA()
+{
+ generateCallString = 'generateCertificate({ name: "RSASSA-PKCS1-v1_5", modulusLength: 2048, publicExponent: 65537 })';
+ webkitRTCPeerConnection.generateCertificate({ name: "RSASSA-PKCS1-v1_5", modulusLength: 2048, publicExponent: 65537 })
+ .then(generate1RSASuccessful, generate1RSAFailed);
+}
+function generate1RSASuccessful(certificate)
+{
+ certRSA = certificate;
+ testPassed(generateCallString);
+ certificateSanityCheck(certificate, 'certRSA');
+ generate2ECDSA();
+}
+function generate1RSAFailed()
+{
+ testFailed(generateCallString);
+ generate2ECDSA();
+}
+
+// 2: ECDSA using NIST P-256.
+function generate2ECDSA()
+{
+ generateCallString = 'generateCertificate({ name: "ECDSA", namedCurve: "P-256" })';
+ webkitRTCPeerConnection.generateCertificate({ name: "ECDSA", namedCurve: "P-256" })
+ .then(generate2ECDSASuccessful, generate2ECDSAFailed);
+}
+function generate2ECDSASuccessful(certificate)
+{
+ certECDSA = certificate;
+ testPassed(generateCallString);
+ certificateSanityCheck(certificate, 'certECDSA');
+ finishJSTest();
+}
+function generate2ECDSAFailed()
+{
+ testFailed(generateCallString);
+ finishJSTest();
+}
+
+// Helper methods.
+function certificateSanityCheck(cert, certVariableName)
+{
+ shouldBeNonNull(certVariableName);
+ // TODO(hbos): Check cert.expires when WebRTC certificates have reasonable expires values.
+}
+
+// Run each generate test sequentially. The ith generate method will make sure
+// the (i+1)st generate method is executed when its promise's callbacks are
+// invoked. generate2ECDSA's callback methods mark the end of the async tests.
+generate1RSA();
+
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698