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

Unified Diff: chrome/browser/autocomplete/autocomplete_provider_unittest.cc

Issue 12218104: Fix memory leak in AutocompleteProviderTest::GetDestinationURL unit test. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 7 years, 10 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 | « chrome/browser/autocomplete/autocomplete_controller.cc ('k') | tools/heapcheck/suppressions.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autocomplete/autocomplete_provider_unittest.cc
===================================================================
--- chrome/browser/autocomplete/autocomplete_provider_unittest.cc (revision 181776)
+++ chrome/browser/autocomplete/autocomplete_provider_unittest.cc (working copy)
@@ -254,9 +254,10 @@
providers.push_back(provider2);
// Reset the controller to contain our new providers.
- controller_.reset(
- new AutocompleteController(&profile_, NULL,
- AutocompleteProvider::TYPE_SEARCH));
+ controller_.reset(new AutocompleteController(&profile_, NULL, 0));
+ // We're going to swap the providers vector, but the old vector should be
+ // empty so no elements need to be freed at this point.
+ EXPECT_TRUE(controller_->providers_.empty());
controller_->providers_.swap(providers);
provider1->set_listener(controller_.get());
provider2->set_listener(controller_.get());
@@ -559,7 +560,7 @@
}
TEST_F(AutocompleteProviderTest, GetDestinationURL) {
- ResetControllerWithTestProviders(false, NULL, NULL);
+ ResetControllerWithKeywordAndSearchProviders();
// For the destination URL to have aqs parameters for query formulation time
// and the field trial triggered bit, many conditions need to be satisfied.
@@ -597,6 +598,8 @@
// Test field trial triggered bit set.
controller_->search_provider_->field_trial_triggered_in_session_ = true;
+ EXPECT_TRUE(
+ controller_->search_provider_->field_trial_triggered_in_session());
url = controller_->GetDestinationURL(match,
base::TimeDelta::FromMilliseconds(2456));
EXPECT_EQ("//aqs=chrome.0.57j58j5l2j0l3j59.2456j1&", url.path());
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_controller.cc ('k') | tools/heapcheck/suppressions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698