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/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // Make sure the store gets written at least once. | 90 // Make sure the store gets written at least once. |
91 store_->AddServerBoundCert( | 91 store_->AddServerBoundCert( |
92 net::DefaultServerBoundCertStore::ServerBoundCert( | 92 net::DefaultServerBoundCertStore::ServerBoundCert( |
93 "google.com", | 93 "google.com", |
94 net::CLIENT_CERT_RSA_SIGN, | 94 net::CLIENT_CERT_RSA_SIGN, |
95 base::Time::FromInternalValue(1), | 95 base::Time::FromInternalValue(1), |
96 base::Time::FromInternalValue(2), | 96 base::Time::FromInternalValue(2), |
97 "a", "b")); | 97 "a", "b")); |
98 } | 98 } |
99 | 99 |
100 MessageLoopForIO message_loop_; | 100 base::MessageLoopForIO message_loop_; |
101 content::TestBrowserThread db_thread_; | 101 content::TestBrowserThread db_thread_; |
102 content::TestBrowserThread io_thread_; | 102 content::TestBrowserThread io_thread_; |
103 base::ScopedTempDir temp_dir_; | 103 base::ScopedTempDir temp_dir_; |
104 scoped_refptr<SQLiteServerBoundCertStore> store_; | 104 scoped_refptr<SQLiteServerBoundCertStore> store_; |
105 ScopedVector<net::DefaultServerBoundCertStore::ServerBoundCert> certs_; | 105 ScopedVector<net::DefaultServerBoundCertStore::ServerBoundCert> certs_; |
106 }; | 106 }; |
107 | 107 |
108 // Test if data is stored as expected in the SQLite database. | 108 // Test if data is stored as expected in the SQLite database. |
109 TEST_F(SQLiteServerBoundCertStoreTest, TestPersistence) { | 109 TEST_F(SQLiteServerBoundCertStoreTest, TestPersistence) { |
110 store_->AddServerBoundCert( | 110 store_->AddServerBoundCert( |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 sql::Connection db; | 424 sql::Connection db; |
425 ASSERT_TRUE(db.Open(v3_db_path)); | 425 ASSERT_TRUE(db.Open(v3_db_path)); |
426 sql::Statement smt(db.GetUniqueStatement( | 426 sql::Statement smt(db.GetUniqueStatement( |
427 "SELECT value FROM meta WHERE key = \"version\"")); | 427 "SELECT value FROM meta WHERE key = \"version\"")); |
428 ASSERT_TRUE(smt.Step()); | 428 ASSERT_TRUE(smt.Step()); |
429 EXPECT_EQ(4, smt.ColumnInt(0)); | 429 EXPECT_EQ(4, smt.ColumnInt(0)); |
430 EXPECT_FALSE(smt.Step()); | 430 EXPECT_FALSE(smt.Step()); |
431 } | 431 } |
432 } | 432 } |
433 } | 433 } |
OLD | NEW |