| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/callback.h" | 6 #include "base/callback.h" |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/scoped_temp_dir.h" | 10 #include "base/scoped_temp_dir.h" |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 void Callback() { | 309 void Callback() { |
| 310 ++callback_count_; | 310 ++callback_count_; |
| 311 } | 311 } |
| 312 | 312 |
| 313 int callback_count() { | 313 int callback_count() { |
| 314 return callback_count_; | 314 return callback_count_; |
| 315 } | 315 } |
| 316 | 316 |
| 317 private: | 317 private: |
| 318 friend class base::RefCountedThreadSafe<CallbackCounter>; | 318 friend class base::RefCountedThreadSafe<CallbackCounter>; |
| 319 ~CallbackCounter() {} |
| 320 |
| 319 volatile int callback_count_; | 321 volatile int callback_count_; |
| 320 }; | 322 }; |
| 321 | 323 |
| 322 // Test that we can get a completion callback after a Flush(). | 324 // Test that we can get a completion callback after a Flush(). |
| 323 TEST_F(SQLitePersistentCookieStoreTest, TestFlushCompletionCallback) { | 325 TEST_F(SQLitePersistentCookieStoreTest, TestFlushCompletionCallback) { |
| 324 InitializeStore(false); | 326 InitializeStore(false); |
| 325 // Put some data - any data - on disk, so that Flush is not a no-op. | 327 // Put some data - any data - on disk, so that Flush is not a no-op. |
| 326 AddCookie("A", "B", "http://foo.bar", "/", base::Time::Now()); | 328 AddCookie("A", "B", "http://foo.bar", "/", base::Time::Now()); |
| 327 | 329 |
| 328 scoped_refptr<CallbackCounter> counter(new CallbackCounter()); | 330 scoped_refptr<CallbackCounter> counter(new CallbackCounter()); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 | 447 |
| 446 EXPECT_FALSE(cookie_map["session-noexpires"]->DoesExpire()); | 448 EXPECT_FALSE(cookie_map["session-noexpires"]->DoesExpire()); |
| 447 EXPECT_FALSE(cookie_map["session-noexpires"]->IsPersistent()); | 449 EXPECT_FALSE(cookie_map["session-noexpires"]->IsPersistent()); |
| 448 | 450 |
| 449 EXPECT_TRUE(cookie_map["persistent"]->DoesExpire()); | 451 EXPECT_TRUE(cookie_map["persistent"]->DoesExpire()); |
| 450 EXPECT_TRUE(cookie_map["persistent"]->IsPersistent()); | 452 EXPECT_TRUE(cookie_map["persistent"]->IsPersistent()); |
| 451 | 453 |
| 452 STLDeleteContainerPointers(cookies.begin(), cookies.end()); | 454 STLDeleteContainerPointers(cookies.begin(), cookies.end()); |
| 453 cookies.clear(); | 455 cookies.clear(); |
| 454 } | 456 } |
| OLD | NEW |