#include "net/http/http_server_properties_manager.h"
#include <utility>
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/json/json_writer.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/bind.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/values_test_util.h"
#include "base/time/default_tick_clock.h"
#include "base/time/time.h"
#include "base/values.h"
#include "net/base/features.h"
#include "net/base/ip_address.h"
#include "net/base/schemeful_site.h"
#include "net/http/http_network_session.h"
#include "net/http/http_server_properties.h"
#include "net/quic/quic_context.h"
#include "net/test/test_with_task_environment.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
namespace net {
namespace {
StringPrintf;
_;
AtLeast;
Invoke;
Mock;
StrictMock;
enum class NetworkAnonymizationKeyMode { … };
const NetworkAnonymizationKeyMode kNetworkAnonymizationKeyModes[] = …;
std::unique_ptr<base::test::ScopedFeatureList> SetNetworkAnonymizationKeyMode(
NetworkAnonymizationKeyMode mode) { … }
class MockPrefDelegate : public HttpServerProperties::PrefDelegate { … };
base::Value::Dict ServerInfoMapToDict(
const HttpServerProperties::ServerInfoMap& server_info_map) { … }
std::unique_ptr<HttpServerProperties::ServerInfoMap> DictToServerInfoMap(
base::Value::Dict dict) { … }
}
class HttpServerPropertiesManagerTest : public testing::Test,
public WithTaskEnvironment { … };
TEST_F(HttpServerPropertiesManagerTest, BadCachedHostPortPair) { … }
TEST_F(HttpServerPropertiesManagerTest, BadCachedAltProtocolPort) { … }
TEST_F(HttpServerPropertiesManagerTest, SupportsSpdy) { … }
TEST_F(HttpServerPropertiesManagerTest,
SinglePrefUpdateForTwoSpdyServerCacheChanges) { … }
TEST_F(HttpServerPropertiesManagerTest, GetAlternativeServiceInfos) { … }
TEST_F(HttpServerPropertiesManagerTest, SetAlternativeServices) { … }
TEST_F(HttpServerPropertiesManagerTest, SetAlternativeServicesEmpty) { … }
TEST_F(HttpServerPropertiesManagerTest, ConfirmAlternativeService) { … }
TEST_F(HttpServerPropertiesManagerTest, LateLoadAlternativeServiceInfo) { … }
TEST_F(HttpServerPropertiesManagerTest,
ClearPrefsBeforeLoadAlternativeServiceInfo) { … }
TEST_F(HttpServerPropertiesManagerTest,
ConfirmBrokenUntilDefaultNetworkChanges) { … }
TEST_F(HttpServerPropertiesManagerTest,
OnDefaultNetworkChangedWithBrokenUntilDefaultNetworkChanges) { … }
TEST_F(HttpServerPropertiesManagerTest, OnDefaultNetworkChangedWithBrokenOnly) { … }
TEST_F(HttpServerPropertiesManagerTest, LastLocalAddressWhenQuicWorked) { … }
TEST_F(HttpServerPropertiesManagerTest, ServerNetworkStats) { … }
TEST_F(HttpServerPropertiesManagerTest, QuicServerInfo) { … }
TEST_F(HttpServerPropertiesManagerTest, Clear) { … }
TEST_F(HttpServerPropertiesManagerTest, BadLastLocalAddressWhenQuicWorked) { … }
TEST_F(HttpServerPropertiesManagerTest, UpdatePrefsWithCache) { … }
TEST_F(HttpServerPropertiesManagerTest, ParseAlternativeServiceInfo) { … }
TEST_F(HttpServerPropertiesManagerTest, DoNotLoadAltSvcForInsecureOrigins) { … }
TEST_F(HttpServerPropertiesManagerTest, DoNotPersistExpiredAlternativeService) { … }
TEST_F(HttpServerPropertiesManagerTest, DoNotLoadExpiredAlternativeService) { … }
TEST_F(HttpServerPropertiesManagerTest, UpdatePrefsOnShutdown) { … }
TEST_F(HttpServerPropertiesManagerTest, PersistAdvertisedVersionsToPref) { … }
TEST_F(HttpServerPropertiesManagerTest, ReadAdvertisedVersionsFromPref) { … }
TEST_F(HttpServerPropertiesManagerTest,
UpdatePrefWhenAdvertisedVersionsChange) { … }
TEST_F(HttpServerPropertiesManagerTest, UpdateCacheWithPrefs) { … }
TEST_F(HttpServerPropertiesManagerTest, ForceHTTP11) { … }
TEST_F(HttpServerPropertiesManagerTest, NetworkAnonymizationKeyServerInfo) { … }
TEST_F(HttpServerPropertiesManagerTest, NetworkAnonymizationKeyIntegration) { … }
TEST_F(HttpServerPropertiesManagerTest,
CanonicalSuffixRoundTripWithNetworkAnonymizationKey) { … }
TEST_F(HttpServerPropertiesManagerTest,
NetworkAnonymizationKeyBrokenAltServiceRoundTrip) { … }
TEST_F(HttpServerPropertiesManagerTest,
NetworkAnonymizationKeyBrokenAltServiceOpaqueOrigin) { … }
TEST_F(HttpServerPropertiesManagerTest,
NetworkAnonymizationKeyQuicServerInfoRoundTrip) { … }
TEST_F(HttpServerPropertiesManagerTest,
NetworkAnonymizationKeyQuicServerInfoCanonicalSuffixRoundTrip) { … }
TEST_F(HttpServerPropertiesManagerTest,
NetworkAnonymizationKeyQuicServerInfoOpaqueOrigin) { … }
TEST_F(HttpServerPropertiesManagerTest, AdvertisedVersionsRoundTrip) { … }
TEST_F(HttpServerPropertiesManagerTest, SameOrderAfterReload) { … }
}