| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/cookies/cookie_monster_store_test.h" | 5 #include "net/cookies/cookie_monster_store_test.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 // functions. Would be nice to export them, and re-use here. | 114 // functions. Would be nice to export them, and re-use here. |
| 115 EXPECT_FALSE(pc.HasMaxAge()); | 115 EXPECT_FALSE(pc.HasMaxAge()); |
| 116 EXPECT_TRUE(pc.HasPath()); | 116 EXPECT_TRUE(pc.HasPath()); |
| 117 base::Time cookie_expires = pc.HasExpires() | 117 base::Time cookie_expires = pc.HasExpires() |
| 118 ? cookie_util::ParseCookieTime(pc.Expires()) | 118 ? cookie_util::ParseCookieTime(pc.Expires()) |
| 119 : base::Time(); | 119 : base::Time(); |
| 120 std::string cookie_path = pc.Path(); | 120 std::string cookie_path = pc.Path(); |
| 121 | 121 |
| 122 return CanonicalCookie(GURL(), pc.Name(), pc.Value(), key, cookie_path, | 122 return CanonicalCookie(GURL(), pc.Name(), pc.Value(), key, cookie_path, |
| 123 creation_time, cookie_expires, creation_time, | 123 creation_time, cookie_expires, creation_time, |
| 124 pc.IsSecure(), pc.IsHttpOnly(), pc.Priority()); | 124 pc.IsSecure(), pc.IsHttpOnly(), pc.IsFirstPartyOnly(), |
| 125 pc.Priority()); |
| 125 } | 126 } |
| 126 | 127 |
| 127 void AddCookieToList(const std::string& key, | 128 void AddCookieToList(const std::string& key, |
| 128 const std::string& cookie_line, | 129 const std::string& cookie_line, |
| 129 const base::Time& creation_time, | 130 const base::Time& creation_time, |
| 130 std::vector<CanonicalCookie*>* out_list) { | 131 std::vector<CanonicalCookie*>* out_list) { |
| 131 scoped_ptr<CanonicalCookie> cookie(new CanonicalCookie( | 132 scoped_ptr<CanonicalCookie> cookie(new CanonicalCookie( |
| 132 BuildCanonicalCookie(key, cookie_line, creation_time))); | 133 BuildCanonicalCookie(key, cookie_line, creation_time))); |
| 133 | 134 |
| 134 out_list->push_back(cookie.release()); | 135 out_list->push_back(cookie.release()); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 for (int i = 0; i < num_cookies; i++) { | 208 for (int i = 0; i < num_cookies; i++) { |
| 208 base::Time creation_time = | 209 base::Time creation_time = |
| 209 past_creation + base::TimeDelta::FromMicroseconds(i); | 210 past_creation + base::TimeDelta::FromMicroseconds(i); |
| 210 base::Time expiration_time = current + base::TimeDelta::FromDays(30); | 211 base::Time expiration_time = current + base::TimeDelta::FromDays(30); |
| 211 base::Time last_access_time = | 212 base::Time last_access_time = |
| 212 (i < num_old_cookies) ? current - base::TimeDelta::FromDays(days_old) | 213 (i < num_old_cookies) ? current - base::TimeDelta::FromDays(days_old) |
| 213 : current; | 214 : current; |
| 214 | 215 |
| 215 CanonicalCookie cc(GURL(), "a", "1", base::StringPrintf("h%05d.izzle", i), | 216 CanonicalCookie cc(GURL(), "a", "1", base::StringPrintf("h%05d.izzle", i), |
| 216 "/path", creation_time, expiration_time, | 217 "/path", creation_time, expiration_time, |
| 217 last_access_time, false, false, COOKIE_PRIORITY_DEFAULT); | 218 last_access_time, false, false, false, |
| 219 COOKIE_PRIORITY_DEFAULT); |
| 218 store->AddCookie(cc); | 220 store->AddCookie(cc); |
| 219 } | 221 } |
| 220 | 222 |
| 221 return new CookieMonster(store.get(), NULL); | 223 return new CookieMonster(store.get(), NULL); |
| 222 } | 224 } |
| 223 | 225 |
| 224 MockSimplePersistentCookieStore::~MockSimplePersistentCookieStore() { | 226 MockSimplePersistentCookieStore::~MockSimplePersistentCookieStore() { |
| 225 } | 227 } |
| 226 | 228 |
| 227 } // namespace net | 229 } // namespace net |
| OLD | NEW |