| Index: net/sqlite/sqlite_server_bound_cert_store_unittest.cc
|
| diff --git a/chrome/browser/net/sqlite_server_bound_cert_store_unittest.cc b/net/sqlite/sqlite_server_bound_cert_store_unittest.cc
|
| similarity index 94%
|
| rename from chrome/browser/net/sqlite_server_bound_cert_store_unittest.cc
|
| rename to net/sqlite/sqlite_server_bound_cert_store_unittest.cc
|
| index 5afb73de23efa529c79e524964b7ce6e5ed04773..9111ef6c6aaf6c35c90756cc96c3e9a739adabfd 100644
|
| --- a/chrome/browser/net/sqlite_server_bound_cert_store_unittest.cc
|
| +++ b/net/sqlite/sqlite_server_bound_cert_store_unittest.cc
|
| @@ -10,16 +10,19 @@
|
| #include "base/message_loop/message_loop.h"
|
| #include "base/run_loop.h"
|
| #include "base/stl_util.h"
|
| -#include "chrome/browser/net/sqlite_server_bound_cert_store.h"
|
| -#include "chrome/common/chrome_constants.h"
|
| -#include "content/public/test/mock_special_storage_policy.h"
|
| -#include "content/public/test/test_browser_thread_bundle.h"
|
| #include "net/base/test_data_directory.h"
|
| +#include "net/sqlite/special_storage_policy_delegate.h"
|
| +#include "net/sqlite/sqlite_server_bound_cert_store.h"
|
| #include "net/ssl/ssl_client_cert_type.h"
|
| #include "net/test/cert_test_util.h"
|
| #include "sql/statement.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| +namespace net {
|
| +
|
| +const base::FilePath::CharType kTestOBCertFilename[] =
|
| + FILE_PATH_LITERAL("Origin Bound Certs");
|
| +
|
| class SQLiteServerBoundCertStoreTest : public testing::Test {
|
| public:
|
| void Load(
|
| @@ -76,9 +79,9 @@ class SQLiteServerBoundCertStoreTest : public testing::Test {
|
| virtual void SetUp() {
|
| ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
|
| store_ = new SQLiteServerBoundCertStore(
|
| - temp_dir_.path().Append(chrome::kOBCertFilename),
|
| + temp_dir_.path().Append(kTestOBCertFilename),
|
| base::MessageLoopProxy::current(),
|
| - NULL);
|
| + scoped_ptr<SpecialStoragePolicyDelegate>());
|
| ScopedVector<net::DefaultServerBoundCertStore::ServerBoundCert> certs;
|
| Load(&certs);
|
| ASSERT_EQ(0u, certs.size());
|
| @@ -91,7 +94,6 @@ class SQLiteServerBoundCertStoreTest : public testing::Test {
|
| "a", "b"));
|
| }
|
|
|
| - content::TestBrowserThreadBundle thread_bundle_;
|
| base::ScopedTempDir temp_dir_;
|
| scoped_refptr<SQLiteServerBoundCertStore> store_;
|
| ScopedVector<net::DefaultServerBoundCertStore::ServerBoundCert> certs_;
|
| @@ -114,9 +116,9 @@ TEST_F(SQLiteServerBoundCertStoreTest, TestPersistence) {
|
| // Make sure we wait until the destructor has run.
|
| base::RunLoop().RunUntilIdle();
|
| store_ = new SQLiteServerBoundCertStore(
|
| - temp_dir_.path().Append(chrome::kOBCertFilename),
|
| + temp_dir_.path().Append(kTestOBCertFilename),
|
| base::MessageLoopProxy::current(),
|
| - NULL);
|
| + scoped_ptr<SpecialStoragePolicyDelegate>());
|
|
|
| // Reload and test for persistence
|
| Load(&certs);
|
| @@ -149,9 +151,9 @@ TEST_F(SQLiteServerBoundCertStoreTest, TestPersistence) {
|
| base::RunLoop().RunUntilIdle();
|
| certs.clear();
|
| store_ = new SQLiteServerBoundCertStore(
|
| - temp_dir_.path().Append(chrome::kOBCertFilename),
|
| + temp_dir_.path().Append(kTestOBCertFilename),
|
| base::MessageLoopProxy::current(),
|
| - NULL);
|
| + scoped_ptr<SpecialStoragePolicyDelegate>());
|
|
|
| // Reload and check if the cert has been removed.
|
| Load(&certs);
|
| @@ -203,7 +205,8 @@ TEST_F(SQLiteServerBoundCertStoreTest, TestUpgradeV1) {
|
|
|
| ScopedVector<net::DefaultServerBoundCertStore::ServerBoundCert> certs;
|
| store_ = new SQLiteServerBoundCertStore(
|
| - v1_db_path, base::MessageLoopProxy::current(), NULL);
|
| + v1_db_path, base::MessageLoopProxy::current(),
|
| + scoped_ptr<SpecialStoragePolicyDelegate>());
|
|
|
| // Load the database. Because the existing v1 certs are implicitly of type
|
| // RSA, which is unsupported, they're discarded.
|
| @@ -275,7 +278,8 @@ TEST_F(SQLiteServerBoundCertStoreTest, TestUpgradeV2) {
|
|
|
| ScopedVector<net::DefaultServerBoundCertStore::ServerBoundCert> certs;
|
| store_ = new SQLiteServerBoundCertStore(
|
| - v2_db_path, base::MessageLoopProxy::current(), NULL);
|
| + v2_db_path, base::MessageLoopProxy::current(),
|
| + scoped_ptr<SpecialStoragePolicyDelegate>());
|
|
|
| // Load the database and ensure the certs can be read.
|
| Load(&certs);
|
| @@ -361,7 +365,8 @@ TEST_F(SQLiteServerBoundCertStoreTest, TestUpgradeV3) {
|
|
|
| ScopedVector<net::DefaultServerBoundCertStore::ServerBoundCert> certs;
|
| store_ = new SQLiteServerBoundCertStore(
|
| - v3_db_path, base::MessageLoopProxy::current(), NULL);
|
| + v3_db_path, base::MessageLoopProxy::current(),
|
| + scoped_ptr<SpecialStoragePolicyDelegate>());
|
|
|
| // Load the database and ensure the certs can be read.
|
| Load(&certs);
|
| @@ -454,7 +459,8 @@ TEST_F(SQLiteServerBoundCertStoreTest, TestRSADiscarded) {
|
|
|
| ScopedVector<net::DefaultServerBoundCertStore::ServerBoundCert> certs;
|
| store_ = new SQLiteServerBoundCertStore(
|
| - v4_db_path, base::MessageLoopProxy::current(), NULL);
|
| + v4_db_path, base::MessageLoopProxy::current(),
|
| + scoped_ptr<SpecialStoragePolicyDelegate>());
|
|
|
| // Load the database and ensure the certs can be read.
|
| Load(&certs);
|
| @@ -471,3 +477,5 @@ TEST_F(SQLiteServerBoundCertStoreTest, TestRSADiscarded) {
|
| // Make sure we wait until the destructor has run.
|
| base::RunLoop().RunUntilIdle();
|
| }
|
| +
|
| +} // namespace net
|
|
|