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

Side by Side Diff: components/signin/core/browser/account_tracker_service_unittest.cc

Issue 1588913002: Fix AccountInfo uninitialized memory issues. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Explicit default value to false Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <algorithm> 5 #include <algorithm>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/prefs/pref_registry_simple.h" 8 #include "base/prefs/pref_registry_simple.h"
9 #include "base/prefs/scoped_user_pref_update.h" 9 #include "base/prefs/scoped_user_pref_update.h"
10 #include "base/prefs/testing_pref_service.h" 10 #include "base/prefs/testing_pref_service.h"
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 account_tracker()->PickAccountIdForAccount(gaia_id, email); 658 account_tracker()->PickAccountIdForAccount(gaia_id, email);
659 account_tracker()->SeedAccountInfo(gaia_id, email); 659 account_tracker()->SeedAccountInfo(gaia_id, email);
660 660
661 infos = account_tracker()->GetAccounts(); 661 infos = account_tracker()->GetAccounts();
662 EXPECT_EQ(1u, infos.size()); 662 EXPECT_EQ(1u, infos.size());
663 EXPECT_EQ(account_id, infos[0].account_id); 663 EXPECT_EQ(account_id, infos[0].account_id);
664 EXPECT_EQ(gaia_id, infos[0].gaia); 664 EXPECT_EQ(gaia_id, infos[0].gaia);
665 EXPECT_EQ(email, infos[0].email); 665 EXPECT_EQ(email, infos[0].email);
666 } 666 }
667 667
668 // Fails under MSan. crbug.com/577333 668 TEST_F(AccountTrackerServiceTest, SeedAccountInfoFull) {
669 #if defined(MEMORY_SANITIZER)
670 #define MAYBE_SeedAccountInfoFull DISABLED_SeedAccountInfoFull
671 #else
672 #define MAYBE_SeedAccountInfoFull SeedAccountInfoFull
673 #endif
674 TEST_F(AccountTrackerServiceTest, MAYBE_SeedAccountInfoFull) {
675 AccountTrackerObserver observer; 669 AccountTrackerObserver observer;
676 account_tracker()->AddObserver(&observer); 670 account_tracker()->AddObserver(&observer);
677 671
678 AccountInfo info; 672 AccountInfo info;
679 info.gaia = AccountIdToGaiaId("alpha"); 673 info.gaia = AccountIdToGaiaId("alpha");
680 info.email = AccountIdToEmail("alpha"); 674 info.email = AccountIdToEmail("alpha");
681 info.full_name = AccountIdToFullName("alpha"); 675 info.full_name = AccountIdToFullName("alpha");
682 info.account_id = account_tracker()->SeedAccountInfo(info); 676 info.account_id = account_tracker()->SeedAccountInfo(info);
683 677
684 // Validate that seeding an unexisting account works and doesn't send a 678 // Validate that seeding an unexisting account works and doesn't send a
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
1212 ASSERT_FALSE(info.is_child_account); 1206 ASSERT_FALSE(info.is_child_account);
1213 ASSERT_TRUE(observer.CheckEvents(TrackingEvent(UPDATED, child_id))); 1207 ASSERT_TRUE(observer.CheckEvents(TrackingEvent(UPDATED, child_id)));
1214 1208
1215 SimulateTokenRevoked(child_id); 1209 SimulateTokenRevoked(child_id);
1216 ASSERT_TRUE(observer.CheckEvents(TrackingEvent(REMOVED, child_id))); 1210 ASSERT_TRUE(observer.CheckEvents(TrackingEvent(REMOVED, child_id)));
1217 1211
1218 tracker.RemoveObserver(&observer); 1212 tracker.RemoveObserver(&observer);
1219 fetcher.Shutdown(); 1213 fetcher.Shutdown();
1220 tracker.Shutdown(); 1214 tracker.Shutdown();
1221 } 1215 }
OLDNEW
« no previous file with comments | « components/signin/core/browser/account_info_unittest.cc ('k') | tools/valgrind/memcheck/suppressions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698