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/location.h" | 8 #include "base/location.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // functions. Would be nice to export them, and re-use here. | 131 // functions. Would be nice to export them, and re-use here. |
132 EXPECT_FALSE(pc.HasMaxAge()); | 132 EXPECT_FALSE(pc.HasMaxAge()); |
133 EXPECT_TRUE(pc.HasPath()); | 133 EXPECT_TRUE(pc.HasPath()); |
134 base::Time cookie_expires = pc.HasExpires() | 134 base::Time cookie_expires = pc.HasExpires() |
135 ? cookie_util::ParseCookieTime(pc.Expires()) | 135 ? cookie_util::ParseCookieTime(pc.Expires()) |
136 : base::Time(); | 136 : base::Time(); |
137 std::string cookie_path = pc.Path(); | 137 std::string cookie_path = pc.Path(); |
138 | 138 |
139 return CanonicalCookie(GURL(), pc.Name(), pc.Value(), key, cookie_path, | 139 return CanonicalCookie(GURL(), pc.Name(), pc.Value(), key, cookie_path, |
140 creation_time, cookie_expires, creation_time, | 140 creation_time, cookie_expires, creation_time, |
141 pc.IsSecure(), pc.IsHttpOnly(), pc.IsSameSite(), | 141 pc.IsSecure(), pc.IsHttpOnly(), pc.SameSite(), |
142 pc.Priority()); | 142 pc.Priority()); |
143 } | 143 } |
144 | 144 |
145 void AddCookieToList(const std::string& key, | 145 void AddCookieToList(const std::string& key, |
146 const std::string& cookie_line, | 146 const std::string& cookie_line, |
147 const base::Time& creation_time, | 147 const base::Time& creation_time, |
148 std::vector<CanonicalCookie*>* out_list) { | 148 std::vector<CanonicalCookie*>* out_list) { |
149 scoped_ptr<CanonicalCookie> cookie(new CanonicalCookie( | 149 scoped_ptr<CanonicalCookie> cookie(new CanonicalCookie( |
150 BuildCanonicalCookie(key, cookie_line, creation_time))); | 150 BuildCanonicalCookie(key, cookie_line, creation_time))); |
151 | 151 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 base::Time creation_time = | 241 base::Time creation_time = |
242 past_creation + base::TimeDelta::FromMicroseconds(i); | 242 past_creation + base::TimeDelta::FromMicroseconds(i); |
243 base::Time expiration_time = current + base::TimeDelta::FromDays(30); | 243 base::Time expiration_time = current + base::TimeDelta::FromDays(30); |
244 base::Time last_access_time = | 244 base::Time last_access_time = |
245 ((i - base) < num_old_cookies) | 245 ((i - base) < num_old_cookies) |
246 ? current - base::TimeDelta::FromDays(days_old) | 246 ? current - base::TimeDelta::FromDays(days_old) |
247 : current; | 247 : current; |
248 | 248 |
249 CanonicalCookie cc(GURL(), "a", "1", base::StringPrintf("h%05d.izzle", i), | 249 CanonicalCookie cc(GURL(), "a", "1", base::StringPrintf("h%05d.izzle", i), |
250 "/path", creation_time, expiration_time, | 250 "/path", creation_time, expiration_time, |
251 last_access_time, secure, false, false, | 251 last_access_time, secure, false, |
252 COOKIE_PRIORITY_DEFAULT); | 252 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT); |
253 store->AddCookie(cc); | 253 store->AddCookie(cc); |
254 } | 254 } |
255 | 255 |
256 return make_scoped_ptr(new CookieMonster(store.get(), nullptr)); | 256 return make_scoped_ptr(new CookieMonster(store.get(), nullptr)); |
257 } | 257 } |
258 | 258 |
259 MockSimplePersistentCookieStore::~MockSimplePersistentCookieStore() { | 259 MockSimplePersistentCookieStore::~MockSimplePersistentCookieStore() { |
260 } | 260 } |
261 | 261 |
262 } // namespace net | 262 } // namespace net |
OLD | NEW |