src/net/nqe/network_quality_estimator_util_unittest.cc
// Verify that IsPrivateHostForTesting() returns correct results for local
// hosts.
Verify that IsPrivateHostForTesting() returns correct results for local
hosts.
Verify that IsPrivateHostForTesting () returns correct results for local hosts .
TEST(NetworkQualityEstimatorUtilTest, Localhost) {
  base::test::TaskEnvironment task_environment;
  std::unique_ptr<RecordingBoundTestNetLog> net_log =
      std::make_unique<RecordingBoundTestNetLog>();
  RecordingBoundTestNetLog* net_log_ptr = net_log.get();
  std::unique_ptr<ContextHostResolver> resolver =
      HostResolver::CreateStandaloneContextResolver(
          net_log_ptr->bound().net_log());
  scoped_refptr<net::RuleBasedHostResolverProc> rules(
      new net::RuleBasedHostResolverProc(nullptr));
  EXPECT_TRUE(IsPrivateHostForTesting(
      resolver.get(), HostPortPair("localhost", 443), NetworkIsolationKey()));
  EXPECT_TRUE(IsPrivateHostForTesting(
      resolver.get(), HostPortPair("localhost6", 443), NetworkIsolationKey()));
  EXPECT_TRUE(IsPrivateHostForTesting(
      resolver.get(), HostPortPair("127.0.0.1", 80), NetworkIsolationKey()));
  EXPECT_TRUE(IsPrivateHostForTesting(
      resolver.get(), HostPortPair("0.0.0.0", 80), NetworkIsolationKey()));
  EXPECT_TRUE(IsPrivateHostForTesting(resolver.get(), HostPortPair("::1", 80),
                                      NetworkIsolationKey()));
  EXPECT_FALSE(IsPrivateHostForTesting(
      resolver.get(), HostPortPair("google.com", 80), NetworkIsolationKey()));
}
TEST ( NetworkQualityEstimatorUtilTest , Localhost ) { base :: test :: TaskEnvironment task_environment ; std :: unique_ptr < RecordingBoundTestNetLog > net_log = std :: make_unique < RecordingBoundTestNetLog > ( ) ; RecordingBoundTestNetLog * net_log_ptr = net_log . get ( ) ; std :: unique_ptr < ContextHostResolver > resolver = HostResolver :: CreateStandaloneContextResolver ( net_log_ptr -> bound ( ) . net_log ( ) ) ; scoped_refptr < net :: RuleBasedHostResolverProc > rules ( new net :: RuleBasedHostResolverProc ( nullptr ) ) ; EXPECT_TRUE ( IsPrivateHostForTesting ( resolver . get ( ) , HostPortPair ( " " , 443 ) , NetworkIsolationKey ( ) ) ) ; EXPECT_TRUE ( IsPrivateHostForTesting ( resolver . get ( ) , HostPortPair ( " " , 443 ) , NetworkIsolationKey ( ) ) ) ; EXPECT_TRUE ( IsPrivateHostForTesting ( resolver . get ( ) , HostPortPair ( " " , 80 ) , NetworkIsolationKey ( ) ) ) ; EXPECT_TRUE ( IsPrivateHostForTesting ( resolver . get ( ) , HostPortPair ( " " , 80 ) , NetworkIsolationKey ( ) ) ) ; EXPECT_TRUE ( IsPrivateHostForTesting ( resolver . get ( ) , HostPortPair ( " " , 80 ) , NetworkIsolationKey ( ) ) ) ; EXPECT_FALSE ( IsPrivateHostForTesting ( resolver . get ( ) , HostPortPair ( " " , 80 ) , NetworkIsolationKey ( ) ) ) ; }
Verify that IsPrivateHostForTesting() returns correct results for local
hosts.
Verify that IsPrivateHostForTesting () returns correct results for local hosts .
// Use actual HostResolver since MockCachingHostResolver does not determine // the correct answer for localhosts.