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 <map> | 5 #include <map> |
6 #include <set> | 6 #include <set> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 11 #include "base/files/scoped_temp_dir.h" |
11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
12 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
13 #include "base/scoped_temp_dir.h" | |
14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
15 #include "base/synchronization/waitable_event.h" | 15 #include "base/synchronization/waitable_event.h" |
16 #include "base/test/thread_test_helper.h" | 16 #include "base/test/thread_test_helper.h" |
17 #include "base/time.h" | 17 #include "base/time.h" |
18 #include "chrome/browser/net/clear_on_exit_policy.h" | 18 #include "chrome/browser/net/clear_on_exit_policy.h" |
19 #include "chrome/browser/net/sqlite_persistent_cookie_store.h" | 19 #include "chrome/browser/net/sqlite_persistent_cookie_store.h" |
20 #include "chrome/common/chrome_constants.h" | 20 #include "chrome/common/chrome_constants.h" |
21 #include "content/public/test/test_browser_thread.h" | 21 #include "content/public/test/test_browser_thread.h" |
22 #include "googleurl/src/gurl.h" | 22 #include "googleurl/src/gurl.h" |
23 #include "net/cookies/canonical_cookie.h" | 23 #include "net/cookies/canonical_cookie.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 } | 109 } |
110 | 110 |
111 protected: | 111 protected: |
112 content::TestBrowserThread ui_thread_; | 112 content::TestBrowserThread ui_thread_; |
113 content::TestBrowserThread db_thread_; | 113 content::TestBrowserThread db_thread_; |
114 content::TestBrowserThread io_thread_; | 114 content::TestBrowserThread io_thread_; |
115 base::WaitableEvent loaded_event_; | 115 base::WaitableEvent loaded_event_; |
116 base::WaitableEvent key_loaded_event_; | 116 base::WaitableEvent key_loaded_event_; |
117 base::WaitableEvent db_thread_event_; | 117 base::WaitableEvent db_thread_event_; |
118 CanonicalCookieVector cookies_; | 118 CanonicalCookieVector cookies_; |
119 ScopedTempDir temp_dir_; | 119 base::ScopedTempDir temp_dir_; |
120 scoped_refptr<SQLitePersistentCookieStore> store_; | 120 scoped_refptr<SQLitePersistentCookieStore> store_; |
121 }; | 121 }; |
122 | 122 |
123 TEST_F(SQLitePersistentCookieStoreTest, TestInvalidMetaTableRecovery) { | 123 TEST_F(SQLitePersistentCookieStoreTest, TestInvalidMetaTableRecovery) { |
124 InitializeStore(false); | 124 InitializeStore(false); |
125 AddCookie("A", "B", "foo.bar", "/", base::Time::Now()); | 125 AddCookie("A", "B", "foo.bar", "/", base::Time::Now()); |
126 DestroyStore(); | 126 DestroyStore(); |
127 | 127 |
128 // Load up the store and verify that it has good data in it. | 128 // Load up the store and verify that it has good data in it. |
129 CanonicalCookieVector cookies; | 129 CanonicalCookieVector cookies; |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 cookie_map.find(kSessionName); | 420 cookie_map.find(kSessionName); |
421 ASSERT_TRUE(it != cookie_map.end()); | 421 ASSERT_TRUE(it != cookie_map.end()); |
422 EXPECT_FALSE(cookie_map[kSessionName]->IsPersistent()); | 422 EXPECT_FALSE(cookie_map[kSessionName]->IsPersistent()); |
423 | 423 |
424 it = cookie_map.find(kPersistentName); | 424 it = cookie_map.find(kPersistentName); |
425 ASSERT_TRUE(it != cookie_map.end()); | 425 ASSERT_TRUE(it != cookie_map.end()); |
426 EXPECT_TRUE(cookie_map[kPersistentName]->IsPersistent()); | 426 EXPECT_TRUE(cookie_map[kPersistentName]->IsPersistent()); |
427 | 427 |
428 STLDeleteElements(&cookies); | 428 STLDeleteElements(&cookies); |
429 } | 429 } |
OLD | NEW |