TestBothStateAssistedTransactions<Test>(preTransactionCallback, postTransactionCallback);
}
-template <class WauthnCallbacks>
-struct InvalidParamsTest {
+template <class WauthnCallbacks, wauthn_error_e EXPECTED_ERROR>
+struct ErrorTest {
std::string called;
WauthnCallbacks callbacks = {
[](const char *, void *) {
- FAIL() << "qrcode_callback should not be called when parameters are invalid;";
+ FAIL() << "qrcode_callback should not be called when error happens;";
},
[](const auto *pubkeyCred, wauthn_error_e result, void *data) {
- auto &test = *static_cast<InvalidParamsTest *>(data);
+ auto &test = *static_cast<ErrorTest *>(data);
test.called += "response_callback;";
- EXPECT_EQ(result, WAUTHN_ERROR_INVALID_PARAMETER);
+ EXPECT_EQ(result, EXPECTED_ERROR);
EXPECT_EQ(pubkeyCred, nullptr);
},
[](const auto *, wauthn_error_e, void *) {
- FAIL() << "linked_data_callback should not be called when parameters are invalid;";
+ FAIL() << "linked_data_callback should not be called when error happens;";
},
this,
};
WauthnCallbacks *callbacksPtr = &callbacks;
};
+template <class WauthnCallbacks>
+using InvalidParamsTest = ErrorTest<WauthnCallbacks, WAUTHN_ERROR_INVALID_PARAMETER>;
+
} // namespace
TEST(RequestHandler, transaction_is_not_performed_with_nullptr_callbacks)
namespace {
+template <class WauthnCallbacks>
+using UnsupportedParamTest = ErrorTest<WauthnCallbacks, WAUTHN_ERROR_NOT_SUPPORTED>;
+
+} // namespace
+
+TEST(RequestHandler, transaction_is_not_performed_if_options_hints_is_non_null)
+{
+ auto hints = wauthn_pubkey_cred_hints_s{0, nullptr};
+ TestAll4Transactions<UnsupportedParamTest>(
+ [&](auto &test, auto &options) {
+ test.options.hints = &hints;
+ options.mcResultProcessor = [&](auto &) { test.called += "result_processor;"; };
+ options.gaResultProcessor = [&](auto &) { test.called += "result_processor;"; };
+ options.followingCtapUpdatesProcessor = [&](auto &&) {
+ test.called += "update_processor;";
+ };
+ },
+ [](auto &test) { EXPECT_EQ(test.called, "response_callback;"); });
+}
+
+namespace {
+
template <class WauthnCallbacks>
struct QrCallbackTest {
int counter = 0;