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/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
13 #include "chrome/browser/net/sqlite_server_bound_cert_store.h" | 13 #include "chrome/browser/net/sqlite_server_bound_cert_store.h" |
14 #include "chrome/common/chrome_constants.h" | 14 #include "chrome/common/chrome_constants.h" |
| 15 #include "content/public/test/mock_special_storage_policy.h" |
15 #include "content/public/test/test_browser_thread_bundle.h" | 16 #include "content/public/test/test_browser_thread_bundle.h" |
16 #include "net/base/test_data_directory.h" | 17 #include "net/base/test_data_directory.h" |
17 #include "net/ssl/ssl_client_cert_type.h" | 18 #include "net/ssl/ssl_client_cert_type.h" |
18 #include "net/test/cert_test_util.h" | 19 #include "net/test/cert_test_util.h" |
19 #include "sql/statement.h" | 20 #include "sql/statement.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
21 #include "webkit/browser/quota/mock_special_storage_policy.h" | |
22 | 22 |
23 class SQLiteServerBoundCertStoreTest : public testing::Test { | 23 class SQLiteServerBoundCertStoreTest : public testing::Test { |
24 public: | 24 public: |
25 void Load( | 25 void Load( |
26 ScopedVector<net::DefaultServerBoundCertStore::ServerBoundCert>* certs) { | 26 ScopedVector<net::DefaultServerBoundCertStore::ServerBoundCert>* certs) { |
27 base::RunLoop run_loop; | 27 base::RunLoop run_loop; |
28 store_->Load(base::Bind(&SQLiteServerBoundCertStoreTest::OnLoaded, | 28 store_->Load(base::Bind(&SQLiteServerBoundCertStoreTest::OnLoaded, |
29 base::Unretained(this), | 29 base::Unretained(this), |
30 &run_loop)); | 30 &run_loop)); |
31 run_loop.Run(); | 31 run_loop.Run(); |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 ASSERT_EQ("google.com", certs[0]->server_identifier()); | 464 ASSERT_EQ("google.com", certs[0]->server_identifier()); |
465 ASSERT_EQ(GetTestCertExpirationTime(), | 465 ASSERT_EQ(GetTestCertExpirationTime(), |
466 certs[0]->expiration_time()); | 466 certs[0]->expiration_time()); |
467 ASSERT_EQ(key_data, certs[0]->private_key()); | 467 ASSERT_EQ(key_data, certs[0]->private_key()); |
468 ASSERT_EQ(cert_data, certs[0]->cert()); | 468 ASSERT_EQ(cert_data, certs[0]->cert()); |
469 | 469 |
470 store_ = NULL; | 470 store_ = NULL; |
471 // Make sure we wait until the destructor has run. | 471 // Make sure we wait until the destructor has run. |
472 base::RunLoop().RunUntilIdle(); | 472 base::RunLoop().RunUntilIdle(); |
473 } | 473 } |
OLD | NEW |