summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authordhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-09 01:26:13 +0000
committerdhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-09 01:26:13 +0000
commit414c3548c4f3e023a88226c6d113b77a07391671 (patch)
tree34510711f23dbfff498533d415fbaa3b648e8ca9 /chrome/browser
parent4412ea3d167c68caef380348a54bb785ab38b933 (diff)
downloadchromium_src-414c3548c4f3e023a88226c6d113b77a07391671.zip
chromium_src-414c3548c4f3e023a88226c6d113b77a07391671.tar.gz
chromium_src-414c3548c4f3e023a88226c6d113b77a07391671.tar.bz2
Use-after-free in PersonalDataManager destructor on Mac OS
Fixes issue in unit tests where the |personal_data_| references a |profile_| that is destroyed before the |personal_data_| is done with it. The |personal_data_| member performs actions in its destructor that uses the deleted |profile_|. The change here is to force the proper order of destruction by killing |personal_data_| prior to killing |profile_|. Also, the specific test PersonalDataManagerTest.AggregateProfileWithInsufficientAddress has been extended to properly wait and verify the loading of the web data before terminating. BUG=72170 TEST=PersonalDataManagerTest.AggregateProfileWithInsufficientAddress Review URL: http://codereview.chromium.org/6462005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74219 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/autofill/personal_data_manager_unittest.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/chrome/browser/autofill/personal_data_manager_unittest.cc b/chrome/browser/autofill/personal_data_manager_unittest.cc
index a5a74ba..8687ed2 100644
--- a/chrome/browser/autofill/personal_data_manager_unittest.cc
+++ b/chrome/browser/autofill/personal_data_manager_unittest.cc
@@ -59,6 +59,7 @@ class PersonalDataManagerTest : public testing::Test {
}
virtual void TearDown() {
+ personal_data_ = NULL;
if (profile_.get())
profile_.reset(NULL);
@@ -266,6 +267,8 @@ TEST_F(PersonalDataManagerTest, SetProfilesAndCreditCards) {
EXPECT_EQ(0, profile0.Compare(*results1.at(0)));
EXPECT_EQ(0, profile1.Compare(*results1.at(1)));
+ MessageLoop::current()->Run();
+
// Add two test credit cards to the database.
std::vector<CreditCard> update_cc;
update_cc.push_back(creditcard0);
@@ -1165,6 +1168,17 @@ TEST_F(PersonalDataManagerTest, AggregateProfileWithInsufficientAddress) {
const CreditCard* imported_credit_card;
EXPECT_FALSE(personal_data_->ImportFormData(forms, &imported_credit_card));
ASSERT_FALSE(imported_credit_card);
+
+ // Wait for the refresh.
+ EXPECT_CALL(personal_data_observer_,
+ OnPersonalDataLoaded()).WillOnce(QuitUIMessageLoop());
+
+ MessageLoop::current()->Run();
+
+ const std::vector<AutoFillProfile*>& profiles = personal_data_->profiles();
+ ASSERT_EQ(0U, profiles.size());
+ const std::vector<CreditCard*>& credit_cards = personal_data_->credit_cards();
+ ASSERT_EQ(0U, credit_cards.size());
}