OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/scoped_temp_dir.h" | 9 #include "base/scoped_temp_dir.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
11 #include "base/test/thread_test_helper.h" | 11 #include "base/test/thread_test_helper.h" |
12 #include "chrome/browser/net/sqlite_origin_bound_cert_store.h" | 12 #include "chrome/browser/net/sqlite_origin_bound_cert_store.h" |
13 #include "chrome/common/chrome_constants.h" | 13 #include "chrome/common/chrome_constants.h" |
14 #include "content/test/test_browser_thread.h" | 14 #include "content/test/test_browser_thread.h" |
| 15 #include "net/base/cert_test_util.h" |
15 #include "sql/statement.h" | 16 #include "sql/statement.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
17 | 18 |
18 using content::BrowserThread; | 19 using content::BrowserThread; |
19 | 20 |
20 class SQLiteOriginBoundCertStoreTest : public testing::Test { | 21 class SQLiteOriginBoundCertStoreTest : public testing::Test { |
21 public: | 22 public: |
22 SQLiteOriginBoundCertStoreTest() | 23 SQLiteOriginBoundCertStoreTest() |
23 : db_thread_(BrowserThread::DB) { | 24 : db_thread_(BrowserThread::DB) { |
24 } | 25 } |
25 | 26 |
26 protected: | 27 protected: |
| 28 static void ReadTestKeyAndCert(std::string* key, std::string* cert) { |
| 29 FilePath key_path = net::GetTestCertsDirectory().AppendASCII( |
| 30 "unittest.originbound.key.der"); |
| 31 FilePath cert_path = net::GetTestCertsDirectory().AppendASCII( |
| 32 "unittest.originbound.der"); |
| 33 ASSERT_TRUE(file_util::ReadFileToString(key_path, key)); |
| 34 ASSERT_TRUE(file_util::ReadFileToString(cert_path, cert)); |
| 35 } |
| 36 |
| 37 static base::Time GetTestCertExpirationTime() { |
| 38 // Cert expiration time from 'dumpasn1 unittest.originbound.der': |
| 39 // GeneralizedTime 19/11/2111 02:23:45 GMT |
| 40 base::Time::Exploded exploded_time; |
| 41 exploded_time.year = 2111; |
| 42 exploded_time.month = 11; |
| 43 exploded_time.day_of_week = 0; // Unused. |
| 44 exploded_time.day_of_month = 19; |
| 45 exploded_time.hour = 2; |
| 46 exploded_time.minute = 23; |
| 47 exploded_time.second = 45; |
| 48 exploded_time.millisecond = 0; |
| 49 return base::Time::FromUTCExploded(exploded_time); |
| 50 } |
| 51 |
27 virtual void SetUp() { | 52 virtual void SetUp() { |
28 db_thread_.Start(); | 53 db_thread_.Start(); |
29 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 54 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
30 store_ = new SQLiteOriginBoundCertStore( | 55 store_ = new SQLiteOriginBoundCertStore( |
31 temp_dir_.path().Append(chrome::kOBCertFilename)); | 56 temp_dir_.path().Append(chrome::kOBCertFilename)); |
32 std::vector<net::DefaultOriginBoundCertStore::OriginBoundCert*> certs; | 57 std::vector<net::DefaultOriginBoundCertStore::OriginBoundCert*> certs; |
33 ASSERT_TRUE(store_->Load(&certs)); | 58 ASSERT_TRUE(store_->Load(&certs)); |
34 ASSERT_EQ(0u, certs.size()); | 59 ASSERT_EQ(0u, certs.size()); |
35 // Make sure the store gets written at least once. | 60 // Make sure the store gets written at least once. |
36 store_->AddOriginBoundCert( | 61 store_->AddOriginBoundCert( |
37 net::DefaultOriginBoundCertStore::OriginBoundCert( | 62 net::DefaultOriginBoundCertStore::OriginBoundCert( |
38 "https://encrypted.google.com:8443", | 63 "https://encrypted.google.com:8443", |
39 net::CLIENT_CERT_RSA_SIGN, "a", "b")); | 64 net::CLIENT_CERT_RSA_SIGN, |
| 65 base::Time(), |
| 66 "a", "b")); |
40 } | 67 } |
41 | 68 |
42 content::TestBrowserThread db_thread_; | 69 content::TestBrowserThread db_thread_; |
43 ScopedTempDir temp_dir_; | 70 ScopedTempDir temp_dir_; |
44 scoped_refptr<SQLiteOriginBoundCertStore> store_; | 71 scoped_refptr<SQLiteOriginBoundCertStore> store_; |
45 }; | 72 }; |
46 | 73 |
47 TEST_F(SQLiteOriginBoundCertStoreTest, KeepOnDestruction) { | 74 TEST_F(SQLiteOriginBoundCertStoreTest, KeepOnDestruction) { |
48 store_->SetClearLocalStateOnExit(false); | 75 store_->SetClearLocalStateOnExit(false); |
49 store_ = NULL; | 76 store_ = NULL; |
(...skipping 22 matching lines...) Expand all Loading... |
72 ASSERT_TRUE(helper->Run()); | 99 ASSERT_TRUE(helper->Run()); |
73 | 100 |
74 ASSERT_FALSE(file_util::PathExists( | 101 ASSERT_FALSE(file_util::PathExists( |
75 temp_dir_.path().Append(chrome::kOBCertFilename))); | 102 temp_dir_.path().Append(chrome::kOBCertFilename))); |
76 } | 103 } |
77 | 104 |
78 // Test if data is stored as expected in the SQLite database. | 105 // Test if data is stored as expected in the SQLite database. |
79 TEST_F(SQLiteOriginBoundCertStoreTest, TestPersistence) { | 106 TEST_F(SQLiteOriginBoundCertStoreTest, TestPersistence) { |
80 store_->AddOriginBoundCert( | 107 store_->AddOriginBoundCert( |
81 net::DefaultOriginBoundCertStore::OriginBoundCert( | 108 net::DefaultOriginBoundCertStore::OriginBoundCert( |
82 "https://www.google.com/", net::CLIENT_CERT_ECDSA_SIGN, "c", "d")); | 109 "https://www.google.com/", |
| 110 net::CLIENT_CERT_ECDSA_SIGN, |
| 111 base::Time(), |
| 112 "c", "d")); |
83 | 113 |
84 std::vector<net::DefaultOriginBoundCertStore::OriginBoundCert*> certs; | 114 std::vector<net::DefaultOriginBoundCertStore::OriginBoundCert*> certs; |
85 // Replace the store effectively destroying the current one and forcing it | 115 // Replace the store effectively destroying the current one and forcing it |
86 // to write it's data to disk. Then we can see if after loading it again it | 116 // to write it's data to disk. Then we can see if after loading it again it |
87 // is still there. | 117 // is still there. |
88 store_ = NULL; | 118 store_ = NULL; |
89 scoped_refptr<base::ThreadTestHelper> helper( | 119 scoped_refptr<base::ThreadTestHelper> helper( |
90 new base::ThreadTestHelper( | 120 new base::ThreadTestHelper( |
91 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB))); | 121 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB))); |
92 // Make sure we wait until the destructor has run. | 122 // Make sure we wait until the destructor has run. |
(...skipping 21 matching lines...) Expand all Loading... |
114 ASSERT_EQ(net::CLIENT_CERT_ECDSA_SIGN, ec_cert->type()); | 144 ASSERT_EQ(net::CLIENT_CERT_ECDSA_SIGN, ec_cert->type()); |
115 ASSERT_STREQ("c", ec_cert->private_key().c_str()); | 145 ASSERT_STREQ("c", ec_cert->private_key().c_str()); |
116 ASSERT_STREQ("d", ec_cert->cert().c_str()); | 146 ASSERT_STREQ("d", ec_cert->cert().c_str()); |
117 | 147 |
118 // Now delete the cert and check persistence again. | 148 // Now delete the cert and check persistence again. |
119 store_->DeleteOriginBoundCert(*certs[0]); | 149 store_->DeleteOriginBoundCert(*certs[0]); |
120 store_->DeleteOriginBoundCert(*certs[1]); | 150 store_->DeleteOriginBoundCert(*certs[1]); |
121 store_ = NULL; | 151 store_ = NULL; |
122 // Make sure we wait until the destructor has run. | 152 // Make sure we wait until the destructor has run. |
123 ASSERT_TRUE(helper->Run()); | 153 ASSERT_TRUE(helper->Run()); |
124 STLDeleteContainerPointers(certs.begin(), certs.end()); | 154 STLDeleteElements(&certs); |
125 certs.clear(); | |
126 store_ = new SQLiteOriginBoundCertStore( | 155 store_ = new SQLiteOriginBoundCertStore( |
127 temp_dir_.path().Append(chrome::kOBCertFilename)); | 156 temp_dir_.path().Append(chrome::kOBCertFilename)); |
128 | 157 |
129 // Reload and check if the cert has been removed. | 158 // Reload and check if the cert has been removed. |
130 ASSERT_TRUE(store_->Load(&certs)); | 159 ASSERT_TRUE(store_->Load(&certs)); |
131 ASSERT_EQ(0U, certs.size()); | 160 ASSERT_EQ(0U, certs.size()); |
132 } | 161 } |
133 | 162 |
134 TEST_F(SQLiteOriginBoundCertStoreTest, TestUpgrade) { | 163 TEST_F(SQLiteOriginBoundCertStoreTest, TestUpgradeV1) { |
135 // Reset the store. We'll be using a different database for this test. | 164 // Reset the store. We'll be using a different database for this test. |
136 store_ = NULL; | 165 store_ = NULL; |
137 | 166 |
138 FilePath v1_db_path(temp_dir_.path().AppendASCII("v1db")); | 167 FilePath v1_db_path(temp_dir_.path().AppendASCII("v1db")); |
139 | 168 |
| 169 std::string key_data; |
| 170 std::string cert_data; |
| 171 ReadTestKeyAndCert(&key_data, &cert_data); |
| 172 |
140 // Create a version 1 database. | 173 // Create a version 1 database. |
141 { | 174 { |
142 sql::Connection db; | 175 sql::Connection db; |
143 ASSERT_TRUE(db.Open(v1_db_path)); | 176 ASSERT_TRUE(db.Open(v1_db_path)); |
144 ASSERT_TRUE(db.Execute( | 177 ASSERT_TRUE(db.Execute( |
145 "CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY," | 178 "CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY," |
146 "value LONGVARCHAR);" | 179 "value LONGVARCHAR);" |
147 "INSERT INTO \"meta\" VALUES('version','1');" | 180 "INSERT INTO \"meta\" VALUES('version','1');" |
148 "INSERT INTO \"meta\" VALUES('last_compatible_version','1');" | 181 "INSERT INTO \"meta\" VALUES('last_compatible_version','1');" |
149 "CREATE TABLE origin_bound_certs (" | 182 "CREATE TABLE origin_bound_certs (" |
150 "origin TEXT NOT NULL UNIQUE PRIMARY KEY," | 183 "origin TEXT NOT NULL UNIQUE PRIMARY KEY," |
151 "private_key BLOB NOT NULL,cert BLOB NOT NULL);" | 184 "private_key BLOB NOT NULL,cert BLOB NOT NULL);")); |
| 185 |
| 186 sql::Statement add_smt(db.GetUniqueStatement( |
| 187 "INSERT INTO origin_bound_certs (origin, private_key, cert) " |
| 188 "VALUES (?,?,?)")); |
| 189 add_smt.BindString(0, "https://www.google.com:443"); |
| 190 add_smt.BindBlob(1, key_data.data(), key_data.size()); |
| 191 add_smt.BindBlob(2, cert_data.data(), cert_data.size()); |
| 192 ASSERT_TRUE(add_smt.Run()); |
| 193 |
| 194 ASSERT_TRUE(db.Execute( |
152 "INSERT INTO \"origin_bound_certs\" VALUES(" | 195 "INSERT INTO \"origin_bound_certs\" VALUES(" |
153 "'https://google.com',X'AA',X'BB');" | 196 "'https://foo.com',X'AA',X'BB');" |
154 "INSERT INTO \"origin_bound_certs\" VALUES(" | |
155 "'https://foo.com',X'CC',X'DD');" | |
156 )); | 197 )); |
157 } | 198 } |
158 | 199 |
159 std::vector<net::DefaultOriginBoundCertStore::OriginBoundCert*> certs; | 200 // Load and test the DB contents twice. First time ensures that we can use |
160 store_ = new SQLiteOriginBoundCertStore(v1_db_path); | 201 // the updated values immediately. Second time ensures that the updated |
| 202 // values are stored and read correctly on next load. |
| 203 for (int i = 0; i < 2; ++i) { |
| 204 SCOPED_TRACE(i); |
161 | 205 |
162 // Load the database and ensure the certs can be read and are marked as RSA. | 206 std::vector<net::DefaultOriginBoundCertStore::OriginBoundCert*> certs; |
163 ASSERT_TRUE(store_->Load(&certs)); | 207 store_ = new SQLiteOriginBoundCertStore(v1_db_path); |
164 ASSERT_EQ(2U, certs.size()); | |
165 ASSERT_STREQ("https://google.com", certs[0]->origin().c_str()); | |
166 ASSERT_EQ(net::CLIENT_CERT_RSA_SIGN, certs[0]->type()); | |
167 ASSERT_STREQ("\xaa", certs[0]->private_key().c_str()); | |
168 ASSERT_STREQ("\xbb", certs[0]->cert().c_str()); | |
169 ASSERT_STREQ("https://foo.com", certs[1]->origin().c_str()); | |
170 ASSERT_EQ(net::CLIENT_CERT_RSA_SIGN, certs[1]->type()); | |
171 ASSERT_STREQ("\xcc", certs[1]->private_key().c_str()); | |
172 ASSERT_STREQ("\xdd", certs[1]->cert().c_str()); | |
173 | 208 |
174 STLDeleteContainerPointers(certs.begin(), certs.end()); | 209 // Load the database and ensure the certs can be read and are marked as RSA. |
175 certs.clear(); | 210 ASSERT_TRUE(store_->Load(&certs)); |
| 211 ASSERT_EQ(2U, certs.size()); |
176 | 212 |
177 store_ = NULL; | 213 ASSERT_STREQ("https://www.google.com:443", certs[0]->origin().c_str()); |
178 // Make sure we wait until the destructor has run. | 214 ASSERT_EQ(net::CLIENT_CERT_RSA_SIGN, certs[0]->type()); |
179 scoped_refptr<base::ThreadTestHelper> helper( | 215 ASSERT_EQ(GetTestCertExpirationTime(), |
180 new base::ThreadTestHelper( | 216 certs[0]->expiration_time()); |
181 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB))); | 217 ASSERT_EQ(key_data, certs[0]->private_key()); |
182 ASSERT_TRUE(helper->Run()); | 218 ASSERT_EQ(cert_data, certs[0]->cert()); |
183 | 219 |
184 // Verify the database version is updated. | 220 ASSERT_STREQ("https://foo.com", certs[1]->origin().c_str()); |
185 { | 221 ASSERT_EQ(net::CLIENT_CERT_RSA_SIGN, certs[1]->type()); |
186 sql::Connection db; | 222 // Undecodable cert, expiration time will be uninitialized. |
187 ASSERT_TRUE(db.Open(v1_db_path)); | 223 ASSERT_EQ(base::Time(), certs[1]->expiration_time()); |
188 sql::Statement smt(db.GetUniqueStatement( | 224 ASSERT_STREQ("\xaa", certs[1]->private_key().c_str()); |
189 "SELECT value FROM meta WHERE key = \"version\"")); | 225 ASSERT_STREQ("\xbb", certs[1]->cert().c_str()); |
190 ASSERT_TRUE(smt); | 226 |
191 ASSERT_TRUE(smt.Step()); | 227 STLDeleteElements(&certs); |
192 EXPECT_EQ(2, smt.ColumnInt(0)); | 228 |
193 EXPECT_FALSE(smt.Step()); | 229 store_ = NULL; |
| 230 // Make sure we wait until the destructor has run. |
| 231 scoped_refptr<base::ThreadTestHelper> helper( |
| 232 new base::ThreadTestHelper( |
| 233 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB))); |
| 234 ASSERT_TRUE(helper->Run()); |
| 235 |
| 236 // Verify the database version is updated. |
| 237 { |
| 238 sql::Connection db; |
| 239 ASSERT_TRUE(db.Open(v1_db_path)); |
| 240 sql::Statement smt(db.GetUniqueStatement( |
| 241 "SELECT value FROM meta WHERE key = \"version\"")); |
| 242 ASSERT_TRUE(smt); |
| 243 ASSERT_TRUE(smt.Step()); |
| 244 EXPECT_EQ(3, smt.ColumnInt(0)); |
| 245 EXPECT_FALSE(smt.Step()); |
| 246 } |
194 } | 247 } |
195 } | 248 } |
196 | 249 |
| 250 TEST_F(SQLiteOriginBoundCertStoreTest, TestUpgradeV2) { |
| 251 // Reset the store. We'll be using a different database for this test. |
| 252 store_ = NULL; |
| 253 |
| 254 FilePath v2_db_path(temp_dir_.path().AppendASCII("v2db")); |
| 255 |
| 256 std::string key_data; |
| 257 std::string cert_data; |
| 258 ReadTestKeyAndCert(&key_data, &cert_data); |
| 259 |
| 260 // Create a version 2 database. |
| 261 { |
| 262 sql::Connection db; |
| 263 ASSERT_TRUE(db.Open(v2_db_path)); |
| 264 ASSERT_TRUE(db.Execute( |
| 265 "CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY," |
| 266 "value LONGVARCHAR);" |
| 267 "INSERT INTO \"meta\" VALUES('version','2');" |
| 268 "INSERT INTO \"meta\" VALUES('last_compatible_version','1');" |
| 269 "CREATE TABLE origin_bound_certs (" |
| 270 "origin TEXT NOT NULL UNIQUE PRIMARY KEY," |
| 271 "private_key BLOB NOT NULL," |
| 272 "cert BLOB NOT NULL," |
| 273 "cert_type INTEGER);" |
| 274 )); |
| 275 |
| 276 sql::Statement add_smt(db.GetUniqueStatement( |
| 277 "INSERT INTO origin_bound_certs (origin, private_key, cert, cert_type) " |
| 278 "VALUES (?,?,?,?)")); |
| 279 add_smt.BindString(0, "https://www.google.com:443"); |
| 280 add_smt.BindBlob(1, key_data.data(), key_data.size()); |
| 281 add_smt.BindBlob(2, cert_data.data(), cert_data.size()); |
| 282 add_smt.BindInt64(3, 1); |
| 283 ASSERT_TRUE(add_smt.Run()); |
| 284 |
| 285 ASSERT_TRUE(db.Execute( |
| 286 "INSERT INTO \"origin_bound_certs\" VALUES(" |
| 287 "'https://foo.com',X'AA',X'BB',64);" |
| 288 )); |
| 289 } |
| 290 |
| 291 // Load and test the DB contents twice. First time ensures that we can use |
| 292 // the updated values immediately. Second time ensures that the updated |
| 293 // values are saved and read correctly on next load. |
| 294 for (int i = 0; i < 2; ++i) { |
| 295 SCOPED_TRACE(i); |
| 296 |
| 297 std::vector<net::DefaultOriginBoundCertStore::OriginBoundCert*> certs; |
| 298 store_ = new SQLiteOriginBoundCertStore(v2_db_path); |
| 299 |
| 300 // Load the database and ensure the certs can be read and are marked as RSA. |
| 301 ASSERT_TRUE(store_->Load(&certs)); |
| 302 ASSERT_EQ(2U, certs.size()); |
| 303 |
| 304 ASSERT_STREQ("https://www.google.com:443", certs[0]->origin().c_str()); |
| 305 ASSERT_EQ(net::CLIENT_CERT_RSA_SIGN, certs[0]->type()); |
| 306 ASSERT_EQ(GetTestCertExpirationTime(), |
| 307 certs[0]->expiration_time()); |
| 308 ASSERT_EQ(key_data, certs[0]->private_key()); |
| 309 ASSERT_EQ(cert_data, certs[0]->cert()); |
| 310 |
| 311 ASSERT_STREQ("https://foo.com", certs[1]->origin().c_str()); |
| 312 ASSERT_EQ(net::CLIENT_CERT_ECDSA_SIGN, certs[1]->type()); |
| 313 // Undecodable cert, expiration time will be uninitialized. |
| 314 ASSERT_EQ(base::Time(), certs[1]->expiration_time()); |
| 315 ASSERT_STREQ("\xaa", certs[1]->private_key().c_str()); |
| 316 ASSERT_STREQ("\xbb", certs[1]->cert().c_str()); |
| 317 |
| 318 STLDeleteElements(&certs); |
| 319 |
| 320 store_ = NULL; |
| 321 // Make sure we wait until the destructor has run. |
| 322 scoped_refptr<base::ThreadTestHelper> helper( |
| 323 new base::ThreadTestHelper( |
| 324 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB))); |
| 325 ASSERT_TRUE(helper->Run()); |
| 326 |
| 327 // Verify the database version is updated. |
| 328 { |
| 329 sql::Connection db; |
| 330 ASSERT_TRUE(db.Open(v2_db_path)); |
| 331 sql::Statement smt(db.GetUniqueStatement( |
| 332 "SELECT value FROM meta WHERE key = \"version\"")); |
| 333 ASSERT_TRUE(smt); |
| 334 ASSERT_TRUE(smt.Step()); |
| 335 EXPECT_EQ(3, smt.ColumnInt(0)); |
| 336 EXPECT_FALSE(smt.Step()); |
| 337 } |
| 338 } |
| 339 } |
| 340 |
197 // Test that we can force the database to be written by calling Flush(). | 341 // Test that we can force the database to be written by calling Flush(). |
198 TEST_F(SQLiteOriginBoundCertStoreTest, TestFlush) { | 342 TEST_F(SQLiteOriginBoundCertStoreTest, TestFlush) { |
199 // File timestamps don't work well on all platforms, so we'll determine | 343 // File timestamps don't work well on all platforms, so we'll determine |
200 // whether the DB file has been modified by checking its size. | 344 // whether the DB file has been modified by checking its size. |
201 FilePath path = temp_dir_.path().Append(chrome::kOBCertFilename); | 345 FilePath path = temp_dir_.path().Append(chrome::kOBCertFilename); |
202 base::PlatformFileInfo info; | 346 base::PlatformFileInfo info; |
203 ASSERT_TRUE(file_util::GetFileInfo(path, &info)); | 347 ASSERT_TRUE(file_util::GetFileInfo(path, &info)); |
204 int64 base_size = info.size; | 348 int64 base_size = info.size; |
205 | 349 |
206 // Write some certs, so the DB will have to expand by several KB. | 350 // Write some certs, so the DB will have to expand by several KB. |
207 for (char c = 'a'; c < 'z'; ++c) { | 351 for (char c = 'a'; c < 'z'; ++c) { |
208 std::string origin(1, c); | 352 std::string origin(1, c); |
209 std::string private_key(1000, c); | 353 std::string private_key(1000, c); |
210 std::string cert(1000, c); | 354 std::string cert(1000, c); |
211 store_->AddOriginBoundCert( | 355 store_->AddOriginBoundCert( |
212 net::DefaultOriginBoundCertStore::OriginBoundCert( | 356 net::DefaultOriginBoundCertStore::OriginBoundCert( |
213 origin, | 357 origin, |
214 net::CLIENT_CERT_RSA_SIGN, | 358 net::CLIENT_CERT_RSA_SIGN, |
| 359 base::Time(), |
215 private_key, | 360 private_key, |
216 cert)); | 361 cert)); |
217 } | 362 } |
218 | 363 |
219 // Call Flush() and wait until the DB thread is idle. | 364 // Call Flush() and wait until the DB thread is idle. |
220 store_->Flush(base::Closure()); | 365 store_->Flush(base::Closure()); |
221 scoped_refptr<base::ThreadTestHelper> helper( | 366 scoped_refptr<base::ThreadTestHelper> helper( |
222 new base::ThreadTestHelper( | 367 new base::ThreadTestHelper( |
223 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB))); | 368 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB))); |
224 ASSERT_TRUE(helper->Run()); | 369 ASSERT_TRUE(helper->Run()); |
(...skipping 30 matching lines...) Expand all Loading... |
255 | 400 |
256 store_->Flush(base::Bind(&CallbackCounter::Callback, counter.get())); | 401 store_->Flush(base::Bind(&CallbackCounter::Callback, counter.get())); |
257 | 402 |
258 scoped_refptr<base::ThreadTestHelper> helper( | 403 scoped_refptr<base::ThreadTestHelper> helper( |
259 new base::ThreadTestHelper( | 404 new base::ThreadTestHelper( |
260 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB))); | 405 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB))); |
261 ASSERT_TRUE(helper->Run()); | 406 ASSERT_TRUE(helper->Run()); |
262 | 407 |
263 ASSERT_EQ(1, counter->callback_count()); | 408 ASSERT_EQ(1, counter->callback_count()); |
264 } | 409 } |
OLD | NEW |