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

Unified Diff: chrome/browser/net/quota_policy_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: chrome/browser/net/quota_policy_channel_id_store_unittest.cc
diff --git a/chrome/browser/net/quota_policy_channel_id_store_unittest.cc b/chrome/browser/net/quota_policy_channel_id_store_unittest.cc
index 670bf883b8118c53ab184f4ba615b7c1442056bf..3fed54f5cfc9a02fb686ea222c29f6bfef7a800c 100644
--- a/chrome/browser/net/quota_policy_channel_id_store_unittest.cc
+++ b/chrome/browser/net/quota_policy_channel_id_store_unittest.cc
@@ -29,7 +29,8 @@ const base::FilePath::CharType kTestChannelIDFilename[] =
class QuotaPolicyChannelIDStoreTest : public testing::Test {
public:
- void Load(ScopedVector<net::DefaultChannelIDStore::ChannelID>* channel_ids) {
+ void Load(std::vector<scoped_ptr<net::DefaultChannelIDStore::ChannelID>>*
mmenke 2015/11/30 20:33:16 include <vector>
+ channel_ids) {
base::RunLoop run_loop;
store_->Load(base::Bind(&QuotaPolicyChannelIDStoreTest::OnLoaded,
base::Unretained(this),
@@ -39,9 +40,10 @@ class QuotaPolicyChannelIDStoreTest : public testing::Test {
channel_ids_.clear();
}
- void OnLoaded(base::RunLoop* run_loop,
- scoped_ptr<ScopedVector<net::DefaultChannelIDStore::ChannelID> >
- channel_ids) {
+ void OnLoaded(
+ base::RunLoop* run_loop,
+ scoped_ptr<std::vector<scoped_ptr<net::DefaultChannelIDStore::ChannelID>>>
+ channel_ids) {
channel_ids_.swap(*channel_ids);
run_loop->Quit();
}
@@ -53,7 +55,7 @@ class QuotaPolicyChannelIDStoreTest : public testing::Test {
temp_dir_.path().Append(kTestChannelIDFilename),
base::ThreadTaskRunnerHandle::Get(),
NULL);
- ScopedVector<net::DefaultChannelIDStore::ChannelID> channel_ids;
+ std::vector<scoped_ptr<net::DefaultChannelIDStore::ChannelID>> channel_ids;
Load(&channel_ids);
ASSERT_EQ(0u, channel_ids.size());
}
@@ -65,7 +67,7 @@ class QuotaPolicyChannelIDStoreTest : public testing::Test {
base::ScopedTempDir temp_dir_;
scoped_refptr<QuotaPolicyChannelIDStore> store_;
- ScopedVector<net::DefaultChannelIDStore::ChannelID> channel_ids_;
+ std::vector<scoped_ptr<net::DefaultChannelIDStore::ChannelID>> channel_ids_;
base::MessageLoop loop_;
};
@@ -80,7 +82,7 @@ TEST_F(QuotaPolicyChannelIDStoreTest, TestPersistence) {
"foo.com", base::Time::FromInternalValue(3),
make_scoped_ptr(foo_key->Copy())));
- ScopedVector<net::DefaultChannelIDStore::ChannelID> channel_ids;
+ std::vector<scoped_ptr<net::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.
@@ -95,14 +97,14 @@ TEST_F(QuotaPolicyChannelIDStoreTest, TestPersistence) {
// Reload and test for persistence
Load(&channel_ids);
ASSERT_EQ(2U, channel_ids.size());
- net::DefaultChannelIDStore::ChannelID* goog_channel_id;
- net::DefaultChannelIDStore::ChannelID* foo_channel_id;
+ scoped_ptr<net::DefaultChannelIDStore::ChannelID> goog_channel_id;
+ scoped_ptr<net::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]);
mmenke 2015/11/30 20:33:16 Any reason for passing ownership here? Doesn't se
} 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]);
}
ASSERT_EQ("google.com", goog_channel_id->server_identifier());
EXPECT_TRUE(net::KeysEqual(goog_key.get(), goog_channel_id->key()));
@@ -111,9 +113,9 @@ TEST_F(QuotaPolicyChannelIDStoreTest, TestPersistence) {
EXPECT_TRUE(net::KeysEqual(foo_key.get(), foo_channel_id->key()));
ASSERT_EQ(3, foo_channel_id->creation_time().ToInternalValue());
- // Now delete the channel ID and check persistence again.
- store_->DeleteChannelID(*channel_ids[0]);
- store_->DeleteChannelID(*channel_ids[1]);
+ // Now delete the channel ID and check persistence again.
mmenke 2015/11/30 20:33:16 Remove extra space.
+ store_->DeleteChannelID(*goog_channel_id);
+ store_->DeleteChannelID(*foo_channel_id);
store_ = NULL;
// Make sure we wait until the destructor has run.
base::RunLoop().RunUntilIdle();
@@ -137,7 +139,7 @@ TEST_F(QuotaPolicyChannelIDStoreTest, TestPolicy) {
"nonpersistent.com", base::Time::FromInternalValue(3),
make_scoped_ptr(crypto::ECPrivateKey::Create())));
- ScopedVector<net::DefaultChannelIDStore::ChannelID> channel_ids;
+ std::vector<scoped_ptr<net::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.

Powered by Google App Engine
This is Rietveld 408576698