#include "chrome/browser/k_anonymity_service/k_anonymity_service_client.h"
#include "base/containers/flat_map.h"
#include "base/functional/callback.h"
#include "base/run_loop.h"
#include "base/strings/string_util.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "chrome/browser/k_anonymity_service/k_anonymity_service_metrics.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 "components/signin/public/identity_manager/account_capabilities_test_mutator.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "content/public/browser/k_anonymity_service_delegate.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/test/browser_task_environment.h"
#include "crypto/sha2.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.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/test/test_network_context.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 {
class KAnonymityServiceClientTest : public testing::Test { … };
TEST_F(KAnonymityServiceClientTest, TryJoinSetFails) { … }
TEST_F(KAnonymityServiceClientTest, TryJoinSetSuccess) { … }
TEST_F(KAnonymityServiceClientTest, TryJoinSetRepeatedly) { … }
TEST_F(KAnonymityServiceClientTest, TryJoinSetOneAtATime) { … }
TEST_F(KAnonymityServiceClientTest, TryJoinSetFailureDropsAllRequests) { … }
TEST_F(KAnonymityServiceClientTest, TryJoinSetOverflowQueue) { … }
TEST_F(KAnonymityServiceClientTest, TryQuerySetFailed) { … }
TEST_F(KAnonymityServiceClientTest, TryQuerySetAllNotKAnon) { … }
class TestTrustTokenQueryAnswerer
: public network::mojom::TrustTokenQueryAnswerer { … };
const char kJoinRelayURL[] = …;
const char kQueryRelayURL[] = …;
class OhttpTestNetworkContext : public network::TestNetworkContext { … };
class KAnonymityServiceClientJoinQueryTest
: public KAnonymityServiceClientTest { … };
TEST_F(KAnonymityServiceClientJoinQueryTest, TryJoinSetGetOHTTPKeyFailed) { … }
TEST_F(KAnonymityServiceClientJoinQueryTest, TryJoinSetSignedIn) { … }
TEST_F(KAnonymityServiceClientJoinQueryTest, TryJoinSetNetworkDrop) { … }
TEST_F(KAnonymityServiceClientJoinQueryTest, TryJoinSetTokenAlreadyUsedOnce) { … }
TEST_F(KAnonymityServiceClientJoinQueryTest,
TryJoinSetOtherNetErrorsNotRetried) { … }
TEST_F(KAnonymityServiceClientJoinQueryTest,
TryJoinSetOtherOuterHttpStatusErrorNotRetried) { … }
TEST_F(KAnonymityServiceClientJoinQueryTest,
TryJoinSetOtherInnerHttpStatusErrorNotRetried) { … }
TEST_F(KAnonymityServiceClientJoinQueryTest,
TryJoinSetTokenAlreadyRetriedTooMany) { … }
TEST_F(KAnonymityServiceClientJoinQueryTest, TryQuerySetGetOHTTPKeyFailed) { … }
TEST_F(KAnonymityServiceClientJoinQueryTest, TryQuerySetBadResponse) { … }
TEST_F(KAnonymityServiceClientJoinQueryTest, TryQuerySet) { … }
TEST_F(KAnonymityServiceClientJoinQueryTest, TryQuerySetMultipleSets) { … }
TEST_F(KAnonymityServiceClientJoinQueryTest, TryQuerySetCoalescesSplitSets) { … }
TEST_F(KAnonymityServiceClientJoinQueryTest,
TryQuerySetSingleFailureDropsAllRequests) { … }
TEST_F(KAnonymityServiceClientJoinQueryTest,
DISABLED_StorageDoesNotPersistWhenOffTheRecord) { … }
}