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

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: Create Dictionary JSON directly in SdchManager::SdchInfoToValue Created 6 years, 4 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
Index: net/filter/sdch_filter_unittest.cc
diff --git a/net/filter/sdch_filter_unittest.cc b/net/filter/sdch_filter_unittest.cc
index 28da615c2e90bedd4b5c01dadf6ade807f8576f6..b52ea28c46a11fcdda0dfd9fc83f88ea3d630c7a 100644
--- a/net/filter/sdch_filter_unittest.cc
+++ b/net/filter/sdch_filter_unittest.cc
@@ -387,10 +387,12 @@ TEST_F(SdchFilterTest, DictionaryAddOnce) {
std::string url_string = "http://" + kSampleDomain;
GURL url(url_string);
- EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url));
+ SdchManager::ProblemCodes problem;
+ EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url, &problem));
// Check we can't add it twice.
- EXPECT_FALSE(sdch_manager_->AddSdchDictionary(dictionary, url));
+ EXPECT_FALSE(sdch_manager_->AddSdchDictionary(dictionary, url, &problem));
+ EXPECT_EQ(SdchManager::DICTIONARY_ALREADY_LOADED, problem);
const std::string kSampleDomain2 = "sdchtest2.com";
@@ -401,7 +403,7 @@ TEST_F(SdchFilterTest, DictionaryAddOnce) {
std::string url_string2 = "http://" + kSampleDomain2;
GURL url2(url_string2);
- EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary2, url2));
+ EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary2, url2, &problem));
}
}
@@ -413,7 +415,8 @@ TEST_F(SdchFilterTest, BasicDictionary) {
std::string url_string = "http://" + kSampleDomain;
GURL url(url_string);
- EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url));
+ SdchManager::ProblemCodes problem;
+ EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url, &problem));
std::string compressed(NewSdchCompressedData(dictionary));
@@ -450,7 +453,8 @@ TEST_F(SdchFilterTest, NoDecodeHttps) {
std::string url_string = "http://" + kSampleDomain;
GURL url(url_string);
- EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url));
+ SdchManager::ProblemCodes problem;
+ EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url, &problem));
std::string compressed(NewSdchCompressedData(dictionary));
@@ -480,7 +484,8 @@ TEST_F(SdchFilterTest, NoDecodeFtp) {
std::string url_string = "http://" + kSampleDomain;
GURL url(url_string);
- EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url));
+ SdchManager::ProblemCodes problem;
+ EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url, &problem));
std::string compressed(NewSdchCompressedData(dictionary));
@@ -506,7 +511,8 @@ TEST_F(SdchFilterTest, NoDecodeFileColon) {
std::string url_string = "http://" + kSampleDomain;
GURL url(url_string);
- EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url));
+ SdchManager::ProblemCodes problem;
+ EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url, &problem));
std::string compressed(NewSdchCompressedData(dictionary));
@@ -532,7 +538,8 @@ TEST_F(SdchFilterTest, NoDecodeAboutColon) {
std::string url_string = "http://" + kSampleDomain;
GURL url(url_string);
- EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url));
+ SdchManager::ProblemCodes problem;
+ EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url, &problem));
std::string compressed(NewSdchCompressedData(dictionary));
@@ -558,7 +565,8 @@ TEST_F(SdchFilterTest, NoDecodeJavaScript) {
std::string url_string = "http://" + kSampleDomain;
GURL url(url_string);
- EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url));
+ SdchManager::ProblemCodes problem;
+ EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url, &problem));
std::string compressed(NewSdchCompressedData(dictionary));
@@ -584,7 +592,8 @@ TEST_F(SdchFilterTest, CanStillDecodeHttp) {
std::string url_string = "http://" + kSampleDomain;
GURL url(url_string);
- EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url));
+ SdchManager::ProblemCodes problem;
+ EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url, &problem));
std::string compressed(NewSdchCompressedData(dictionary));
@@ -610,7 +619,8 @@ TEST_F(SdchFilterTest, CrossDomainDictionaryUse) {
std::string url_string = "http://" + kSampleDomain;
GURL url(url_string);
- EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url));
+ SdchManager::ProblemCodes problem;
+ EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url, &problem));
std::string compressed(NewSdchCompressedData(dictionary));
@@ -649,13 +659,15 @@ TEST_F(SdchFilterTest, DictionaryPathValidation) {
std::string url_string = "http://" + kSampleDomain;
GURL url(url_string);
- EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url));
+ SdchManager::ProblemCodes problem;
+ EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url, &problem));
// Create a dictionary with a path restriction, by prefixing dictionary.
const std::string path("/special_path/bin");
std::string dictionary_with_path("Path: " + path + "\n");
dictionary_with_path.append(dictionary);
- EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary_with_path, url));
+ EXPECT_TRUE(
+ sdch_manager_->AddSdchDictionary(dictionary_with_path, url, &problem));
std::string compressed_for_path(NewSdchCompressedData(dictionary_with_path));
@@ -703,16 +715,16 @@ TEST_F(SdchFilterTest, DictionaryPortValidation) {
std::string url_string = "http://" + kSampleDomain;
GURL url(url_string);
- EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url));
-
+ SdchManager::ProblemCodes problem;
+ EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url, &problem));
// Create a dictionary with a port restriction, by prefixing old dictionary.
const std::string port("502");
std::string dictionary_with_port("Port: " + port + "\n");
dictionary_with_port.append("Port: 80\n"); // Add default port.
dictionary_with_port.append(dictionary);
- EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary_with_port,
- GURL(url_string + ":" + port)));
+ EXPECT_TRUE(sdch_manager_->AddSdchDictionary(
+ dictionary_with_port, GURL(url_string + ":" + port), &problem));
std::string compressed_for_port(NewSdchCompressedData(dictionary_with_port));
@@ -833,7 +845,8 @@ TEST_F(SdchFilterTest, FilterChaining) {
std::string url_string = "http://" + kSampleDomain;
GURL url(url_string);
- EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url));
+ SdchManager::ProblemCodes problem;
+ EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url, &problem));
std::string sdch_compressed(NewSdchCompressedData(dictionary));
@@ -915,7 +928,8 @@ TEST_F(SdchFilterTest, DefaultGzipIfSdch) {
std::string url_string = "http://" + kSampleDomain;
GURL url(url_string);
- EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url));
+ SdchManager::ProblemCodes problem;
+ EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url, &problem));
std::string sdch_compressed(NewSdchCompressedData(dictionary));
@@ -971,7 +985,8 @@ TEST_F(SdchFilterTest, AcceptGzipSdchIfGzip) {
std::string url_string = "http://" + kSampleDomain;
GURL url(url_string);
- EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url));
+ SdchManager::ProblemCodes problem;
+ EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url, &problem));
std::string sdch_compressed(NewSdchCompressedData(dictionary));
@@ -1030,7 +1045,8 @@ TEST_F(SdchFilterTest, DefaultSdchGzipIfEmpty) {
std::string url_string = "http://" + kSampleDomain;
GURL url(url_string);
- EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url));
+ SdchManager::ProblemCodes problem;
+ EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url, &problem));
std::string sdch_compressed(NewSdchCompressedData(dictionary));
@@ -1086,7 +1102,8 @@ TEST_F(SdchFilterTest, AcceptGzipGzipSdchIfGzip) {
std::string url_string = "http://" + kSampleDomain;
GURL url(url_string);
- EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url));
+ SdchManager::ProblemCodes problem;
+ EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary, url, &problem));
std::string sdch_compressed(NewSdchCompressedData(dictionary));
« net/filter/filter.cc ('K') | « net/filter/sdch_filter.cc ('k') | net/net.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698