chromium/chrome/browser/k_anonymity_service/k_anonymity_trust_token_getter_unittest.cc

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

#include "chrome/browser/k_anonymity_service/k_anonymity_trust_token_getter.h"

#include <inttypes.h>

#include "base/functional/callback.h"
#include "base/run_loop.h"
#include "base/strings/strcat.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/values_test_util.h"
#include "chrome/browser/k_anonymity_service/k_anonymity_service_metrics.h"
#include "chrome/browser/k_anonymity_service/k_anonymity_service_storage.h"
#include "chrome/browser/k_anonymity_service/k_anonymity_service_urls.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/signin/identity_test_environment_profile_adaptor.h"
#include "chrome/common/chrome_features.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile.h"
#include "chrome/test/base/testing_profile_manager.h"
#include "content/public/test/browser_task_environment.h"
#include "google_apis/gaia/gaia_constants.h"
#include "net/dns/mock_host_resolver.h"
#include "services/data_decoder/public/cpp/test_support/in_process_data_decoder.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h"
#include "services/network/public/mojom/trust_tokens.mojom.h"
#include "services/network/test/test_url_loader_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace {

const char kAuthServer[] =;

class TestTrustTokenQueryAnswerer
    : public network::mojom::TrustTokenQueryAnswerer {};

}  // namespace

class KAnonymityTrustTokenGetterTest : public testing::Test {};

TEST_F(KAnonymityTrustTokenGetterTest, TryGetNotSignedIn) {}

TEST_F(KAnonymityTrustTokenGetterTest, TryGetAuthTokenFailed) {}

TEST_F(KAnonymityTrustTokenGetterTest, TryGetNonUniqueUserIdFetchFailed) {}

TEST_F(KAnonymityTrustTokenGetterTest,
       TryJoinSetMalformedNonUniqueUserIdResponse) {}

TEST_F(KAnonymityTrustTokenGetterTest, TryGetKeyFetchFails) {}

TEST_F(KAnonymityTrustTokenGetterTest,
       TryJoinSetMalformedKeyCommitmentResponse) {}

TEST_F(KAnonymityTrustTokenGetterTest, TryJoinSetValidKeyCommitmentResponse) {}

TEST_F(KAnonymityTrustTokenGetterTest, TryGetNoToken) {}

TEST_F(KAnonymityTrustTokenGetterTest, TryGetSignedIn) {}

TEST_F(KAnonymityTrustTokenGetterTest, TryGetRepeatedly) {}

TEST_F(KAnonymityTrustTokenGetterTest, TryGetFailureDropsAllRequests) {}

TEST_F(KAnonymityTrustTokenGetterTest, TokenKeysDontExpire) {}

TEST_F(KAnonymityTrustTokenGetterTest, AuthTokenAlreadyExpired) {}

TEST_F(KAnonymityTrustTokenGetterTest, AuthTokenExpire) {}

TEST_F(KAnonymityTrustTokenGetterTest, TokenKeysExpire) {}

// Verify that the latency recorded includes both the queued time and the
// time for each step of getting the trust token.
TEST_F(KAnonymityTrustTokenGetterTest, RecordTokenLatency) {}

// Apparently the IdentityManager is sometimes NULL, so we should handle this.
TEST_F(KAnonymityTrustTokenGetterTest, HandlesMissingServices) {}