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

Side by Side Diff: net/cookies/cookie_monster_store_test.cc

Issue 876973003: Implement the "first-party-only" cookie flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: FirstPartyOnly. Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « net/cookies/cookie_monster.cc ('k') | net/cookies/cookie_monster_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « net/cookies/cookie_monster.cc ('k') | net/cookies/cookie_monster_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698