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

Unified Diff: chrome/test/data/extensions/api_test/platform_keys/basic.js

Issue 1001853003: chrome.platformKeys: Require a algorithm name to getKeyPair(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments. Created 5 years, 9 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
« no previous file with comments | « chrome/renderer/resources/extensions/platform_keys/get_public_key.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/api_test/platform_keys/basic.js
diff --git a/chrome/test/data/extensions/api_test/platform_keys/basic.js b/chrome/test/data/extensions/api_test/platform_keys/basic.js
index 3f5c73574d5c01fb7075d96d8d2e66fedc9f7db7..8c88d36d1b04216a8d74f3f19635d1a98708e0b1 100644
--- a/chrome/test/data/extensions/api_test/platform_keys/basic.js
+++ b/chrome/test/data/extensions/api_test/platform_keys/basic.js
@@ -180,14 +180,12 @@ function testStaticMethods() {
assertTrue(!!chrome.platformKeys, "No platformKeys namespace.");
assertTrue(!!chrome.platformKeys.selectClientCertificates,
"No selectClientCertificates function.");
- succeed();
-}
-
-function testHasSubtleCryptoMethods(token) {
- assertTrue(!!token.subtleCrypto.generateKey,
- "token has no generateKey method");
- assertTrue(!!token.subtleCrypto.sign, "token has no sign method");
- assertTrue(!!token.subtleCrypto.exportKey, "token has no exportKey method");
+ assertTrue(!!chrome.platformKeys.getKeyPair, "No getKeyPair method.");
+ assertTrue(!!chrome.platformKeys.subtleCrypto, "No subtleCrypto getter.");
+ assertTrue(!!chrome.platformKeys.subtleCrypto(), "No subtleCrypto object.");
+ assertTrue(!!chrome.platformKeys.subtleCrypto().sign, "No sign method.");
+ assertTrue(!!chrome.platformKeys.subtleCrypto().exportKey,
+ "No exportKey method.");
succeed();
}
@@ -252,10 +250,28 @@ function testMatchResult() {
}));
}
+function testGetKeyPairMissingAlgorithName() {
+ var keyParams = {
+ // This is missing the algorithm name.
+ hash: {name: 'SHA-1'}
+ };
+ try {
+ chrome.platformKeys.getKeyPair(
+ data.client_1.buffer, keyParams, function(error) {
+ fail('getKeyPair call was expected to fail.');
+ });
+ fail('getKeyPair did not throw error');
+ } catch (e) {
+ assertEq('Algorithm: name: Missing or not a String', e.message);
+ succeed();
+ }
+}
+
function testGetKeyPair() {
var keyParams = {
// Algorithm names are case-insensitive.
- 'hash': {'name': 'sha-1'}
+ name: 'RSASSA-Pkcs1-V1_5',
+ hash: {name: 'sha-1'}
};
chrome.platformKeys.getKeyPair(
data.client_1.buffer, keyParams,
@@ -286,6 +302,7 @@ function testGetKeyPair() {
function testSignNoHash() {
var keyParams = {
// Algorithm names are case-insensitive.
+ name: 'RSASSA-PKCS1-V1_5',
hash: {name: 'NONE'}
};
var signParams = {
@@ -307,6 +324,7 @@ function testSignNoHash() {
function testSignSha1Client1() {
var keyParams = {
+ name: 'RSASSA-PKCS1-v1_5',
// Algorithm names are case-insensitive.
hash: {name: 'Sha-1'}
};
@@ -332,6 +350,7 @@ function testSignSha1Client1() {
// that's implemented.
function testSignFails(cert) {
var keyParams = {
+ name: 'RSASSA-PKCS1-v1_5',
hash: {name: 'SHA-1'}
};
var signParams = {
@@ -370,6 +389,7 @@ var testSuites = {
testSelectCA1Certs,
testInteractiveSelectNoCerts,
testMatchResult,
+ testGetKeyPairMissingAlgorithName,
testGetKeyPair,
testSignNoHash,
testSignSha1Client1,
« no previous file with comments | « chrome/renderer/resources/extensions/platform_keys/get_public_key.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698