#include "chrome/browser/ip_protection/ip_protection_config_provider.h"
#include <memory>
#include <optional>
#include "base/memory/scoped_refptr.h"
#include "base/notreached.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/test_future.h"
#include "base/time/time.h"
#include "base/types/expected.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/ip_protection/common/ip_protection_config_http.h"
#include "components/ip_protection/common/ip_protection_config_provider_helper.h"
#include "components/ip_protection/common/ip_protection_data_types.h"
#include "components/ip_protection/common/ip_protection_proxy_config_fetcher.h"
#include "components/ip_protection/common/mock_blind_sign_auth.h"
#include "components/prefs/testing_pref_service.h"
#include "components/privacy_sandbox/privacy_sandbox_features.h"
#include "components/privacy_sandbox/privacy_sandbox_prefs.h"
#include "components/privacy_sandbox/tracking_protection_settings.h"
#include "components/signin/public/identity_manager/account_capabilities_test_mutator.h"
#include "components/signin/public/identity_manager/identity_test_environment.h"
#include "components/signin/public/identity_manager/primary_account_change_event.h"
#include "components/sync_preferences/testing_pref_service_syncable.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/test/browser_task_environment.h"
#include "net/third_party/quiche/src/quiche/blind_sign_auth/blind_sign_auth_interface.h"
#include "net/third_party/quiche/src/quiche/blind_sign_auth/proto/spend_token_data.pb.h"
#include "services/network/test/test_shared_url_loader_factory.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/abseil-cpp/absl/status/status.h"
BlindSignedAuthToken;
GeoHint;
namespace {
constexpr char kTryGetAuthTokensResultHistogram[] = …;
constexpr char kOAuthTokenFetchHistogram[] = …;
constexpr char kTokenBatchHistogram[] = …;
constexpr char kTestEmail[] = …;
class MockIpProtectionProxyConfigRetriever
: public ip_protection::IpProtectionProxyConfigRetriever { … };
enum class PrimaryAccountBehavior { … };
}
class IpProtectionConfigProviderTest : public testing::Test { … };
TEST_F(IpProtectionConfigProviderTest, Success) { … }
TEST_F(IpProtectionConfigProviderTest, NoTokens) { … }
TEST_F(IpProtectionConfigProviderTest, MalformedTokens) { … }
TEST_F(IpProtectionConfigProviderTest, TokenGeoHintContainsOnlyCountry) { … }
TEST_F(IpProtectionConfigProviderTest, TokenHasMissingGeoHint) { … }
TEST_F(IpProtectionConfigProviderTest, BlindSignedTokenError400) { … }
TEST_F(IpProtectionConfigProviderTest, BlindSignedTokenError401) { … }
TEST_F(IpProtectionConfigProviderTest, BlindSignedTokenError403) { … }
TEST_F(IpProtectionConfigProviderTest, BlindSignedTokenErrorOther) { … }
TEST_F(IpProtectionConfigProviderTest, AccountCapabilityUnknown) { … }
TEST_F(IpProtectionConfigProviderTest, AuthTokenTransientError) { … }
TEST_F(IpProtectionConfigProviderTest, AuthTokenPersistentError) { … }
TEST_F(IpProtectionConfigProviderTest, NoPrimary) { … }
TEST_F(IpProtectionConfigProviderTest, TryGetAuthTokens_IpProtectionDisabled) { … }
#if !BUILDFLAG(IS_CHROMEOS_ASH)
TEST_F(IpProtectionConfigProviderTest, AccountLoginTriggersBackoffReset) { … }
#endif
TEST_F(IpProtectionConfigProviderTest, SessionRefreshTriggersBackoffReset) { … }
TEST_F(IpProtectionConfigProviderTest, CalculateBackoff) { … }
TEST_F(IpProtectionConfigProviderTest, ProxyOverrideFlagsAll) { … }
TEST_F(IpProtectionConfigProviderTest, GetProxyListFailure) { … }
TEST_F(IpProtectionConfigProviderTest, GetProxyList_IpProtectionDisabled) { … }
TEST_F(IpProtectionConfigProviderTest, TokenFormat) { … }