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

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

Issue 675453003: Add tests for RSA private key import using JWK when p and q are swapped. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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/test/data/webcrypto/bad_rsa_keys.json » ('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 00af7628c2cc2e5f7235f25035dec8d44e4dceb6..86bd2ca9fa1638487272c8fecb95ce8ce13371d9 100644
--- a/content/child/webcrypto/test/test_helpers.cc
+++ b/content/child/webcrypto/test/test_helpers.cc
@@ -39,11 +39,7 @@ namespace content {
namespace webcrypto {
void PrintTo(const Status& status, ::std::ostream* os) {
- if (status.IsSuccess())
- *os << "Success";
- else
- *os << "Error type: " << status.error_type()
- << " Error details: " << status.error_details();
+ *os << StatusToString(status);
}
bool operator==(const Status& a, const Status& b) {
@@ -72,6 +68,39 @@ bool operator!=(const CryptoData& a, const CryptoData& b) {
return !(a == b);
}
+static std::string ErrorTypeToString(blink::WebCryptoErrorType type) {
+ switch (type) {
+ case blink::WebCryptoErrorTypeNotSupported:
+ return "NotSupported";
+ case blink::WebCryptoErrorTypeType:
+ return "TypeError";
+ case blink::WebCryptoErrorTypeData:
+ return "DataError";
+ case blink::WebCryptoErrorTypeSyntax:
+ return "SyntaxError";
+ case blink::WebCryptoErrorTypeOperation:
+ return "OperationError";
+ case blink::WebCryptoErrorTypeUnknown:
+ return "UnknownError";
+ case blink::WebCryptoErrorTypeInvalidState:
+ return "InvalidState";
+ case blink::WebCryptoErrorTypeInvalidAccess:
+ return "InvalidAccess";
+ }
+
+ return "?";
+}
+
+std::string StatusToString(const Status& status) {
+ if (status.IsSuccess())
+ return "Success";
+
+ std::string result = ErrorTypeToString(status.error_type());
+ if (!status.error_details().empty())
+ result += ": " + status.error_details();
+ return result;
+}
+
bool SupportsAesGcm() {
std::vector<uint8_t> key_raw(16, 0);
« no previous file with comments | « content/child/webcrypto/test/test_helpers.h ('k') | content/test/data/webcrypto/bad_rsa_keys.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698