Commit 56e969f5 authored by Bence Béky's avatar Bence Béky Committed by Commit Bot

Relax favicon load related test expectations.

I introduced some test expectations in https://crrev.com/c/1145129 which
I believe might be unnecessarily strict.  In particular,
Net.ConnectionInfo.MainFrame and Net.ConnectionInfo.SubResource might be
recorded in OnReceivedResponse() for favicon but RecordLoadHistograms()
not called yet by the time test execution arrives to the expectations.
This CL relaxes some expectations to prevent these tests from becoming
flaky.

Bug: 859546
Change-Id: Idbacc7d024176406c5eb1a4be6d190e168a7d432
Reviewed-on: https://chromium-review.googlesource.com/1156848Reviewed-by: default avatarMatt Menke <mmenke@chromium.org>
Commit-Queue: Bence Béky <bnc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579784}
parent eea229f2
...@@ -242,17 +242,17 @@ class NetworkRequestMetricsBrowserTest ...@@ -242,17 +242,17 @@ class NetworkRequestMetricsBrowserTest
"Net.ConnectionInfo.MainFrame", "Net.ConnectionInfo.MainFrame",
net::HttpResponseInfo::CONNECTION_INFO_HTTP1_1, 1); net::HttpResponseInfo::CONNECTION_INFO_HTTP1_1, 1);
if (headers_received == HeadersReceived::kHeadersReceived) { if (headers_received == HeadersReceived::kHeadersReceived) {
histograms_->ExpectUniqueSample( // Favicon request may or may not have received a response.
"Net.ConnectionInfo.SubResource", size_t subresources =
net::HttpResponseInfo::CONNECTION_INFO_HTTP1_1, histograms_->GetAllSamples("Net.ConnectionInfo.SubResource").size();
found_favicon_load ? 2 : 1); EXPECT_LE(1u, subresources);
EXPECT_GE(2u, subresources);
} else { } else {
histograms_->ExpectTotalCount("Net.ConnectionInfo.SubResource", 0); histograms_->ExpectTotalCount("Net.ConnectionInfo.SubResource", 0);
} }
} else { } else {
histograms_->ExpectTotalCount("Net.ConnectionInfo.MainFrame", 0); histograms_->ExpectTotalCount("Net.ConnectionInfo.MainFrame", 0);
histograms_->ExpectTotalCount("Net.ConnectionInfo.SubResource", histograms_->ExpectTotalCount("Net.ConnectionInfo.SubResource", 0);
found_favicon_load ? 1 : 0);
} }
} }
...@@ -544,13 +544,11 @@ IN_PROC_BROWSER_TEST_P(NetworkRequestMetricsBrowserTest, Download) { ...@@ -544,13 +544,11 @@ IN_PROC_BROWSER_TEST_P(NetworkRequestMetricsBrowserTest, Download) {
histograms()->ExpectUniqueSample( histograms()->ExpectUniqueSample(
"Net.ConnectionInfo.MainFrame", "Net.ConnectionInfo.MainFrame",
net::HttpResponseInfo::CONNECTION_INFO_HTTP1_1, 1); net::HttpResponseInfo::CONNECTION_INFO_HTTP1_1, 1);
if (found_favicon_load) { // Favicon request may or may not have received a response.
histograms()->ExpectUniqueSample( size_t subresources =
"Net.ConnectionInfo.SubResource", histograms()->GetAllSamples("Net.ConnectionInfo.SubResource").size();
net::HttpResponseInfo::CONNECTION_INFO_HTTP1_1, 1); EXPECT_LE(0u, subresources);
} else { EXPECT_GE(1u, subresources);
histograms()->ExpectTotalCount("Net.ConnectionInfo.SubResource", 0);
}
} }
// A few tests for file:// URLs, so that URLs not handled by the network service // A few tests for file:// URLs, so that URLs not handled by the network service
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment