Fix memory leak in readingListPrivate api test.

FakeDB::EntryMap wasn't getting cleaned up in the test. Changed the API
to make it clearer that ownership isn't taken.
BUG=334682

Review URL: https://codereview.chromium.org/140113002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245282 0039d316-1c4b-4281-b951-d872f2087c98
parent adf29bc2
......@@ -30,7 +30,7 @@ class ReadingListPrivateApiTest : public ExtensionApiTest {
DomDistillerContextKeyedService* service =
new DomDistillerContextKeyedService(
scoped_ptr<DomDistillerStoreInterface>(
CreateStoreWithFakeDB(fake_db, new FakeDB::EntryMap)),
CreateStoreWithFakeDB(fake_db, FakeDB::EntryMap())),
scoped_ptr<DistillerFactory>(factory));
fake_db->InitCallback(true);
fake_db->LoadCallback(true);
......
......@@ -65,7 +65,7 @@ class DomDistillerServiceTest : public testing::Test {
main_loop_.reset(new base::MessageLoop());
FakeDB* fake_db = new FakeDB(&db_model_);
FakeDB::EntryMap store_model;
store_ = test::util::CreateStoreWithFakeDB(fake_db, &store_model);
store_ = test::util::CreateStoreWithFakeDB(fake_db, store_model);
distiller_factory_ = new MockDistillerFactory();
service_.reset(new DomDistillerService(
scoped_ptr<DomDistillerStoreInterface>(store_),
......
......@@ -140,7 +140,7 @@ class DomDistillerStoreTest : public testing::Test {
// with a FakeDB backed by |db_model_|.
void CreateStore() {
fake_db_ = new FakeDB(&db_model_);
store_.reset(test::util::CreateStoreWithFakeDB(fake_db_, &store_model_));
store_.reset(test::util::CreateStoreWithFakeDB(fake_db_, store_model_));
}
void StartSyncing() {
......@@ -170,7 +170,7 @@ class DomDistillerStoreTest : public testing::Test {
EntryMap db_model_;
EntryMap sync_model_;
EntryMap store_model_;
FakeDB::EntryMap store_model_;
scoped_ptr<DomDistillerStore> store_;
......
......@@ -91,10 +91,10 @@ HasExpectedUpdates(
// static
DomDistillerStore* CreateStoreWithFakeDB(FakeDB* fake_db,
FakeDB::EntryMap* store_model) {
const FakeDB::EntryMap& store_model) {
return new DomDistillerStore(
scoped_ptr<DomDistillerDatabaseInterface>(fake_db),
EntryMapToList(*store_model),
EntryMapToList(store_model),
FakeDB::DirectoryForTestDB());
}
......
......@@ -43,7 +43,7 @@ testing::Matcher<const std::vector<DomDistillerObserver::ArticleUpdate>&>
// Creates a simple DomDistillerStore backed by |fake_db| and initialized
// with |store_model|.
DomDistillerStore* CreateStoreWithFakeDB(FakeDB* fake_db,
FakeDB::EntryMap* store_model);
const FakeDB::EntryMap& store_model);
} // namespace util
} // namespace test
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment