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.h" | 8 #include "base/message_loop.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 // functions. Would be nice to export them, and re-use here. | 109 // functions. Would be nice to export them, and re-use here. |
110 EXPECT_FALSE(pc.HasMaxAge()); | 110 EXPECT_FALSE(pc.HasMaxAge()); |
111 EXPECT_TRUE(pc.HasPath()); | 111 EXPECT_TRUE(pc.HasPath()); |
112 base::Time cookie_expires = pc.HasExpires() ? | 112 base::Time cookie_expires = pc.HasExpires() ? |
113 CookieMonster::ParseCookieTime(pc.Expires()) : base::Time(); | 113 CookieMonster::ParseCookieTime(pc.Expires()) : base::Time(); |
114 std::string cookie_path = pc.Path(); | 114 std::string cookie_path = pc.Path(); |
115 | 115 |
116 return CookieMonster::CanonicalCookie( | 116 return CookieMonster::CanonicalCookie( |
117 GURL(), pc.Name(), pc.Value(), key, cookie_path, | 117 GURL(), pc.Name(), pc.Value(), key, cookie_path, |
118 pc.MACKey(), pc.MACAlgorithm(), | 118 pc.MACKey(), pc.MACAlgorithm(), |
119 creation_time, creation_time, cookie_expires, | 119 creation_time, cookie_expires, creation_time, |
120 pc.IsSecure(), pc.IsHttpOnly(), | 120 pc.IsSecure(), pc.IsHttpOnly()); |
121 !cookie_expires.is_null(), !cookie_expires.is_null()); | |
122 } | 121 } |
123 | 122 |
124 void AddCookieToList( | 123 void AddCookieToList( |
125 const std::string& key, | 124 const std::string& key, |
126 const std::string& cookie_line, | 125 const std::string& cookie_line, |
127 const base::Time& creation_time, | 126 const base::Time& creation_time, |
128 std::vector<CookieMonster::CanonicalCookie*>* out_list) { | 127 std::vector<CookieMonster::CanonicalCookie*>* out_list) { |
129 scoped_ptr<CookieMonster::CanonicalCookie> cookie( | 128 scoped_ptr<CookieMonster::CanonicalCookie> cookie( |
130 new CookieMonster::CanonicalCookie( | 129 new CookieMonster::CanonicalCookie( |
131 BuildCanonicalCookie(key, cookie_line, creation_time))); | 130 BuildCanonicalCookie(key, cookie_line, creation_time))); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 base::Time last_access_time = | 209 base::Time last_access_time = |
211 (i < num_old_cookies) ? current - base::TimeDelta::FromDays(days_old) : | 210 (i < num_old_cookies) ? current - base::TimeDelta::FromDays(days_old) : |
212 current; | 211 current; |
213 | 212 |
214 std::string mac_key; | 213 std::string mac_key; |
215 std::string mac_algorithm; | 214 std::string mac_algorithm; |
216 | 215 |
217 CookieMonster::CanonicalCookie cc( | 216 CookieMonster::CanonicalCookie cc( |
218 GURL(), "a", "1", base::StringPrintf("h%05d.izzle", i), "/path", | 217 GURL(), "a", "1", base::StringPrintf("h%05d.izzle", i), "/path", |
219 mac_key, mac_algorithm, creation_time, expiration_time, | 218 mac_key, mac_algorithm, creation_time, expiration_time, |
220 last_access_time, false, false, true, true); | 219 last_access_time, false, false); |
221 store->AddCookie(cc); | 220 store->AddCookie(cc); |
222 } | 221 } |
223 | 222 |
224 return new CookieMonster(store, NULL); | 223 return new CookieMonster(store, NULL); |
225 } | 224 } |
226 | 225 |
227 MockSimplePersistentCookieStore::~MockSimplePersistentCookieStore() {} | 226 MockSimplePersistentCookieStore::~MockSimplePersistentCookieStore() {} |
228 | 227 |
229 } // namespace net | 228 } // namespace net |
OLD | NEW |