Commit 2efbb087 authored by Yusuke Sato's avatar Yusuke Sato Committed by Commit Bot

arc: Make ARC related browser tests less flaky

Some ARC browser tests such as ArcAuthServiceTest.ChildTransition
instantiates a profile and an ArcSessionManager object associated
with the profile twice on purpose. On the other hand, ArcAppListPrefs
object can be _asynchronously_ created while the first profile is
in use. As a result, if the following happens, the DCHECK_EQ in the
class fails, making such browser tests flaky:

 1. The first profile is created.
 2. The first ArcSessionManager is created. The first profile is
    associated with the manager.
 3. A unrelated class e.g. ArcDefaultAppList does some PostTask
    operations.
 4. The second profile is created.
 5. The second ArcSessionManager is created. The second profile is
    associated with the (second) manager.
 6. The PostTask operation finishes, and an ArcAppListPrefs object
    is created with the first profile.
 7. The DCHECK_EQ fails.

This CL changes the DCHECK_EQ to LOG(ERROR) to remove the race.

BUG=b:144199481
TEST=try

Change-Id: I0153a2ceba87c5a292b7b34f257e18868dc1f9bd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2030002
Commit-Queue: Yusuke Sato <yusukes@chromium.org>
Reviewed-by: default avatarYury Khmel <khmel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#736911}
parent b7480672
...@@ -432,8 +432,13 @@ void ArcAppListPrefs::StartPrefs() { ...@@ -432,8 +432,13 @@ void ArcAppListPrefs::StartPrefs() {
// Note: If ArcSessionManager has profile, it should be as same as the one // Note: If ArcSessionManager has profile, it should be as same as the one
// this instance has, because ArcAppListPrefsFactory creates an instance // this instance has, because ArcAppListPrefsFactory creates an instance
// only if the given Profile meets ARC's requirement. // only if the given Profile meets ARC's requirement.
// Anyway, just in case, check it here. // Anyway, just in case, check it here and log. Only some browser tests
DCHECK_EQ(profile_, arc_session_manager->profile()); // will log the error. If you see the log outside browser_tests, something
// unexpected may have happened.
if (profile_ != arc_session_manager->profile()) {
LOG(ERROR)
<< "This object's profile_ and ArcSessionManager's don't match.";
}
OnArcPlayStoreEnabledChanged( OnArcPlayStoreEnabledChanged(
arc::IsArcPlayStoreEnabledForProfile(profile_)); arc::IsArcPlayStoreEnabledForProfile(profile_));
} }
......
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