Index: chrome/browser/net/sqlite_channel_id_store_unittest.cc |
diff --git a/chrome/browser/net/sqlite_server_bound_cert_store_unittest.cc b/chrome/browser/net/sqlite_channel_id_store_unittest.cc |
similarity index 88% |
rename from chrome/browser/net/sqlite_server_bound_cert_store_unittest.cc |
rename to chrome/browser/net/sqlite_channel_id_store_unittest.cc |
index 5afb73de23efa529c79e524964b7ce6e5ed04773..ddf7fc0e9d383a57219162d5e49e1e304c4fad8d 100644 |
--- a/chrome/browser/net/sqlite_server_bound_cert_store_unittest.cc |
+++ b/chrome/browser/net/sqlite_channel_id_store_unittest.cc |
@@ -10,7 +10,7 @@ |
#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/browser/net/sqlite_channel_id_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" |
@@ -20,12 +20,12 @@ |
#include "sql/statement.h" |
#include "testing/gtest/include/gtest/gtest.h" |
-class SQLiteServerBoundCertStoreTest : public testing::Test { |
+class SQLiteChannelIDStoreTest : public testing::Test { |
public: |
void Load( |
- ScopedVector<net::DefaultServerBoundCertStore::ServerBoundCert>* certs) { |
+ ScopedVector<net::DefaultChannelIDStore::ChannelID>* certs) { |
wtc
2014/07/01 19:50:51
certs => channel_ids
Ryan Hamilton
2014/07/21 19:12:07
Done.
|
base::RunLoop run_loop; |
- store_->Load(base::Bind(&SQLiteServerBoundCertStoreTest::OnLoaded, |
+ store_->Load(base::Bind(&SQLiteChannelIDStoreTest::OnLoaded, |
base::Unretained(this), |
&run_loop)); |
run_loop.Run(); |
@@ -36,7 +36,7 @@ class SQLiteServerBoundCertStoreTest : public testing::Test { |
void OnLoaded( |
base::RunLoop* run_loop, |
scoped_ptr<ScopedVector< |
- net::DefaultServerBoundCertStore::ServerBoundCert> > certs) { |
+ net::DefaultChannelIDStore::ChannelID> > certs) { |
wtc
2014/07/01 19:50:51
certs => channel_ids
Ryan Hamilton
2014/07/21 19:12:07
Done.
|
certs_.swap(*certs); |
run_loop->Quit(); |
} |
@@ -75,16 +75,16 @@ class SQLiteServerBoundCertStoreTest : public testing::Test { |
virtual void SetUp() { |
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
- store_ = new SQLiteServerBoundCertStore( |
+ store_ = new SQLiteChannelIDStore( |
temp_dir_.path().Append(chrome::kOBCertFilename), |
base::MessageLoopProxy::current(), |
NULL); |
- ScopedVector<net::DefaultServerBoundCertStore::ServerBoundCert> certs; |
+ ScopedVector<net::DefaultChannelIDStore::ChannelID> certs; |
Load(&certs); |
ASSERT_EQ(0u, certs.size()); |
// Make sure the store gets written at least once. |
- store_->AddServerBoundCert( |
- net::DefaultServerBoundCertStore::ServerBoundCert( |
+ store_->AddChannelID( |
+ net::DefaultChannelIDStore::ChannelID( |
"google.com", |
base::Time::FromInternalValue(1), |
base::Time::FromInternalValue(2), |
@@ -93,27 +93,27 @@ class SQLiteServerBoundCertStoreTest : public testing::Test { |
content::TestBrowserThreadBundle thread_bundle_; |
base::ScopedTempDir temp_dir_; |
- scoped_refptr<SQLiteServerBoundCertStore> store_; |
- ScopedVector<net::DefaultServerBoundCertStore::ServerBoundCert> certs_; |
+ scoped_refptr<SQLiteChannelIDStore> store_; |
+ ScopedVector<net::DefaultChannelIDStore::ChannelID> certs_; |
wtc
2014/07/01 19:50:51
certs_ => channel_ids_
Ryan Hamilton
2014/07/21 19:12:07
Done.
|
}; |
// Test if data is stored as expected in the SQLite database. |
-TEST_F(SQLiteServerBoundCertStoreTest, TestPersistence) { |
- store_->AddServerBoundCert( |
- net::DefaultServerBoundCertStore::ServerBoundCert( |
+TEST_F(SQLiteChannelIDStoreTest, TestPersistence) { |
+ store_->AddChannelID( |
+ net::DefaultChannelIDStore::ChannelID( |
"foo.com", |
base::Time::FromInternalValue(3), |
base::Time::FromInternalValue(4), |
"c", "d")); |
- ScopedVector<net::DefaultServerBoundCertStore::ServerBoundCert> certs; |
+ ScopedVector<net::DefaultChannelIDStore::ChannelID> certs; |
wtc
2014/07/01 19:50:51
certs => channel_ids
Ryan Hamilton
2014/07/21 19:12:07
Done.
|
// Replace the store effectively destroying the current one and forcing it |
// to write its data to disk. Then we can see if after loading it again it |
// is still there. |
store_ = NULL; |
// Make sure we wait until the destructor has run. |
base::RunLoop().RunUntilIdle(); |
- store_ = new SQLiteServerBoundCertStore( |
+ store_ = new SQLiteChannelIDStore( |
temp_dir_.path().Append(chrome::kOBCertFilename), |
base::MessageLoopProxy::current(), |
NULL); |
@@ -121,8 +121,8 @@ TEST_F(SQLiteServerBoundCertStoreTest, TestPersistence) { |
// Reload and test for persistence |
Load(&certs); |
ASSERT_EQ(2U, certs.size()); |
- net::DefaultServerBoundCertStore::ServerBoundCert* goog_cert; |
- net::DefaultServerBoundCertStore::ServerBoundCert* foo_cert; |
+ net::DefaultChannelIDStore::ChannelID* goog_cert; |
+ net::DefaultChannelIDStore::ChannelID* foo_cert; |
wtc
2014/07/01 19:50:51
goog_cert => goog_channel_id
foo_cert => foo_chann
Ryan Hamilton
2014/07/21 19:12:07
Done.
|
if (certs[0]->server_identifier() == "google.com") { |
goog_cert = certs[0]; |
foo_cert = certs[1]; |
@@ -142,13 +142,13 @@ TEST_F(SQLiteServerBoundCertStoreTest, TestPersistence) { |
ASSERT_EQ(4, foo_cert->expiration_time().ToInternalValue()); |
// Now delete the cert and check persistence again. |
- store_->DeleteServerBoundCert(*certs[0]); |
- store_->DeleteServerBoundCert(*certs[1]); |
+ store_->DeleteChannelID(*certs[0]); |
+ store_->DeleteChannelID(*certs[1]); |
store_ = NULL; |
// Make sure we wait until the destructor has run. |
base::RunLoop().RunUntilIdle(); |
certs.clear(); |
- store_ = new SQLiteServerBoundCertStore( |
+ store_ = new SQLiteChannelIDStore( |
temp_dir_.path().Append(chrome::kOBCertFilename), |
base::MessageLoopProxy::current(), |
NULL); |
@@ -158,7 +158,7 @@ TEST_F(SQLiteServerBoundCertStoreTest, TestPersistence) { |
ASSERT_EQ(0U, certs.size()); |
} |
-TEST_F(SQLiteServerBoundCertStoreTest, TestUpgradeV1) { |
+TEST_F(SQLiteChannelIDStoreTest, TestUpgradeV1) { |
// Reset the store. We'll be using a different database for this test. |
store_ = NULL; |
@@ -201,8 +201,8 @@ TEST_F(SQLiteServerBoundCertStoreTest, TestUpgradeV1) { |
for (int i = 0; i < 2; ++i) { |
SCOPED_TRACE(i); |
- ScopedVector<net::DefaultServerBoundCertStore::ServerBoundCert> certs; |
- store_ = new SQLiteServerBoundCertStore( |
+ ScopedVector<net::DefaultChannelIDStore::ChannelID> certs; |
wtc
2014/07/01 19:50:51
certs => channel_ids
Also fix lines 276,362, 455.
Ryan Hamilton
2014/07/21 19:12:07
Done.
|
+ store_ = new SQLiteChannelIDStore( |
v1_db_path, base::MessageLoopProxy::current(), NULL); |
// Load the database. Because the existing v1 certs are implicitly of type |
@@ -226,7 +226,7 @@ TEST_F(SQLiteServerBoundCertStoreTest, TestUpgradeV1) { |
} |
} |
-TEST_F(SQLiteServerBoundCertStoreTest, TestUpgradeV2) { |
+TEST_F(SQLiteChannelIDStoreTest, TestUpgradeV2) { |
// Reset the store. We'll be using a different database for this test. |
store_ = NULL; |
@@ -273,8 +273,8 @@ TEST_F(SQLiteServerBoundCertStoreTest, TestUpgradeV2) { |
for (int i = 0; i < 2; ++i) { |
SCOPED_TRACE(i); |
- ScopedVector<net::DefaultServerBoundCertStore::ServerBoundCert> certs; |
- store_ = new SQLiteServerBoundCertStore( |
+ ScopedVector<net::DefaultChannelIDStore::ChannelID> certs; |
+ store_ = new SQLiteChannelIDStore( |
v2_db_path, base::MessageLoopProxy::current(), NULL); |
// Load the database and ensure the certs can be read. |
@@ -310,7 +310,7 @@ TEST_F(SQLiteServerBoundCertStoreTest, TestUpgradeV2) { |
} |
} |
-TEST_F(SQLiteServerBoundCertStoreTest, TestUpgradeV3) { |
+TEST_F(SQLiteChannelIDStoreTest, TestUpgradeV3) { |
// Reset the store. We'll be using a different database for this test. |
store_ = NULL; |
@@ -359,8 +359,8 @@ TEST_F(SQLiteServerBoundCertStoreTest, TestUpgradeV3) { |
for (int i = 0; i < 2; ++i) { |
SCOPED_TRACE(i); |
- ScopedVector<net::DefaultServerBoundCertStore::ServerBoundCert> certs; |
- store_ = new SQLiteServerBoundCertStore( |
+ ScopedVector<net::DefaultChannelIDStore::ChannelID> certs; |
+ store_ = new SQLiteChannelIDStore( |
v3_db_path, base::MessageLoopProxy::current(), NULL); |
// Load the database and ensure the certs can be read. |
@@ -398,7 +398,7 @@ TEST_F(SQLiteServerBoundCertStoreTest, TestUpgradeV3) { |
} |
} |
-TEST_F(SQLiteServerBoundCertStoreTest, TestRSADiscarded) { |
+TEST_F(SQLiteChannelIDStoreTest, TestRSADiscarded) { |
// Reset the store. We'll be using a different database for this test. |
store_ = NULL; |
@@ -452,8 +452,8 @@ TEST_F(SQLiteServerBoundCertStoreTest, TestRSADiscarded) { |
ASSERT_TRUE(add_smt.Run()); |
} |
- ScopedVector<net::DefaultServerBoundCertStore::ServerBoundCert> certs; |
- store_ = new SQLiteServerBoundCertStore( |
+ ScopedVector<net::DefaultChannelIDStore::ChannelID> certs; |
+ store_ = new SQLiteChannelIDStore( |
v4_db_path, base::MessageLoopProxy::current(), NULL); |
// Load the database and ensure the certs can be read. |