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

Unified Diff: chrome/browser/net/quota_policy_channel_id_store_unittest.cc

Issue 1015233002: Fixes a bug where QuotaPolicyChannelIDStore would ignore some deletes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months 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
« no previous file with comments | « no previous file | net/extras/sqlite/sqlite_channel_id_store.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f82f6e477208dc28045e815d36e481fec71d7321..5a9ee93c718266748148a54b5d7ecf0a37ccb68c 100644
--- a/chrome/browser/net/quota_policy_channel_id_store_unittest.cc
+++ b/chrome/browser/net/quota_policy_channel_id_store_unittest.cc
@@ -178,6 +178,8 @@ TEST_F(QuotaPolicyChannelIDStoreTest, TestPolicy) {
new content::MockSpecialStoragePolicy();
storage_policy->AddSessionOnly(
net::cookie_util::CookieOriginToURL("foo.com", true));
+ storage_policy->AddSessionOnly(
+ net::cookie_util::CookieOriginToURL("nonpersistent.com", true));
Ryan Sleevi 2015/04/06 18:09:57 How is this distinct from foo.com, which is nonper
rohitrao (ping after 24h) 2015/04/06 18:42:22 I wasn't sure if I could add two IDs with the same
Ryan Sleevi 2015/04/06 18:46:55 I guess that wasn't quite what I meant, and still
// Reload store, it should still have both channel ids.
store_ = new QuotaPolicyChannelIDStore(
temp_dir_.path().Append(kTestChannelIDFilename),
@@ -186,7 +188,15 @@ TEST_F(QuotaPolicyChannelIDStoreTest, TestPolicy) {
Load(&channel_ids);
ASSERT_EQ(2U, channel_ids.size());
- // Now close the store, and "foo.com" should be deleted according to policy.
+ store_->AddChannelID(net::DefaultChannelIDStore::ChannelID(
+ "nonpersistent.com", base::Time::FromInternalValue(5),
+ base::Time::FromInternalValue(6), "e", "f"));
+ store_->AddChannelID(net::DefaultChannelIDStore::ChannelID(
+ "persistent.com", base::Time::FromInternalValue(7),
+ base::Time::FromInternalValue(8), "g", "h"));
Ryan Sleevi 2015/04/06 18:09:57 Not clear what you're trying to do here. Could you
rohitrao (ping after 24h) 2015/04/06 18:42:22 Added a comment to this block. The goal was to do
+
+ // Now close the store, and the session-only IDs should be deleted according
+ // to policy.
store_ = NULL;
// Make sure we wait until the destructor has run.
base::RunLoop().RunUntilIdle();
@@ -196,8 +206,11 @@ TEST_F(QuotaPolicyChannelIDStoreTest, TestPolicy) {
base::MessageLoopProxy::current(),
NULL);
- // Reload and check that the "foo.com" cert has been removed.
+ // Reload and check that the proper IDs have been removed.
Load(&channel_ids);
- ASSERT_EQ(1U, channel_ids.size());
- ASSERT_EQ("google.com", channel_ids[0]->server_identifier());
+ ASSERT_EQ(2U, channel_ids.size());
+ for (const auto& id : channel_ids) {
+ ASSERT_NE("foo.com", id->server_identifier());
+ ASSERT_NE("nonpersistent.com", id->server_identifier());
+ }
}
« no previous file with comments | « no previous file | net/extras/sqlite/sqlite_channel_id_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698