#include "services/network/ip_protection/ip_protection_proxy_list_manager_impl.h"
#include <deque>
#include <map>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "base/notreached.h"
#include "base/strings/stringprintf.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "components/ip_protection/common/ip_protection_data_types.h"
#include "components/ip_protection/common/ip_protection_telemetry.h"
#include "net/base/features.h"
#include "net/base/proxy_chain.h"
#include "services/network/ip_protection/ip_protection_geo_utils.h"
#include "services/network/ip_protection/ip_protection_proxy_list_manager.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace network {
namespace {
constexpr char kGetProxyListResultHistogram[] = …;
constexpr char kProxyListRefreshTimeHistogram[] = …;
constexpr char kDefaultGeoId[] = …;
constexpr char kMountainViewGeoId[] = …;
constexpr char kSunnyvaleGeoId[] = …;
constexpr bool kEnableTokenCacheByGeo = …;
constexpr bool kDisableTokenCacheByGeo = …;
struct GetProxyListCall { … };
class MockIpProtectionConfigGetter : public IpProtectionConfigGetter { … };
class MockIpProtectionConfigCache : public IpProtectionConfigCache { … };
class IpProtectionProxyListManagerImplTest : public testing::Test { … };
TEST_F(IpProtectionProxyListManagerImplTest,
ProxyListOnStartupGeoCachingDisabled) { … }
TEST_F(IpProtectionProxyListManagerImplTest,
ProxyListOnStartupGeoCachingEnabled) { … }
TEST_F(IpProtectionProxyListManagerImplTest,
ProxyListRefreshScheduledIfRefreshFails) { … }
TEST_F(IpProtectionProxyListManagerImplTest,
ProxyListRefreshGeoCachingDisabled) { … }
TEST_F(IpProtectionProxyListManagerImplTest,
ProxyListRefreshGeoCachingEnabled) { … }
TEST_F(IpProtectionProxyListManagerImplTest,
IsProxyListAvailableEvenIfEmptyGeoCachingDisabled) { … }
TEST_F(IpProtectionProxyListManagerImplTest,
IsProxyListAvailableEvenIfEmptyGeoCachingEnabled) { … }
TEST_F(IpProtectionProxyListManagerImplTest,
ProxyListKeptAfterFailureGeoCachingDisabled) { … }
TEST_F(IpProtectionProxyListManagerImplTest,
ProxyListKeptAfterFailureGeoCachingEnabled) { … }
TEST_F(IpProtectionProxyListManagerImplTest, GetProxyListFailureRecorded) { … }
TEST_F(IpProtectionProxyListManagerImplTest, GotEmptyProxyListRecorded) { … }
TEST_F(IpProtectionProxyListManagerImplTest, GotPopulatedProxyListRecorded) { … }
TEST_F(IpProtectionProxyListManagerImplTest,
CurrentGeoCachingByGeoDisabledReturnsDefault) { … }
TEST_F(IpProtectionProxyListManagerImplTest,
CurrentGeoCachingByGeoEnabledReturnsGeoOfProxyList) { … }
TEST_F(IpProtectionProxyListManagerImplTest,
RefreshProxyListForGeoChangeCachingByGeoDisabledNoRefresh) { … }
TEST_F(IpProtectionProxyListManagerImplTest,
RefreshProxyListForGeoChangeCachingByGeoEnabledGeoChanged) { … }
TEST_F(IpProtectionProxyListManagerImplTest,
RefreshProxyListForGeoChangeCachingByGeoEnabledOnlyObservesGeo) { … }
TEST_F(IpProtectionProxyListManagerImplTest,
CachingByGeoNoGeoObservedWhenNewGeoMatchesCurrent) { … }
}
}