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

Unified Diff: content/child/webcrypto/test/test_helpers.cc

Issue 661653002: [webcrypto] Implement RSA-PSS using BoringSSL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor_rsassa
Patch Set: rebase onto master (corrected) Created 6 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
« no previous file with comments | « content/child/webcrypto/test/test_helpers.h ('k') | content/child/webcrypto/webcrypto_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/webcrypto/test/test_helpers.cc
diff --git a/content/child/webcrypto/test/test_helpers.cc b/content/child/webcrypto/test/test_helpers.cc
index ddabd7574c459a881144d253ad7ffed26e1c41d8..f7dc73ceba4e9fc0bc8797a49d61a6db9503d2bd 100644
--- a/content/child/webcrypto/test/test_helpers.cc
+++ b/content/child/webcrypto/test/test_helpers.cc
@@ -121,8 +121,6 @@ blink::WebCryptoAlgorithm CreateRsaHashedKeyGenAlgorithm(
const blink::WebCryptoAlgorithmId hash_id,
unsigned int modulus_length,
const std::vector<uint8_t>& public_exponent) {
- DCHECK(algorithm_id == blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5 ||
- algorithm_id == blink::WebCryptoAlgorithmIdRsaOaep);
DCHECK(blink::WebCryptoAlgorithm::isHash(hash_id));
return blink::WebCryptoAlgorithm::adoptParamsAndCreate(
algorithm_id,
@@ -206,8 +204,28 @@ std::vector<uint8_t> MakeJsonVector(const base::DictionaryValue& dict) {
return ::testing::AssertionSuccess();
}
-std::vector<uint8_t> GetBytesFromHexString(base::DictionaryValue* dict,
- const char* property_name) {
+::testing::AssertionResult ReadJsonTestFileToDictionary(
+ const char* test_file_name,
+ scoped_ptr<base::DictionaryValue>* dict) {
+ // Read the JSON.
+ scoped_ptr<base::Value> json;
+ ::testing::AssertionResult result = ReadJsonTestFile(test_file_name, &json);
+ if (!result)
+ return result;
+
+ // Cast to an DictionaryValue.
+ base::DictionaryValue* dict_value = NULL;
+ if (!json->GetAsDictionary(&dict_value) || !dict_value)
+ return ::testing::AssertionFailure() << "The JSON was not a dictionary";
+
+ dict->reset(dict_value);
+ ignore_result(json.release());
+
+ return ::testing::AssertionSuccess();
+}
+
+std::vector<uint8_t> GetBytesFromHexString(const base::DictionaryValue* dict,
+ const std::string& property_name) {
std::string hex_string;
if (!dict->GetString(property_name, &hex_string)) {
EXPECT_TRUE(false) << "Couldn't get string property: " << property_name;
@@ -217,7 +235,7 @@ std::vector<uint8_t> GetBytesFromHexString(base::DictionaryValue* dict,
return HexStringToBytes(hex_string);
}
-blink::WebCryptoAlgorithm GetDigestAlgorithm(base::DictionaryValue* dict,
+blink::WebCryptoAlgorithm GetDigestAlgorithm(const base::DictionaryValue* dict,
const char* property_name) {
std::string algorithm_name;
if (!dict->GetString(property_name, &algorithm_name)) {
« no previous file with comments | « content/child/webcrypto/test/test_helpers.h ('k') | content/child/webcrypto/webcrypto_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698