Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1280)

Unified Diff: chrome/browser/chromeos/arc/arc_session_manager_browsertest.cc

Issue 2639483003: Avoid leaving dangling pointers to User in ProfileHelper. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/arc/arc_session_manager_browsertest.cc
diff --git a/chrome/browser/chromeos/arc/arc_session_manager_browsertest.cc b/chrome/browser/chromeos/arc/arc_session_manager_browsertest.cc
index 24c24d5d1214b9d14c39a2a36a6df1f4ee22b60c..af30e8c491ed80f43363474d918ef2aa0e759907 100644
--- a/chrome/browser/chromeos/arc/arc_session_manager_browsertest.cc
+++ b/chrome/browser/chromeos/arc/arc_session_manager_browsertest.cc
@@ -61,6 +61,7 @@ constexpr char kManagedAuthToken[] = "managed-auth-token";
constexpr char kUnmanagedAuthToken[] = "unmanaged-auth-token";
constexpr char kWellKnownConsumerName[] = "test@gmail.com";
constexpr char kFakeUserName[] = "test@example.com";
+constexpr char kFakeGaiaId[] = "1234567890";
} // namespace
@@ -183,7 +184,7 @@ class ArcSessionManagerTest : public InProcessBrowserTest {
profile()->GetPrefs()->SetBoolean(prefs::kArcTermsAccepted, true);
const AccountId account_id(
- AccountId::FromUserEmailGaiaId(kFakeUserName, "1234567890"));
+ AccountId::FromUserEmailGaiaId(kFakeUserName, kFakeGaiaId));
GetFakeUserManager()->AddUser(account_id);
GetFakeUserManager()->LoginUser(account_id);
@@ -192,6 +193,13 @@ class ArcSessionManagerTest : public InProcessBrowserTest {
}
void TearDownOnMainThread() override {
+ // Explicitly removing the user is required; otherwise ProfileHelper keeps
+ // a dangling pointer to the User.
+ // TODO(nya): Consider removing all users from ProfileHelper in the
+ // destructor of FakeChromeUserManager.
+ const AccountId account_id(
+ AccountId::FromUserEmailGaiaId(kFakeUserName, kFakeGaiaId));
+ GetFakeUserManager()->RemoveUserFromList(account_id);
ArcSessionManager::Get()->Shutdown();
ArcServiceManager::Get()->Shutdown();
profile_.reset();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698