chromium/components/device_reauth/device_authenticator_common_unittest.cc

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/device_reauth/device_authenticator_common.h"

#include <memory>
#include <string>

#include "base/functional/callback.h"
#include "base/notreached.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "components/device_reauth/device_authenticator.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace {

// Implementation of DeviceAuthenticatorCommon for testing.
class FakeDeviceAuthenticatorCommon : public DeviceAuthenticatorCommon {};

FakeDeviceAuthenticatorCommon::FakeDeviceAuthenticatorCommon(
    DeviceAuthenticatorProxy* proxy,
    base::TimeDelta auth_validity_period)
    :{}

FakeDeviceAuthenticatorCommon::~FakeDeviceAuthenticatorCommon() = default;

bool FakeDeviceAuthenticatorCommon::CanAuthenticateWithBiometrics() {}

bool FakeDeviceAuthenticatorCommon::CanAuthenticateWithBiometricOrScreenLock() {}

void FakeDeviceAuthenticatorCommon::Cancel() {}

void FakeDeviceAuthenticatorCommon::AuthenticateWithMessage(
    const std::u16string& message,
    AuthenticateCallback callback) {}

constexpr base::TimeDelta kAuthValidityPeriod =;

}  // namespace

class DeviceAuthenticatorCommonTest : public testing::Test {};

// Checks if user can perform an operation without reauthenticating during
// `kAuthValidityPeriod` since previous authentication. And if needs to
// authenticate after that time.
// Also checks that other profiles need to authenticate.
TEST_F(DeviceAuthenticatorCommonTest, NeedAuthentication) {}

// Checks that user cannot perform an operation without reauthenticating when
// `kAuthValidityPeriod` is 0.
TEST_F(DeviceAuthenticatorCommonTest, NeedAuthenticationImmediately) {}