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

Unified Diff: net/base/sdch_manager_unittest.cc

Issue 321283002: Clear SDCH information on "Clear browsing data" path. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporated comments. Created 6 years, 6 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 | « net/base/sdch_manager.cc ('k') | net/filter/sdch_filter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/sdch_manager_unittest.cc
diff --git a/net/base/sdch_manager_unittest.cc b/net/base/sdch_manager_unittest.cc
index 6684e4aa6637a5b94ebfc894831c4c69aadf5ab8..87b01f4f7ae574293fad5dd9f8cfd30033a1a563 100644
--- a/net/base/sdch_manager_unittest.cc
+++ b/net/base/sdch_manager_unittest.cc
@@ -192,7 +192,7 @@ TEST_F(SdchManagerTest, CanUseHTTPSDictionaryOverHTTPSIfEnabled) {
EXPECT_FALSE(dictionary_list.empty());
// Dictionary should be available.
- SdchManager::Dictionary* dictionary = NULL;
+ scoped_refptr<SdchManager::Dictionary> dictionary;
std::string client_hash;
std::string server_hash;
sdch_manager()->GenerateHash(dictionary_text, &client_hash, &server_hash);
@@ -215,7 +215,7 @@ TEST_F(SdchManagerTest, CanNotUseHTTPDictionaryOverHTTPS) {
sdch_manager()->GetAvailDictionaryList(target_url, &dictionary_list);
EXPECT_TRUE(dictionary_list.empty());
- SdchManager::Dictionary* dictionary = NULL;
+ scoped_refptr<SdchManager::Dictionary> dictionary;
std::string client_hash;
std::string server_hash;
sdch_manager()->GenerateHash(dictionary_text, &client_hash, &server_hash);
@@ -401,7 +401,7 @@ TEST_F(SdchManagerTest, CanUseMultipleManagers) {
// can't get them from the other.
EXPECT_TRUE(sdch_manager()->AddSdchDictionary(
dictionary_text_1, GURL("http://" + dictionary_domain_1)));
- SdchManager::Dictionary* dictionary = NULL;
+ scoped_refptr<SdchManager::Dictionary> dictionary;
sdch_manager()->GetVcdiffDictionary(
server_hash_1,
GURL("http://" + dictionary_domain_1 + "/random_url"),
@@ -441,5 +441,38 @@ TEST_F(SdchManagerTest, HttpsCorrectlySupported) {
EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(secure_url));
}
+TEST_F(SdchManagerTest, ClearDictionaryData) {
+ std::string dictionary_domain("x.y.z.google.com");
+ GURL blacklist_url("http://bad.chromium.org");
+
+ std::string dictionary_text(NewSdchDictionary(dictionary_domain));
+ std::string tmp_hash;
+ std::string server_hash;
+
+ SdchManager::GenerateHash(dictionary_text, &tmp_hash, &server_hash);
+
+ EXPECT_TRUE(sdch_manager()->AddSdchDictionary(
+ dictionary_text, GURL("http://" + dictionary_domain)));
+ scoped_refptr<SdchManager::Dictionary> dictionary;
+ sdch_manager()->GetVcdiffDictionary(
+ server_hash,
+ GURL("http://" + dictionary_domain + "/random_url"),
+ &dictionary);
+ EXPECT_TRUE(dictionary);
+
+ sdch_manager()->BlacklistDomain(GURL(blacklist_url));
+ EXPECT_FALSE(sdch_manager()->IsInSupportedDomain(blacklist_url));
+
+ sdch_manager()->ClearData();
+
+ dictionary = NULL;
+ sdch_manager()->GetVcdiffDictionary(
+ server_hash,
+ GURL("http://" + dictionary_domain + "/random_url"),
+ &dictionary);
+ EXPECT_FALSE(dictionary);
+ EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(blacklist_url));
+}
+
} // namespace net
« no previous file with comments | « net/base/sdch_manager.cc ('k') | net/filter/sdch_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698