| Index: net/base/cookie_monster_store_test.cc
|
| ===================================================================
|
| --- net/base/cookie_monster_store_test.cc (revision 100888)
|
| +++ net/base/cookie_monster_store_test.cc (working copy)
|
| @@ -25,11 +25,13 @@
|
| load_result_ = result;
|
| }
|
|
|
| -bool MockPersistentCookieStore::Load(
|
| - std::vector<CookieMonster::CanonicalCookie*>* out_cookies) {
|
| +bool MockPersistentCookieStore::Load(const LoadedCallback& loaded_callback) {
|
| bool ok = load_return_value_;
|
| - if (ok)
|
| - *out_cookies = load_result_;
|
| + std::vector<CookieMonster::CanonicalCookie*> out_cookies;
|
| + if (ok) {
|
| + out_cookies = load_result_;
|
| + }
|
| + loaded_callback.Run(out_cookies);
|
| return ok;
|
| }
|
|
|
| @@ -78,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());
|
| @@ -92,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() {}
|
| @@ -108,11 +118,13 @@
|
| MockSimplePersistentCookieStore::~MockSimplePersistentCookieStore() {}
|
|
|
| bool MockSimplePersistentCookieStore::Load(
|
| - std::vector<CookieMonster::CanonicalCookie*>* out_cookies) {
|
| + const LoadedCallback& loaded_callback) {
|
| + std::vector<CookieMonster::CanonicalCookie*> out_cookies;
|
| for (CanonicalCookieMap::const_iterator it = cookies_.begin();
|
| it != cookies_.end(); it++)
|
| - out_cookies->push_back(
|
| + out_cookies.push_back(
|
| new CookieMonster::CanonicalCookie(it->second));
|
| + loaded_callback.Run(out_cookies);
|
| return true;
|
| }
|
|
|
|
|