#include "remoting/protocol/session_authz_reauthorizer.h"
#include <memory>
#include <string_view>
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "base/test/gmock_callback_support.h"
#include "base/test/mock_callback.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "net/base/backoff_entry.h"
#include "net/http/http_status_code.h"
#include "remoting/base/mock_session_authz_service_client.h"
#include "remoting/base/protobuf_http_status.h"
#include "remoting/proto/session_authz_service.h"
#include "remoting/protocol/errors.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace remoting::protocol {
namespace {
_;
constexpr char kSessionId[] = …;
constexpr char kInitialReauthToken[] = …;
constexpr base::TimeDelta kInitialTokenLifetime = …;
internal::ReauthorizeHostRequestStruct CreateRequest(
std::string_view session_id,
std::string_view session_reauth_token) { … }
auto Respond(std::string_view session_reauth_token,
base::TimeDelta session_reauth_token_lifetime) { … }
template <typename CodeType>
auto RespondError(CodeType code) { … }
}
class SessionAuthzReauthorizerTest : public testing::Test { … };
SessionAuthzReauthorizerTest::SessionAuthzReauthorizerTest() { … }
SessionAuthzReauthorizerTest::~SessionAuthzReauthorizerTest() = default;
auto SessionAuthzReauthorizerTest::ResetReauthorizer() { … }
TEST_F(SessionAuthzReauthorizerTest, MultipleSuccessfulReauths) { … }
TEST_F(SessionAuthzReauthorizerTest,
ReauthFailedWithNonretriableError_ClosesSession) { … }
TEST_F(SessionAuthzReauthorizerTest, RetryReauthAndSucceed) { … }
TEST_F(SessionAuthzReauthorizerTest, RetriesExceedTokenLifetime_ClosesSession) { … }
}