OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // This file contains test infrastructure for multiple files | 5 // This file contains test infrastructure for multiple files |
6 // (current cookie_monster_unittest.cc and cookie_monster_perftest.cc) | 6 // (current cookie_monster_unittest.cc and cookie_monster_perftest.cc) |
7 // that need to test out CookieMonster interactions with the backing store. | 7 // that need to test out CookieMonster interactions with the backing store. |
8 // It should only be included by test code. | 8 // It should only be included by test code. |
9 | 9 |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // functions. Would be nice to export them, and re-use here. | 130 // functions. Would be nice to export them, and re-use here. |
131 EXPECT_FALSE(pc.HasMaxAge()); | 131 EXPECT_FALSE(pc.HasMaxAge()); |
132 EXPECT_TRUE(pc.HasPath()); | 132 EXPECT_TRUE(pc.HasPath()); |
133 base::Time cookie_expires = pc.HasExpires() ? | 133 base::Time cookie_expires = pc.HasExpires() ? |
134 net::CookieMonster::ParseCookieTime(pc.Expires()) : base::Time(); | 134 net::CookieMonster::ParseCookieTime(pc.Expires()) : base::Time(); |
135 std::string cookie_path = pc.Path(); | 135 std::string cookie_path = pc.Path(); |
136 | 136 |
137 scoped_ptr<net::CookieMonster::CanonicalCookie> cookie( | 137 scoped_ptr<net::CookieMonster::CanonicalCookie> cookie( |
138 new net::CookieMonster::CanonicalCookie( | 138 new net::CookieMonster::CanonicalCookie( |
139 pc.Name(), pc.Value(), key, cookie_path, | 139 pc.Name(), pc.Value(), key, cookie_path, |
140 pc.IsSecure(), pc.IsHttpOnly(), | 140 pc.IsSecure(), pc.IsHttpOnly(), pc.IsOrigin(), |
141 creation_time, creation_time, | 141 creation_time, creation_time, |
142 !cookie_expires.is_null(), | 142 !cookie_expires.is_null(), |
143 cookie_expires)); | 143 cookie_expires)); |
144 | 144 |
145 out_list->push_back(cookie.release()); | 145 out_list->push_back(cookie.release()); |
146 } | 146 } |
147 | 147 |
148 // Just act like a backing database. Keep cookie information from | 148 // Just act like a backing database. Keep cookie information from |
149 // Add/Update/Delete and regurgitate it when Load is called. | 149 // Add/Update/Delete and regurgitate it when Load is called. |
150 class MockSimplePersistentCookieStore | 150 class MockSimplePersistentCookieStore |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 "a", "1", StringPrintf("h%05d.izzle", i), "/path", false, false, | 219 "a", "1", StringPrintf("h%05d.izzle", i), "/path", false, false, |
220 past_creation + base::TimeDelta::FromMicroseconds(i), current, | 220 past_creation + base::TimeDelta::FromMicroseconds(i), current, |
221 true, current + base::TimeDelta::FromDays(30)); | 221 true, current + base::TimeDelta::FromDays(30)); |
222 store->AddCookie(cc); | 222 store->AddCookie(cc); |
223 } | 223 } |
224 | 224 |
225 return new net::CookieMonster(store, NULL); | 225 return new net::CookieMonster(store, NULL); |
226 } | 226 } |
227 | 227 |
228 } // namespace | 228 } // namespace |
OLD | NEW |