summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-07 04:10:11 +0000
committerjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-07 04:10:11 +0000
commite2ce1e0bbcc8f4336770a28107daff34a68514db (patch)
tree0a2a9e66f524f9354c4031f28fbbf99c33e152ae
parent7e7fab44ba1068bdce201757e82b6650fbca455d (diff)
downloadchromium_src-e2ce1e0bbcc8f4336770a28107daff34a68514db.zip
chromium_src-e2ce1e0bbcc8f4336770a28107daff34a68514db.tar.gz
chromium_src-e2ce1e0bbcc8f4336770a28107daff34a68514db.tar.bz2
Revert 65272 - Autofill heapcheck and valgrind leak in PersonalDataManager unit test fixed
[There is a lot of red on valgrind now... so trying a revert] An early return in the WebDataService was the source of a leak in PersonalDataManagerTest.Refresh test. This fixes it. Also, some small cleanup in the test itself. BUG=61988 TEST=Memory bots stay green. Review URL: http://codereview.chromium.org/4612001 TBR=dhollowa@chromium.org Review URL: http://codereview.chromium.org/4641001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65329 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/autofill/personal_data_manager_unittest.cc16
-rw-r--r--chrome/browser/webdata/web_data_service.cc2
-rw-r--r--tools/heapcheck/suppressions.txt12
-rw-r--r--tools/valgrind/memcheck/suppressions.txt14
4 files changed, 34 insertions, 10 deletions
diff --git a/chrome/browser/autofill/personal_data_manager_unittest.cc b/chrome/browser/autofill/personal_data_manager_unittest.cc
index 2947e08..2d2d94f 100644
--- a/chrome/browser/autofill/personal_data_manager_unittest.cc
+++ b/chrome/browser/autofill/personal_data_manager_unittest.cc
@@ -457,19 +457,19 @@ TEST_F(PersonalDataManagerTest, Refresh) {
EXPECT_EQ(profile0, *results1.at(0));
EXPECT_EQ(profile1, *results1.at(1));
- AutoFillProfile profile2;
- autofill_test::SetProfileInfo(&profile2,
+ scoped_ptr<AutoFillProfile> profile2(new AutoFillProfile);
+ autofill_test::SetProfileInfo(profile2.get(),
"Work", "Josephine", "Alicia", "Saenz",
"joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL",
"32801", "US", "19482937549", "13502849239");
// Adjust all labels.
- profile_pointers.push_back(&profile2);
+ profile_pointers.push_back(profile2.get());
AutoFillProfile::AdjustInferredLabels(&profile_pointers);
WebDataService* wds = profile_->GetWebDataService(Profile::EXPLICIT_ACCESS);
ASSERT_TRUE(wds);
- wds->AddAutoFillProfileGUID(profile2);
+ wds->AddAutoFillProfileGUID(*profile2.get());
personal_data_->Refresh();
@@ -483,21 +483,21 @@ TEST_F(PersonalDataManagerTest, Refresh) {
ASSERT_EQ(3U, results2.size());
EXPECT_EQ(profile0, *results2.at(0));
EXPECT_EQ(profile1, *results2.at(1));
- EXPECT_EQ(profile2, *results2.at(2));
+ EXPECT_EQ(*profile2.get(), *results2.at(2));
wds->RemoveAutoFillProfileGUID(profile1.guid());
- wds->RemoveAutoFillProfileGUID(profile2.guid());
+ wds->RemoveAutoFillProfileGUID(profile2->guid());
// Before telling the PDM to refresh, simulate an edit to one of the profiles
// via a SetProfile update (this would happen if the AutoFill window was
// open with a previous snapshot of the profiles, and something [e.g. sync]
// removed a profile from the browser. In this edge case, we will end up
// in a consistent state by dropping the write).
- profile2.SetInfo(AutoFillType(NAME_FIRST), ASCIIToUTF16("Jo"));
+ profile2->SetInfo(AutoFillType(NAME_FIRST), ASCIIToUTF16("Jo"));
update.clear();
update.push_back(profile0);
update.push_back(profile1);
- update.push_back(profile2);
+ update.push_back(*profile2.get());
personal_data_->SetProfiles(&update);
// And wait for the refresh.
diff --git a/chrome/browser/webdata/web_data_service.cc b/chrome/browser/webdata/web_data_service.cc
index d5ecd0f..d99fa73 100644
--- a/chrome/browser/webdata/web_data_service.cc
+++ b/chrome/browser/webdata/web_data_service.cc
@@ -1039,7 +1039,6 @@ void WebDataService::UpdateAutoFillProfileGUIDImpl(
// the caller will detect this on the next refresh.
AutoFillProfile* original_profile = NULL;
if (!db_->GetAutoFillProfileForGUID(profile.guid(), &original_profile)) {
- request->RequestComplete();
return;
}
scoped_ptr<AutoFillProfile> scoped_profile(original_profile);
@@ -1158,7 +1157,6 @@ void WebDataService::UpdateCreditCardGUIDImpl(
// the write and the caller will detect this on the next refresh.
CreditCard* original_credit_card = NULL;
if (!db_->GetCreditCardForGUID(credit_card.guid(), &original_credit_card)) {
- request->RequestComplete();
return;
}
scoped_ptr<CreditCard> scoped_credit_card(original_credit_card);
diff --git a/tools/heapcheck/suppressions.txt b/tools/heapcheck/suppressions.txt
index cb0d582..a5c1b0f 100644
--- a/tools/heapcheck/suppressions.txt
+++ b/tools/heapcheck/suppressions.txt
@@ -1053,3 +1053,15 @@
fun:testing::HandleExceptionsInMethodIfSupported
fun:testing::Test::Run
}
+{
+ bug_61988_a
+ Heapcheck:Leak
+ ...
+ fun:PersonalDataManagerTest_Refresh_Test::TestBody
+}
+{
+ bug_61988_b
+ Heapcheck:Leak
+ ...
+ fun:TestingProfile::CreateWebDataService
+}
diff --git a/tools/valgrind/memcheck/suppressions.txt b/tools/valgrind/memcheck/suppressions.txt
index ffa70e1..3bd23e8 100644
--- a/tools/valgrind/memcheck/suppressions.txt
+++ b/tools/valgrind/memcheck/suppressions.txt
@@ -3196,3 +3196,17 @@
fun:_ZN23AutocompleteEditViewGtk6UpdateEPK11TabContents
fun:_ZN15LocationBarView6UpdateEPK11TabContents
}
+{
+ bug_61988_a
+ Memcheck:Leak
+ fun:_Znw*
+ ...
+ fun:_ZN14TestingProfile20CreateWebDataServiceEb
+ fun:_ZN23PersonalDataManagerTest5SetUpEv
+}
+{
+ bug_61988_b
+ Memcheck:Leak
+ ...
+ fun:_ZN36PersonalDataManagerTest_Refresh_Test8TestBodyEv
+}