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

Unified Diff: net/filter/sdch_filter_unittest.cc

Issue 423813002: Sdch view for net-internals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix component linkage Created 6 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
« no previous file with comments | « net/filter/sdch_filter.cc ('k') | net/net.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/filter/sdch_filter_unittest.cc
diff --git a/net/filter/sdch_filter_unittest.cc b/net/filter/sdch_filter_unittest.cc
index 2263001a77a579f09bbb15d417d93da7ddadb8d0..79b567369d2d7dafb4e34e10b5c81a9b706eb1c6 100644
--- a/net/filter/sdch_filter_unittest.cc
+++ b/net/filter/sdch_filter_unittest.cc
@@ -67,14 +67,7 @@ class SdchFilterTest : public testing::Test {
// the attempt succeeded.
bool AddSdchDictionary(const std::string& dictionary_text,
const GURL& gurl) {
- std::string list;
- sdch_manager_->GetAvailDictionaryList(gurl, &list);
- sdch_manager_->AddSdchDictionary(dictionary_text, gurl);
- std::string list2;
- sdch_manager_->GetAvailDictionaryList(gurl, &list2);
-
- // The list of hashes should change iff the addition succeeds.
- return (list != list2);
+ return sdch_manager_->AddSdchDictionary(dictionary_text, gurl) == SDCH_OK;
}
MockFilterContext* filter_context() { return filter_context_.get(); }
@@ -412,9 +405,10 @@ TEST_F(SdchFilterTest, BasicBadDictionary) {
EXPECT_EQ(0, output_bytes_or_buffer_size);
EXPECT_EQ(Filter::FILTER_ERROR, status);
- EXPECT_FALSE(sdch_manager_->IsInSupportedDomain(GURL(url_string)));
+ EXPECT_EQ(SDCH_DOMAIN_BLACKLIST_INCLUDES_TARGET,
+ sdch_manager_->IsInSupportedDomain(GURL(url_string)));
sdch_manager_->ClearBlacklistings();
- EXPECT_TRUE(sdch_manager_->IsInSupportedDomain(GURL(url_string)));
+ EXPECT_EQ(SDCH_OK, sdch_manager_->IsInSupportedDomain(GURL(url_string)));
}
TEST_F(SdchFilterTest, DictionaryAddOnce) {
@@ -667,10 +661,11 @@ TEST_F(SdchFilterTest, CrossDomainDictionaryUse) {
filter.get(), &output));
EXPECT_EQ(output.size(), 0u); // No output written.
- EXPECT_TRUE(sdch_manager_->IsInSupportedDomain(GURL(url_string)));
- EXPECT_FALSE(sdch_manager_->IsInSupportedDomain(wrong_domain_url));
+ EXPECT_EQ(SDCH_OK, sdch_manager_->IsInSupportedDomain(GURL(url_string)));
+ EXPECT_EQ(SDCH_DOMAIN_BLACKLIST_INCLUDES_TARGET,
+ sdch_manager_->IsInSupportedDomain(wrong_domain_url));
sdch_manager_->ClearBlacklistings();
- EXPECT_TRUE(sdch_manager_->IsInSupportedDomain(wrong_domain_url));
+ EXPECT_EQ(SDCH_OK, sdch_manager_->IsInSupportedDomain(wrong_domain_url));
}
TEST_F(SdchFilterTest, DictionaryPathValidation) {
@@ -723,9 +718,10 @@ TEST_F(SdchFilterTest, DictionaryPathValidation) {
output_block_size, filter.get(), &output));
EXPECT_EQ(output.size(), 0u); // No output written.
- EXPECT_FALSE(sdch_manager_->IsInSupportedDomain(GURL(url_string)));
+ EXPECT_EQ(SDCH_DOMAIN_BLACKLIST_INCLUDES_TARGET,
+ sdch_manager_->IsInSupportedDomain(GURL(url_string)));
sdch_manager_->ClearBlacklistings();
- EXPECT_TRUE(sdch_manager_->IsInSupportedDomain(GURL(url_string)));
+ EXPECT_EQ(SDCH_OK, sdch_manager_->IsInSupportedDomain(GURL(url_string)));
}
TEST_F(SdchFilterTest, DictionaryPortValidation) {
@@ -789,9 +785,10 @@ TEST_F(SdchFilterTest, DictionaryPortValidation) {
output_block_size, filter.get(), &output));
EXPECT_EQ(output.size(), 0u); // No output written.
- EXPECT_FALSE(sdch_manager_->IsInSupportedDomain(GURL(url_string)));
+ EXPECT_EQ(SDCH_DOMAIN_BLACKLIST_INCLUDES_TARGET,
+ sdch_manager_->IsInSupportedDomain(GURL(url_string)));
sdch_manager_->ClearBlacklistings();
- EXPECT_TRUE(sdch_manager_->IsInSupportedDomain(GURL(url_string)));
+ EXPECT_EQ(SDCH_OK, sdch_manager_->IsInSupportedDomain(GURL(url_string)));
}
//------------------------------------------------------------------------------
« no previous file with comments | « net/filter/sdch_filter.cc ('k') | net/net.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698