#ifndef NET_DEVICE_BOUND_SESSIONS_TEST_SUPPORT_H_
#define NET_DEVICE_BOUND_SESSIONS_TEST_SUPPORT_H_
#include <string>
#include <string_view>
#include <utility>
#include "base/containers/span.h"
#include "net/device_bound_sessions/registration_fetcher.h"
#include "net/net_buildflags.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "url/gurl.h"
namespace net::device_bound_sessions {
std::pair<base::span<const uint8_t>, std::string>
GetRS256SpkiAndJwkForTesting();
extern const char kTestOriginTrialPublicKey[];
EmbeddedTestServer::HandleRequestCallback GetTestRequestHandler(
const GURL& base_url);
bool VerifyEs256Jwt(std::string_view jwt);
#if BUILDFLAG(ENABLE_DEVICE_BOUND_SESSIONS)
class ScopedTestRegistrationFetcher {
public:
static ScopedTestRegistrationFetcher CreateWithSuccess(
std::string_view session_id,
std::string_view refresh_url_string,
std::string_view origin_string);
static ScopedTestRegistrationFetcher CreateWithFailure(
SessionError::ErrorType error_type,
std::string_view refresh_url_string);
static ScopedTestRegistrationFetcher CreateWithTermination(
std::string_view session_id,
std::string_view refresh_url_string);
explicit ScopedTestRegistrationFetcher(
RegistrationFetcher::FetcherType fetcher);
~ScopedTestRegistrationFetcher();
private:
RegistrationFetcher::FetcherType fetcher_;
};
#endif
}
#endif