summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryukishiino@chromium.org <yukishiino@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-18 05:04:50 +0000
committeryukishiino@chromium.org <yukishiino@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-18 05:04:50 +0000
commitf61b3be7be76ebb500ede6e2e0ef7bd6e03f8d25 (patch)
treecaaec0a0ced50dfe6cc5ebdae28c07b81b650125
parent1c0f13ce3a767d6fa768a9755bff034f116fca1d (diff)
downloadchromium_src-f61b3be7be76ebb500ede6e2e0ef7bd6e03f8d25.zip
chromium_src-f61b3be7be76ebb500ede6e2e0ef7bd6e03f8d25.tar.gz
chromium_src-f61b3be7be76ebb500ede6e2e0ef7bd6e03f8d25.tar.bz2
Enables AutocompleteEditTest.InlineAutocompleteText fixing a leak.
The cause of a leak was that PredictorDatabaseInternal's dtor doesn't delete |db_| if DB thread is not available. Changed the bahavior to let |db_| (scoped_ptr) deletes itself if DB thread is not available. BUG=310407 TEST=none Review URL: https://codereview.chromium.org/113723002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241496 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/predictors/predictor_database.cc3
-rw-r--r--chrome/browser/ui/omnibox/omnibox_edit_unittest.cc12
2 files changed, 7 insertions, 8 deletions
diff --git a/chrome/browser/predictors/predictor_database.cc b/chrome/browser/predictors/predictor_database.cc
index 3a22f16..6bd4f9c 100644
--- a/chrome/browser/predictors/predictor_database.cc
+++ b/chrome/browser/predictors/predictor_database.cc
@@ -81,7 +81,8 @@ PredictorDatabaseInternal::PredictorDatabaseInternal(Profile* profile)
PredictorDatabaseInternal::~PredictorDatabaseInternal() {
// The connection pointer needs to be deleted on the DB thread since there
// might be a task in progress on the DB thread which uses this connection.
- BrowserThread::DeleteSoon(BrowserThread::DB, FROM_HERE, db_.release());
+ if (BrowserThread::IsMessageLoopValid(BrowserThread::DB))
+ BrowserThread::DeleteSoon(BrowserThread::DB, FROM_HERE, db_.release());
}
void PredictorDatabaseInternal::Initialize() {
diff --git a/chrome/browser/ui/omnibox/omnibox_edit_unittest.cc b/chrome/browser/ui/omnibox/omnibox_edit_unittest.cc
index 7bbe86e..ff2d23d 100644
--- a/chrome/browser/ui/omnibox/omnibox_edit_unittest.cc
+++ b/chrome/browser/ui/omnibox/omnibox_edit_unittest.cc
@@ -189,9 +189,9 @@ TEST_F(AutocompleteEditTest, AdjustTextForCopy) {
// NOTE: The TemplateURLService must be created before the
// AutocompleteClassifier so that the SearchProvider gets a non-NULL
// TemplateURLService at construction time.
- TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse(
+ TemplateURLServiceFactory::GetInstance()->SetTestingFactory(
&profile, &TemplateURLServiceFactory::BuildInstanceFor);
- AutocompleteClassifierFactory::GetInstance()->SetTestingFactoryAndUse(
+ AutocompleteClassifierFactory::GetInstance()->SetTestingFactory(
&profile, &AutocompleteClassifierFactory::BuildInstanceFor);
OmniboxEditModel model(&view, &controller, &profile);
@@ -214,18 +214,16 @@ TEST_F(AutocompleteEditTest, AdjustTextForCopy) {
}
}
-// This test causes resource leak. Disabled until it's fixed.
-// TODO(yukishiino): Fix the leak.
-TEST_F(AutocompleteEditTest, DISABLED_InlineAutocompleteText) {
+TEST_F(AutocompleteEditTest, InlineAutocompleteText) {
TestingOmniboxEditController controller(toolbar_model());
TestingOmniboxView view(&controller);
TestingProfile profile;
// NOTE: The TemplateURLService must be created before the
// AutocompleteClassifier so that the SearchProvider gets a non-NULL
// TemplateURLService at construction time.
- TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse(
+ TemplateURLServiceFactory::GetInstance()->SetTestingFactory(
&profile, &TemplateURLServiceFactory::BuildInstanceFor);
- AutocompleteClassifierFactory::GetInstance()->SetTestingFactoryAndUse(
+ AutocompleteClassifierFactory::GetInstance()->SetTestingFactory(
&profile, &AutocompleteClassifierFactory::BuildInstanceFor);
OmniboxEditModel model(&view, &controller, &profile);