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

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

Issue 14113014: Adding Priority field to cookies. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renamed enums PRIORITY_* to COOKIE_PRIORITY_*. Created 7 years, 8 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.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"
11 #include "googleurl/src/gurl.h" 11 #include "googleurl/src/gurl.h"
12 #include "net/cookies/cookie_constants.h"
12 #include "net/cookies/cookie_util.h" 13 #include "net/cookies/cookie_util.h"
13 #include "net/cookies/parsed_cookie.h" 14 #include "net/cookies/parsed_cookie.h"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 16
16 namespace net { 17 namespace net {
17 LoadedCallbackTask::LoadedCallbackTask(LoadedCallback loaded_callback, 18 LoadedCallbackTask::LoadedCallbackTask(LoadedCallback loaded_callback,
18 std::vector<CanonicalCookie*> cookies) 19 std::vector<CanonicalCookie*> cookies)
19 : loaded_callback_(loaded_callback), 20 : loaded_callback_(loaded_callback),
20 cookies_(cookies) { 21 cookies_(cookies) {
21 } 22 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 // functions. Would be nice to export them, and re-use here. 110 // functions. Would be nice to export them, and re-use here.
110 EXPECT_FALSE(pc.HasMaxAge()); 111 EXPECT_FALSE(pc.HasMaxAge());
111 EXPECT_TRUE(pc.HasPath()); 112 EXPECT_TRUE(pc.HasPath());
112 base::Time cookie_expires = pc.HasExpires() ? 113 base::Time cookie_expires = pc.HasExpires() ?
113 cookie_util::ParseCookieTime(pc.Expires()) : base::Time(); 114 cookie_util::ParseCookieTime(pc.Expires()) : base::Time();
114 std::string cookie_path = pc.Path(); 115 std::string cookie_path = pc.Path();
115 116
116 return CanonicalCookie( 117 return CanonicalCookie(
117 GURL(), pc.Name(), pc.Value(), key, cookie_path, 118 GURL(), pc.Name(), pc.Value(), key, cookie_path,
118 creation_time, cookie_expires, creation_time, 119 creation_time, cookie_expires, creation_time,
119 pc.IsSecure(), pc.IsHttpOnly()); 120 pc.IsSecure(), pc.IsHttpOnly(), pc.Priority());
120 } 121 }
121 122
122 void AddCookieToList( 123 void AddCookieToList(
123 const std::string& key, 124 const std::string& key,
124 const std::string& cookie_line, 125 const std::string& cookie_line,
125 const base::Time& creation_time, 126 const base::Time& creation_time,
126 std::vector<CanonicalCookie*>* out_list) { 127 std::vector<CanonicalCookie*>* out_list) {
127 scoped_ptr<CanonicalCookie> cookie( 128 scoped_ptr<CanonicalCookie> cookie(
128 new CanonicalCookie( 129 new CanonicalCookie(
129 BuildCanonicalCookie(key, cookie_line, creation_time))); 130 BuildCanonicalCookie(key, cookie_line, creation_time)));
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 for (int i = 0; i < num_cookies; i++) { 203 for (int i = 0; i < num_cookies; i++) {
203 base::Time creation_time = 204 base::Time creation_time =
204 past_creation + base::TimeDelta::FromMicroseconds(i); 205 past_creation + base::TimeDelta::FromMicroseconds(i);
205 base::Time expiration_time = current + base::TimeDelta::FromDays(30); 206 base::Time expiration_time = current + base::TimeDelta::FromDays(30);
206 base::Time last_access_time = 207 base::Time last_access_time =
207 (i < num_old_cookies) ? current - base::TimeDelta::FromDays(days_old) : 208 (i < num_old_cookies) ? current - base::TimeDelta::FromDays(days_old) :
208 current; 209 current;
209 210
210 CanonicalCookie cc( 211 CanonicalCookie cc(
211 GURL(), "a", "1", base::StringPrintf("h%05d.izzle", i), "/path", 212 GURL(), "a", "1", base::StringPrintf("h%05d.izzle", i), "/path",
212 creation_time, expiration_time, last_access_time, false, false); 213 creation_time, expiration_time, last_access_time, false, false,
214 COOKIE_PRIORITY_DEFAULT);
213 store->AddCookie(cc); 215 store->AddCookie(cc);
214 } 216 }
215 217
216 return new CookieMonster(store, NULL); 218 return new CookieMonster(store, NULL);
217 } 219 }
218 220
219 MockSimplePersistentCookieStore::~MockSimplePersistentCookieStore() {} 221 MockSimplePersistentCookieStore::~MockSimplePersistentCookieStore() {}
220 222
221 } // namespace net 223 } // 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