| Index: net/http/http_stream_factory_impl_unittest.cc
|
| diff --git a/net/http/http_stream_factory_impl_unittest.cc b/net/http/http_stream_factory_impl_unittest.cc
|
| index 2ac222bf871e07b90806434a483ab563b5b75e3a..16cb984805bd791323e47fcb26ea0a454d807620 100644
|
| --- a/net/http/http_stream_factory_impl_unittest.cc
|
| +++ b/net/http/http_stream_factory_impl_unittest.cc
|
| @@ -1318,6 +1318,43 @@ TEST_F(HttpStreamFactoryTest, OnlyOnePreconnectToProxyServer) {
|
| }
|
| }
|
|
|
| +TEST_F(HttpStreamFactoryTest, OnMetricsFinalizeTest) {
|
| + base::HistogramTester histogram_tester;
|
| + // Make the request hang.
|
| + MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING)};
|
| + SequencedSocketData data(reads, arraysize(reads), nullptr, 0);
|
| + SpdySessionDependencies session_deps;
|
| + session_deps.socket_factory->AddSocketDataProvider(&data);
|
| + HttpNetworkSession::Params params =
|
| + SpdySessionDependencies::CreateSessionParams(&session_deps);
|
| + std::unique_ptr<HttpNetworkSession> session(new HttpNetworkSession(params));
|
| + HttpRequestInfo request_info;
|
| + request_info.method = "GET";
|
| + request_info.url = GURL("http://www.example.com");
|
| + SSLConfig ssl_config;
|
| + StreamRequestWaiter waiter;
|
| + std::unique_ptr<HttpStreamRequest> request(
|
| + session->http_stream_factory()->RequestStream(
|
| + request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter,
|
| + /* enable_ip_based_pooling = */ true,
|
| + /* enable_alternative_services = */ true, NetLogWithSource()));
|
| + NetworkChangeNotifier::FinalizingMetricsLogRecord();
|
| + // Notification is asynchronous.
|
| + base::RunLoop().RunUntilIdle();
|
| + // There are two HttpStreamFactoryImpl in HttpNetworkSession
|
| + // (|http_stream_factory_| and |http_stream_factory_for_websocket_|), so there
|
| + // will be two samples logged per FinalizingMetricsLogRecord().
|
| + histogram_tester.ExpectBucketCount("Net.JobControllerSet.CountOfPreconnect",
|
| + 0, 2);
|
| + histogram_tester.ExpectBucketCount(
|
| + "Net.JobControllerSet.CountOfNonPreconnectAltJob", 0, 2);
|
| + histogram_tester.ExpectBucketCount(
|
| + "Net.JobControllerSet.CountOfNonPreconnectMainJob", 0, 1);
|
| + // HttpNetworkSession's |http_stream_factory_| reports 1 count to 1 bucket.
|
| + histogram_tester.ExpectBucketCount(
|
| + "Net.JobControllerSet.CountOfNonPreconnectMainJob", 1, 1);
|
| +}
|
| +
|
| // Verify that preconnect to a HTTP2 proxy server with a privacy mode different
|
| // than that of the in-flight preconnect job succeeds.
|
| TEST_F(HttpStreamFactoryTest, ProxyServerPreconnectDifferentPrivacyModes) {
|
|
|