| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 } else { | 161 } else { |
| 162 base::ThreadTaskRunnerHandle::Get()->PostTask( | 162 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 163 FROM_HERE, | 163 FROM_HERE, |
| 164 base::Bind(&LoadedCallbackTask::Run, | 164 base::Bind(&LoadedCallbackTask::Run, |
| 165 new LoadedCallbackTask(loaded_callback, | 165 new LoadedCallbackTask(loaded_callback, |
| 166 std::vector<CanonicalCookie*>()))); | 166 std::vector<CanonicalCookie*>()))); |
| 167 } | 167 } |
| 168 } | 168 } |
| 169 | 169 |
| 170 void MockSimplePersistentCookieStore::AddCookie(const CanonicalCookie& cookie) { | 170 void MockSimplePersistentCookieStore::AddCookie(const CanonicalCookie& cookie) { |
| 171 int64 creation_time = cookie.CreationDate().ToInternalValue(); | 171 int64_t creation_time = cookie.CreationDate().ToInternalValue(); |
| 172 EXPECT_TRUE(cookies_.find(creation_time) == cookies_.end()); | 172 EXPECT_TRUE(cookies_.find(creation_time) == cookies_.end()); |
| 173 cookies_[creation_time] = cookie; | 173 cookies_[creation_time] = cookie; |
| 174 } | 174 } |
| 175 | 175 |
| 176 void MockSimplePersistentCookieStore::UpdateCookieAccessTime( | 176 void MockSimplePersistentCookieStore::UpdateCookieAccessTime( |
| 177 const CanonicalCookie& cookie) { | 177 const CanonicalCookie& cookie) { |
| 178 int64 creation_time = cookie.CreationDate().ToInternalValue(); | 178 int64_t creation_time = cookie.CreationDate().ToInternalValue(); |
| 179 ASSERT_TRUE(cookies_.find(creation_time) != cookies_.end()); | 179 ASSERT_TRUE(cookies_.find(creation_time) != cookies_.end()); |
| 180 cookies_[creation_time].SetLastAccessDate(base::Time::Now()); | 180 cookies_[creation_time].SetLastAccessDate(base::Time::Now()); |
| 181 } | 181 } |
| 182 | 182 |
| 183 void MockSimplePersistentCookieStore::DeleteCookie( | 183 void MockSimplePersistentCookieStore::DeleteCookie( |
| 184 const CanonicalCookie& cookie) { | 184 const CanonicalCookie& cookie) { |
| 185 int64 creation_time = cookie.CreationDate().ToInternalValue(); | 185 int64_t creation_time = cookie.CreationDate().ToInternalValue(); |
| 186 CanonicalCookieMap::iterator it = cookies_.find(creation_time); | 186 CanonicalCookieMap::iterator it = cookies_.find(creation_time); |
| 187 ASSERT_TRUE(it != cookies_.end()); | 187 ASSERT_TRUE(it != cookies_.end()); |
| 188 cookies_.erase(it); | 188 cookies_.erase(it); |
| 189 } | 189 } |
| 190 | 190 |
| 191 void MockSimplePersistentCookieStore::Flush(const base::Closure& callback) { | 191 void MockSimplePersistentCookieStore::Flush(const base::Closure& callback) { |
| 192 if (!callback.is_null()) | 192 if (!callback.is_null()) |
| 193 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, callback); | 193 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, callback); |
| 194 } | 194 } |
| 195 | 195 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 store->AddCookie(cc); | 234 store->AddCookie(cc); |
| 235 } | 235 } |
| 236 | 236 |
| 237 return new CookieMonster(store.get(), NULL); | 237 return new CookieMonster(store.get(), NULL); |
| 238 } | 238 } |
| 239 | 239 |
| 240 MockSimplePersistentCookieStore::~MockSimplePersistentCookieStore() { | 240 MockSimplePersistentCookieStore::~MockSimplePersistentCookieStore() { |
| 241 } | 241 } |
| 242 | 242 |
| 243 } // namespace net | 243 } // namespace net |
| OLD | NEW |