Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Unified Diff: net/extras/sqlite/sqlite_channel_id_store_unittest.cc

Issue 1476263004: Remove ScopedVector from IDStores (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/extras/sqlite/sqlite_channel_id_store_unittest.cc
diff --git a/net/extras/sqlite/sqlite_channel_id_store_unittest.cc b/net/extras/sqlite/sqlite_channel_id_store_unittest.cc
index 017bebc122271855a05a13b208448ebe97a6dabb..59682d141e11551da9bef5bdd8a96cfb3a34d9d2 100644
--- a/net/extras/sqlite/sqlite_channel_id_store_unittest.cc
+++ b/net/extras/sqlite/sqlite_channel_id_store_unittest.cc
@@ -6,7 +6,6 @@
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_vector.h"
#include "base/run_loop.h"
#include "base/thread_task_runner_handle.h"
#include "crypto/ec_private_key.h"
@@ -27,7 +26,8 @@ const base::FilePath::CharType kTestChannelIDFilename[] =
class SQLiteChannelIDStoreTest : public testing::Test {
public:
- void Load(ScopedVector<DefaultChannelIDStore::ChannelID>* channel_ids) {
+ void Load(
+ std::vector<scoped_ptr<DefaultChannelIDStore::ChannelID>>* channel_ids) {
mmenke 2015/11/30 20:33:16 include vector, scoped_ptr
base::RunLoop run_loop;
store_->Load(base::Bind(&SQLiteChannelIDStoreTest::OnLoaded,
base::Unretained(this),
@@ -39,7 +39,8 @@ class SQLiteChannelIDStoreTest : public testing::Test {
void OnLoaded(
base::RunLoop* run_loop,
- scoped_ptr<ScopedVector<DefaultChannelIDStore::ChannelID> > channel_ids) {
+ scoped_ptr<std::vector<scoped_ptr<DefaultChannelIDStore::ChannelID>>>
+ channel_ids) {
channel_ids_.swap(*channel_ids);
run_loop->Quit();
}
@@ -101,7 +102,7 @@ class SQLiteChannelIDStoreTest : public testing::Test {
store_ = new SQLiteChannelIDStore(
temp_dir_.path().Append(kTestChannelIDFilename),
base::ThreadTaskRunnerHandle::Get());
- ScopedVector<DefaultChannelIDStore::ChannelID> channel_ids;
+ std::vector<scoped_ptr<DefaultChannelIDStore::ChannelID>> channel_ids;
Load(&channel_ids);
ASSERT_EQ(0u, channel_ids.size());
// Make sure the store gets written at least once.
@@ -113,7 +114,7 @@ class SQLiteChannelIDStoreTest : public testing::Test {
base::ScopedTempDir temp_dir_;
scoped_refptr<SQLiteChannelIDStore> store_;
- ScopedVector<DefaultChannelIDStore::ChannelID> channel_ids_;
+ std::vector<scoped_ptr<DefaultChannelIDStore::ChannelID>> channel_ids_;
scoped_ptr<crypto::ECPrivateKey> google_key_;
};
@@ -124,7 +125,7 @@ TEST_F(SQLiteChannelIDStoreTest, TestPersistence) {
"foo.com", base::Time::FromInternalValue(3),
make_scoped_ptr(foo_key->Copy())));
- ScopedVector<DefaultChannelIDStore::ChannelID> channel_ids;
+ std::vector<scoped_ptr<DefaultChannelIDStore::ChannelID>> channel_ids;
// 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.
@@ -138,14 +139,14 @@ TEST_F(SQLiteChannelIDStoreTest, TestPersistence) {
// Reload and test for persistence
Load(&channel_ids);
ASSERT_EQ(2U, channel_ids.size());
- DefaultChannelIDStore::ChannelID* goog_channel_id;
- DefaultChannelIDStore::ChannelID* foo_channel_id;
+ scoped_ptr<DefaultChannelIDStore::ChannelID> goog_channel_id;
+ scoped_ptr<DefaultChannelIDStore::ChannelID> foo_channel_id;
if (channel_ids[0]->server_identifier() == "google.com") {
- goog_channel_id = channel_ids[0];
- foo_channel_id = channel_ids[1];
+ goog_channel_id = std::move(channel_ids[0]);
+ foo_channel_id = std::move(channel_ids[1]);
} else {
- goog_channel_id = channel_ids[1];
- foo_channel_id = channel_ids[0];
+ goog_channel_id = std::move(channel_ids[1]);
+ foo_channel_id = std::move(channel_ids[0]);
mmenke 2015/11/30 20:33:16 Again, not sure this really gets us much.
}
ASSERT_EQ("google.com", goog_channel_id->server_identifier());
EXPECT_TRUE(KeysEqual(google_key_.get(), goog_channel_id->key()));
@@ -155,8 +156,8 @@ TEST_F(SQLiteChannelIDStoreTest, TestPersistence) {
ASSERT_EQ(3, foo_channel_id->creation_time().ToInternalValue());
// Now delete the keypair and check persistence again.
- store_->DeleteChannelID(*channel_ids[0]);
- store_->DeleteChannelID(*channel_ids[1]);
+ store_->DeleteChannelID(*goog_channel_id);
+ store_->DeleteChannelID(*foo_channel_id);
store_ = NULL;
// Make sure we wait until the destructor has run.
base::RunLoop().RunUntilIdle();
@@ -180,7 +181,7 @@ TEST_F(SQLiteChannelIDStoreTest, TestDeleteAll) {
"foo.com", base::Time::FromInternalValue(3),
make_scoped_ptr(crypto::ECPrivateKey::Create())));
- ScopedVector<DefaultChannelIDStore::ChannelID> channel_ids;
+ std::vector<scoped_ptr<DefaultChannelIDStore::ChannelID>> channel_ids;
// 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.
@@ -262,7 +263,7 @@ TEST_F(SQLiteChannelIDStoreTest, TestUpgradeV1) {
for (int i = 0; i < 2; ++i) {
SCOPED_TRACE(i);
- ScopedVector<DefaultChannelIDStore::ChannelID> channel_ids;
+ std::vector<scoped_ptr<DefaultChannelIDStore::ChannelID>> channel_ids;
store_ = new SQLiteChannelIDStore(v1_db_path,
base::ThreadTaskRunnerHandle::Get());
@@ -334,7 +335,7 @@ TEST_F(SQLiteChannelIDStoreTest, TestUpgradeV2) {
for (int i = 0; i < 2; ++i) {
SCOPED_TRACE(i);
- ScopedVector<DefaultChannelIDStore::ChannelID> channel_ids;
+ std::vector<scoped_ptr<DefaultChannelIDStore::ChannelID>> channel_ids;
store_ = new SQLiteChannelIDStore(v2_db_path,
base::ThreadTaskRunnerHandle::Get());
@@ -412,7 +413,7 @@ TEST_F(SQLiteChannelIDStoreTest, TestUpgradeV3) {
for (int i = 0; i < 2; ++i) {
SCOPED_TRACE(i);
- ScopedVector<DefaultChannelIDStore::ChannelID> channel_ids;
+ std::vector<scoped_ptr<DefaultChannelIDStore::ChannelID>> channel_ids;
store_ = new SQLiteChannelIDStore(v3_db_path,
base::ThreadTaskRunnerHandle::Get());
@@ -506,7 +507,7 @@ TEST_F(SQLiteChannelIDStoreTest, TestUpgradeV4) {
for (int i = 0; i < 2; ++i) {
SCOPED_TRACE(i);
- ScopedVector<DefaultChannelIDStore::ChannelID> channel_ids;
+ std::vector<scoped_ptr<DefaultChannelIDStore::ChannelID>> channel_ids;
store_ = new SQLiteChannelIDStore(v4_db_path,
base::ThreadTaskRunnerHandle::Get());

Powered by Google App Engine
This is Rietveld 408576698