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

Unified Diff: net/base/cookie_monster_store_test.cc

Issue 7831056: Fix a memory leak in a unit test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 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 | « net/base/cookie_monster_store_test.h ('k') | net/base/cookie_monster_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/cookie_monster_store_test.cc
===================================================================
--- net/base/cookie_monster_store_test.cc (revision 100188)
+++ net/base/cookie_monster_store_test.cc (working copy)
@@ -80,7 +80,18 @@
const std::string& cookie_line,
const base::Time& creation_time,
std::vector<CookieMonster::CanonicalCookie*>* out_list) {
+ scoped_ptr<CookieMonster::CanonicalCookie> cookie(
+ new CookieMonster::CanonicalCookie(
+ BuildCanonicalCookie(key, cookie_line, creation_time)));
+ out_list->push_back(cookie.release());
+}
+
+CookieMonster::CanonicalCookie BuildCanonicalCookie(
+ const std::string& key,
+ const std::string& cookie_line,
+ const base::Time& creation_time) {
+
// Parse the cookie line.
CookieMonster::ParsedCookie pc(cookie_line);
EXPECT_TRUE(pc.IsValid());
@@ -94,15 +105,12 @@
CookieMonster::ParseCookieTime(pc.Expires()) : base::Time();
std::string cookie_path = pc.Path();
- scoped_ptr<CookieMonster::CanonicalCookie> cookie(
- new CookieMonster::CanonicalCookie(
- GURL(), pc.Name(), pc.Value(), key, cookie_path,
- pc.MACKey(), pc.MACAlgorithm(),
- creation_time, creation_time, cookie_expires,
- pc.IsSecure(), pc.IsHttpOnly(),
- !cookie_expires.is_null()));
-
- out_list->push_back(cookie.release());
+ return CookieMonster::CanonicalCookie(
+ GURL(), pc.Name(), pc.Value(), key, cookie_path,
+ pc.MACKey(), pc.MACAlgorithm(),
+ creation_time, creation_time, cookie_expires,
+ pc.IsSecure(), pc.IsHttpOnly(),
+ !cookie_expires.is_null());
}
MockSimplePersistentCookieStore::MockSimplePersistentCookieStore() {}
« no previous file with comments | « net/base/cookie_monster_store_test.h ('k') | net/base/cookie_monster_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698