Commit 0894f803 authored by Owen Min's avatar Owen Min Committed by Chromium LUCI CQ

Fixup flaky test ReportRequestQueueGeneratorTest.ReportSeparation

The profile list returned by the GetAllProfilesAttributes() is not
sorted in any particular order and might be different in different test
runs.

Update the test case to make sure this can be handled.

Bug: 1153593
Change-Id: Idf6b9c5f720a8285112dc17c1da7b31ddbd7978d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2612526Reviewed-by: default avatarJulian Pastarmov <pastarmovj@chromium.org>
Commit-Queue: Owen Min <zmin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841064}
parent cd46dafb
...@@ -255,9 +255,8 @@ TEST_P(ReportRequestQueueGeneratorTest, BasicReportIsTooBig) { ...@@ -255,9 +255,8 @@ TEST_P(ReportRequestQueueGeneratorTest, BasicReportIsTooBig) {
0); 0);
} }
// TODO(1153593): Test is very flaky on all bots. Disabling until zmin@ is back. TEST_P(ReportRequestQueueGeneratorTest, ReportSeparation) {
TEST_P(ReportRequestQueueGeneratorTest, DISABLED_ReportSeparation) { auto active_profiles = CreateActiveProfilesWithContent();
CreateActiveProfilesWithContent();
auto basic_request = GenerateBasicRequest(); auto basic_request = GenerateBasicRequest();
auto requests = GenerateRequests(*basic_request); auto requests = GenerateRequests(*basic_request);
EXPECT_EQ(1u, requests.size()); EXPECT_EQ(1u, requests.size());
...@@ -268,12 +267,27 @@ TEST_P(ReportRequestQueueGeneratorTest, DISABLED_ReportSeparation) { ...@@ -268,12 +267,27 @@ TEST_P(ReportRequestQueueGeneratorTest, DISABLED_ReportSeparation) {
requests = GenerateRequests(*basic_request); requests = GenerateRequests(*basic_request);
EXPECT_EQ(2u, requests.size()); EXPECT_EQ(2u, requests.size());
// The profile order in requests should match the return value of
// GetAllProfilesAttributes().
std::vector<std::string> expected_active_profiles_in_requests;
for (const auto* entry : profile_manager()
->profile_attributes_storage()
->GetAllProfilesAttributes()) {
std::string profile_name = base::UTF16ToUTF8(entry->GetName());
if (active_profiles.find(profile_name) != active_profiles.end())
expected_active_profiles_in_requests.push_back(profile_name);
}
// The first profile is activated in the first request only while the second // The first profile is activated in the first request only while the second
// profile is activated in the second request. // profile is activated in the second request.
VerifyProfiles(requests[0]->browser_report(), {kActiveProfileName1}, VerifyProfiles(
{kActiveProfileName2}); requests[0]->browser_report(),
VerifyProfiles(requests[1]->browser_report(), {kActiveProfileName2}, {/* idle_profile_names */ expected_active_profiles_in_requests[1]},
{kActiveProfileName1}); {/* active_profile_names */ expected_active_profiles_in_requests[0]});
VerifyProfiles(
requests[1]->browser_report(),
{/* idle_profile_names */ expected_active_profiles_in_requests[0]},
{/* active_profile_names */ expected_active_profiles_in_requests[1]});
histogram_tester()->ExpectBucketCount("Enterprise.CloudReportingRequestSize", histogram_tester()->ExpectBucketCount("Enterprise.CloudReportingRequestSize",
/*report size floor to KB*/ 0, 2); /*report size floor to KB*/ 0, 2);
} }
......
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