summaryrefslogtreecommitdiffstats
path: root/net/filter
diff options
context:
space:
mode:
authorbaranovich <baranovich@yandex-team.ru>2014-11-13 19:08:15 -0800
committerCommit bot <commit-bot@chromium.org>2014-11-14 03:08:44 +0000
commitc5e3865a91bc281f3b90454aef561c5f37806995 (patch)
tree3e5dcbbc13c1d3a7829a0bf8be70329ee2bd2b4f /net/filter
parent90c518c26ed4ed5c2c2d84168d0526aa0b2373e3 (diff)
downloadchromium_src-c5e3865a91bc281f3b90454aef561c5f37806995.zip
chromium_src-c5e3865a91bc281f3b90454aef561c5f37806995.tar.gz
chromium_src-c5e3865a91bc281f3b90454aef561c5f37806995.tar.bz2
Sdch view for net-internals
BUG= R=mmenke, rdsmith, jwd TEST=NetInternalsTest.netInternalsTourTabs NetInternalsTest.netInternalsExport*/Import* NetInternalsTest.netInternalsSdchView* Committed: https://crrev.com/fe89e5a5a23f3323201d3586b2ec77174f042158 Cr-Commit-Position: refs/heads/master@{#302546} Review URL: https://codereview.chromium.org/423813002 Cr-Commit-Position: refs/heads/master@{#304159}
Diffstat (limited to 'net/filter')
-rw-r--r--net/filter/filter.cc41
-rw-r--r--net/filter/filter.h6
-rw-r--r--net/filter/mock_filter_context.cc4
-rw-r--r--net/filter/mock_filter_context.h4
-rw-r--r--net/filter/sdch_filter.cc129
-rw-r--r--net/filter/sdch_filter.h3
-rw-r--r--net/filter/sdch_filter_unittest.cc31
7 files changed, 141 insertions, 77 deletions
diff --git a/net/filter/filter.cc b/net/filter/filter.cc
index c8a4740..c9a56bd 100644
--- a/net/filter/filter.cc
+++ b/net/filter/filter.cc
@@ -28,11 +28,14 @@
#include "net/base/filename_util_unsafe.h"
#include "net/base/io_buffer.h"
#include "net/base/mime_util.h"
+#include "net/base/sdch_net_log_params.h"
#include "net/filter/gzip_filter.h"
#include "net/filter/sdch_filter.h"
#include "net/url_request/url_request_context.h"
#include "url/gurl.h"
+namespace net {
+
namespace {
// Filter types (using canonical lower case only):
@@ -53,9 +56,15 @@ const char kTextHtml[] = "text/html";
// Buffer size allocated when de-compressing data.
const int kFilterBufSize = 32 * 1024;
-} // namespace
+void LogSdchProblem(const FilterContext& filter_context,
+ SdchProblemCode problem) {
+ SdchManager::SdchErrorRecovery(problem);
+ filter_context.GetNetLog().AddEvent(
+ NetLog::TYPE_SDCH_DECODING_ERROR,
+ base::Bind(&NetLogSdchResourceProblemCallback, problem));
+}
-namespace net {
+} // namespace
FilterContext::~FilterContext() {
}
@@ -233,13 +242,12 @@ void Filter::FixupEncodingTypes(
// It was not an SDCH request, so we'll just record stats.
if (1 < encoding_types->size()) {
// Multiple filters were intended to only be used for SDCH (thus far!)
- SdchManager::SdchErrorRecovery(
- SdchManager::MULTIENCODING_FOR_NON_SDCH_REQUEST);
+ LogSdchProblem(filter_context, SDCH_MULTIENCODING_FOR_NON_SDCH_REQUEST);
}
if ((1 == encoding_types->size()) &&
(FILTER_TYPE_SDCH == encoding_types->front())) {
- SdchManager::SdchErrorRecovery(
- SdchManager::SDCH_CONTENT_ENCODE_FOR_NON_SDCH_REQUEST);
+ LogSdchProblem(filter_context,
+ SDCH_SDCH_CONTENT_ENCODE_FOR_NON_SDCH_REQUEST);
}
return;
}
@@ -259,8 +267,7 @@ void Filter::FixupEncodingTypes(
// no-op pass through filter if it doesn't get gzip headers where expected.
if (1 == encoding_types->size()) {
encoding_types->push_back(FILTER_TYPE_GZIP_HELPING_SDCH);
- SdchManager::SdchErrorRecovery(
- SdchManager::OPTIONAL_GUNZIP_ENCODING_ADDED);
+ LogSdchProblem(filter_context, SDCH_OPTIONAL_GUNZIP_ENCODING_ADDED);
}
return;
}
@@ -294,14 +301,11 @@ void Filter::FixupEncodingTypes(
// Suspicious case: Advertised dictionary, but server didn't use sdch, and
// we're HTML tagged.
if (encoding_types->empty()) {
- SdchManager::SdchErrorRecovery(
- SdchManager::ADDED_CONTENT_ENCODING);
+ LogSdchProblem(filter_context, SDCH_ADDED_CONTENT_ENCODING);
} else if (1 == encoding_types->size()) {
- SdchManager::SdchErrorRecovery(
- SdchManager::FIXED_CONTENT_ENCODING);
+ LogSdchProblem(filter_context, SDCH_FIXED_CONTENT_ENCODING);
} else {
- SdchManager::SdchErrorRecovery(
- SdchManager::FIXED_CONTENT_ENCODINGS);
+ LogSdchProblem(filter_context, SDCH_FIXED_CONTENT_ENCODINGS);
}
} else {
// Remarkable case!?! We advertised an SDCH dictionary, content-encoding
@@ -313,14 +317,11 @@ void Filter::FixupEncodingTypes(
// start with "text/html" for some other reason?? We'll report this as a
// fixup to a binary file, but it probably really is text/html (some how).
if (encoding_types->empty()) {
- SdchManager::SdchErrorRecovery(
- SdchManager::BINARY_ADDED_CONTENT_ENCODING);
+ LogSdchProblem(filter_context, SDCH_BINARY_ADDED_CONTENT_ENCODING);
} else if (1 == encoding_types->size()) {
- SdchManager::SdchErrorRecovery(
- SdchManager::BINARY_FIXED_CONTENT_ENCODING);
+ LogSdchProblem(filter_context, SDCH_BINARY_FIXED_CONTENT_ENCODING);
} else {
- SdchManager::SdchErrorRecovery(
- SdchManager::BINARY_FIXED_CONTENT_ENCODINGS);
+ LogSdchProblem(filter_context, SDCH_BINARY_FIXED_CONTENT_ENCODINGS);
}
}
diff --git a/net/filter/filter.h b/net/filter/filter.h
index 37f55e2..13489ef 100644
--- a/net/filter/filter.h
+++ b/net/filter/filter.h
@@ -60,8 +60,9 @@ class GURL;
namespace net {
-class URLRequestContext;
+class BoundNetLog;
class IOBuffer;
+class URLRequestContext;
//------------------------------------------------------------------------------
// Define an interface class that allows access to contextual information
@@ -122,6 +123,9 @@ class NET_EXPORT_PRIVATE FilterContext {
// The following method forces the context to emit a specific set of
// statistics as selected by the argument.
virtual void RecordPacketStats(StatisticSelector statistic) const = 0;
+
+ // The BoundNetLog of the associated request.
+ virtual const BoundNetLog& GetNetLog() const = 0;
};
//------------------------------------------------------------------------------
diff --git a/net/filter/mock_filter_context.cc b/net/filter/mock_filter_context.cc
index e1e4793..35ab9ee 100644
--- a/net/filter/mock_filter_context.cc
+++ b/net/filter/mock_filter_context.cc
@@ -66,4 +66,8 @@ const URLRequestContext* MockFilterContext::GetURLRequestContext() const {
return context_.get();
}
+const BoundNetLog& MockFilterContext::GetNetLog() const {
+ return net_log_;
+}
+
} // namespace net
diff --git a/net/filter/mock_filter_context.h b/net/filter/mock_filter_context.h
index 8150e8b..41c9e9e 100644
--- a/net/filter/mock_filter_context.h
+++ b/net/filter/mock_filter_context.h
@@ -8,6 +8,7 @@
#include <string>
#include "base/memory/scoped_ptr.h"
+#include "net/base/net_log.h"
#include "net/filter/filter.h"
#include "url/gurl.h"
@@ -73,6 +74,8 @@ class MockFilterContext : public FilterContext {
void RecordPacketStats(StatisticSelector statistic) const override {}
+ const BoundNetLog& GetNetLog() const override;
+
private:
int buffer_size_;
std::string mime_type_;
@@ -85,6 +88,7 @@ class MockFilterContext : public FilterContext {
bool ok_to_call_get_url_;
int response_code_;
scoped_ptr<URLRequestContext> context_;
+ BoundNetLog net_log_;
DISALLOW_COPY_AND_ASSIGN(MockFilterContext);
};
diff --git a/net/filter/sdch_filter.cc b/net/filter/sdch_filter.cc
index df72367..fea0597 100644
--- a/net/filter/sdch_filter.cc
+++ b/net/filter/sdch_filter.cc
@@ -11,7 +11,9 @@
#include "base/logging.h"
#include "base/metrics/histogram.h"
+#include "base/values.h"
#include "net/base/sdch_manager.h"
+#include "net/base/sdch_net_log_params.h"
#include "net/url_request/url_request_context.h"
#include "sdch/open-vcdiff/src/google/vcdecoder.h"
@@ -50,6 +52,43 @@ enum ResponseCorruptionDetectionCause {
RESPONSE_MAX,
};
+const char* ResponseCorruptionDetectionCauseToString(
+ ResponseCorruptionDetectionCause cause) {
+ const char* cause_string = "<unknown>";
+ switch (cause) {
+ case RESPONSE_NONE:
+ cause_string = "NONE";
+ case RESPONSE_404:
+ cause_string = "404";
+ case RESPONSE_NOT_200:
+ cause_string = "NOT_200";
+ case RESPONSE_OLD_UNENCODED:
+ cause_string = "OLD_UNENCODED";
+ case RESPONSE_TENTATIVE_SDCH:
+ cause_string = "TENTATIVE_SDCH";
+ case RESPONSE_NO_DICTIONARY:
+ cause_string = "NO_DICTIONARY";
+ case RESPONSE_CORRUPT_SDCH:
+ cause_string = "CORRUPT_SDCH";
+ case RESPONSE_ENCODING_LIE:
+ cause_string = "ENCODING_LIE";
+ case RESPONSE_MAX:
+ cause_string = "<Error: max enum value>";
+ }
+ return cause_string;
+}
+
+base::Value* NetLogSdchResponseCorruptionDetectionCallback(
+ ResponseCorruptionDetectionCause cause,
+ bool cached,
+ NetLog::LogLevel log_level) {
+ base::DictionaryValue* dict = new base::DictionaryValue();
+ dict->SetString("cause", ResponseCorruptionDetectionCauseToString(cause));
+ dict->SetBoolean("cached", cached);
+ dict->SetInteger("net_error", ERR_FAILED);
+ return dict;
+}
+
} // namespace
SdchFilter::SdchFilter(const FilterContext& filter_context)
@@ -84,12 +123,12 @@ SdchFilter::~SdchFilter() {
if (vcdiff_streaming_decoder_.get()) {
if (!vcdiff_streaming_decoder_->FinishDecoding()) {
decoding_status_ = DECODING_ERROR;
- SdchManager::SdchErrorRecovery(SdchManager::INCOMPLETE_SDCH_CONTENT);
+ LogSdchProblem(SDCH_INCOMPLETE_SDCH_CONTENT);
// Make it possible for the user to hit reload, and get non-sdch content.
// Note this will "wear off" quickly enough, and is just meant to assure
// in some rare case that the user is not stuck.
url_request_context_->sdch_manager()->BlacklistDomain(
- url_, SdchManager::INCOMPLETE_SDCH_CONTENT);
+ url_, SDCH_INCOMPLETE_SDCH_CONTENT);
UMA_HISTOGRAM_COUNTS("Sdch3.PartialBytesIn",
static_cast<int>(filter_context_.GetByteReadCount()));
UMA_HISTOGRAM_COUNTS("Sdch3.PartialVcdiffIn", source_bytes_);
@@ -99,7 +138,7 @@ SdchFilter::~SdchFilter() {
if (!dest_buffer_excess_.empty()) {
// Filter chaining error, or premature teardown.
- SdchManager::SdchErrorRecovery(SdchManager::UNFLUSHED_CONTENT);
+ LogSdchProblem(SDCH_UNFLUSHED_CONTENT);
UMA_HISTOGRAM_COUNTS("Sdch3.UnflushedBytesIn",
static_cast<int>(filter_context_.GetByteReadCount()));
UMA_HISTOGRAM_COUNTS("Sdch3.UnflushedBufferSize",
@@ -111,7 +150,7 @@ SdchFilter::~SdchFilter() {
if (filter_context_.IsCachedContent()) {
// Not a real error, but it is useful to have this tally.
// TODO(jar): Remove this stat after SDCH stability is validated.
- SdchManager::SdchErrorRecovery(SdchManager::CACHE_DECODED);
+ LogSdchProblem(SDCH_CACHE_DECODED);
return; // We don't need timing stats, and we aready got ratios.
}
@@ -135,15 +174,15 @@ SdchFilter::~SdchFilter() {
return;
}
case DECODING_UNINITIALIZED: {
- SdchManager::SdchErrorRecovery(SdchManager::UNINITIALIZED);
+ LogSdchProblem(SDCH_UNINITIALIZED);
return;
}
case WAITING_FOR_DICTIONARY_SELECTION: {
- SdchManager::SdchErrorRecovery(SdchManager::PRIOR_TO_DICTIONARY);
+ LogSdchProblem(SDCH_PRIOR_TO_DICTIONARY);
return;
}
case DECODING_ERROR: {
- SdchManager::SdchErrorRecovery(SdchManager::DECODE_ERROR);
+ LogSdchProblem(SDCH_DECODE_ERROR);
return;
}
case META_REFRESH_RECOVERY: {
@@ -210,7 +249,7 @@ Filter::FilterStatus SdchFilter::ReadFilteredData(char* dest_buffer,
// We could be more generous, but for now, only a "NOT FOUND" code will
// cause a pass through. All other bad codes will fall into a
// meta-refresh.
- SdchManager::SdchErrorRecovery(SdchManager::PASS_THROUGH_404_CODE);
+ LogSdchProblem(SDCH_PASS_THROUGH_404_CODE);
cause = RESPONSE_404;
decoding_status_ = PASS_THROUGH;
} else if (filter_context_.GetResponseCode() != 200) {
@@ -220,7 +259,7 @@ Filter::FilterStatus SdchFilter::ReadFilteredData(char* dest_buffer,
&& !dictionary_hash_is_plausible_) {
// We must have hit the back button, and gotten content that was fetched
// before we *really* advertised SDCH and a dictionary.
- SdchManager::SdchErrorRecovery(SdchManager::PASS_THROUGH_OLD_CACHED);
+ LogSdchProblem(SDCH_PASS_THROUGH_OLD_CACHED);
decoding_status_ = PASS_THROUGH;
cause = RESPONSE_OLD_UNENCODED;
} else if (possible_pass_through_) {
@@ -256,11 +295,11 @@ Filter::FilterStatus SdchFilter::ReadFilteredData(char* dest_buffer,
// though it is not!
// Meta-refresh won't help, as we didn't advertise an SDCH dictionary!!
// Worse yet, meta-refresh could lead to an infinite refresh loop.
- SdchManager::SdchErrorRecovery(SdchManager::PASSING_THROUGH_NON_SDCH);
+ LogSdchProblem(SDCH_PASSING_THROUGH_NON_SDCH);
decoding_status_ = PASS_THROUGH;
// ... but further back-off on advertising SDCH support.
url_request_context_->sdch_manager()->BlacklistDomain(
- url_, SdchManager::PASSING_THROUGH_NON_SDCH);
+ url_, SDCH_PASSING_THROUGH_NON_SDCH);
cause = RESPONSE_ENCODING_LIE;
}
DCHECK_NE(RESPONSE_NONE, cause);
@@ -274,6 +313,10 @@ Filter::FilterStatus SdchFilter::ReadFilteredData(char* dest_buffer,
UMA_HISTOGRAM_ENUMERATION(
"Sdch3.ResponseCorruptionDetection.Uncached", cause, RESPONSE_MAX);
}
+ filter_context_.GetNetLog().AddEvent(
+ NetLog::TYPE_SDCH_RESPONSE_CORRUPTION_DETECTION,
+ base::Bind(&NetLogSdchResponseCorruptionDetectionCallback, cause,
+ filter_context_.IsCachedContent()));
if (decoding_status_ == PASS_THROUGH) {
dest_buffer_excess_ = dictionary_hash_; // Send what we scanned.
@@ -282,13 +325,12 @@ Filter::FilterStatus SdchFilter::ReadFilteredData(char* dest_buffer,
if (std::string::npos == mime_type_.find("text/html")) {
// Since we can't do a meta-refresh (along with an exponential
// backoff), we'll just make sure this NEVER happens again.
- SdchManager::ProblemCodes problem =
- (filter_context_.IsCachedContent() ?
- SdchManager::CACHED_META_REFRESH_UNSUPPORTED :
- SdchManager::META_REFRESH_UNSUPPORTED);
+ SdchProblemCode problem = (filter_context_.IsCachedContent()
+ ? SDCH_CACHED_META_REFRESH_UNSUPPORTED
+ : SDCH_META_REFRESH_UNSUPPORTED);
url_request_context_->sdch_manager()->BlacklistDomainForever(
url_, problem);
- SdchManager::SdchErrorRecovery(problem);
+ LogSdchProblem(problem);
return FILTER_ERROR;
}
// HTML content means we can issue a meta-refresh, and get the content
@@ -296,14 +338,13 @@ Filter::FilterStatus SdchFilter::ReadFilteredData(char* dest_buffer,
if (filter_context_.IsCachedContent()) {
// Cached content is probably a startup tab, so we'll just get fresh
// content and try again, without disabling sdch.
- SdchManager::SdchErrorRecovery(
- SdchManager::META_REFRESH_CACHED_RECOVERY);
+ LogSdchProblem(SDCH_META_REFRESH_CACHED_RECOVERY);
} else {
// Since it wasn't in the cache, we definately need at least some
// period of blacklisting to get the correct content.
url_request_context_->sdch_manager()->BlacklistDomain(
- url_, SdchManager::META_REFRESH_RECOVERY);
- SdchManager::SdchErrorRecovery(SdchManager::META_REFRESH_RECOVERY);
+ url_, SDCH_META_REFRESH_RECOVERY);
+ LogSdchProblem(SDCH_META_REFRESH_RECOVERY);
}
decoding_status_ = META_REFRESH_RECOVERY;
// Issue a meta redirect with SDCH disabled.
@@ -357,7 +398,7 @@ Filter::FilterStatus SdchFilter::ReadFilteredData(char* dest_buffer,
if (!ret) {
vcdiff_streaming_decoder_.reset(NULL); // Don't call it again.
decoding_status_ = DECODING_ERROR;
- SdchManager::SdchErrorRecovery(SdchManager::DECODE_BODY_ERROR);
+ LogSdchProblem(SDCH_DECODE_BODY_ERROR);
return FILTER_ERROR;
}
@@ -394,32 +435,35 @@ Filter::FilterStatus SdchFilter::InitializeDictionary() {
DCHECK(!dictionary_.get());
dictionary_hash_is_plausible_ = true; // Assume plausible, but check.
+ SdchProblemCode rv = SDCH_OK;
if ('\0' == dictionary_hash_[kServerIdLength - 1]) {
SdchManager* manager(url_request_context_->sdch_manager());
- manager->GetVcdiffDictionary(
- std::string(dictionary_hash_, 0, kServerIdLength - 1),
- url_, &dictionary_);
+ rv = manager->GetVcdiffDictionary(
+ std::string(dictionary_hash_, 0, kServerIdLength - 1), url_,
+ &dictionary_);
+ if (rv == SDCH_DICTIONARY_HASH_NOT_FOUND) {
+ DCHECK(dictionary_hash_.size() == kServerIdLength);
+ // Since dictionary was not found, check to see if hash was even
+ // plausible.
+ for (size_t i = 0; i < kServerIdLength - 1; ++i) {
+ char base64_char = dictionary_hash_[i];
+ if (!isalnum(base64_char) && '-' != base64_char && '_' != base64_char) {
+ rv = SDCH_DICTIONARY_HASH_MALFORMED;
+ dictionary_hash_is_plausible_ = false;
+ break;
+ }
+ }
+ }
} else {
dictionary_hash_is_plausible_ = false;
+ rv = SDCH_DICTIONARY_HASH_MALFORMED;
}
-
- if (!dictionary_.get()) {
- DCHECK(dictionary_hash_.size() == kServerIdLength);
- // Since dictionary was not found, check to see if hash was even plausible.
- for (size_t i = 0; i < kServerIdLength - 1; ++i) {
- char base64_char = dictionary_hash_[i];
- if (!isalnum(base64_char) && '-' != base64_char && '_' != base64_char) {
- dictionary_hash_is_plausible_ = false;
- break;
- }
- }
- if (dictionary_hash_is_plausible_)
- SdchManager::SdchErrorRecovery(SdchManager::DICTIONARY_HASH_NOT_FOUND);
- else
- SdchManager::SdchErrorRecovery(SdchManager::DICTIONARY_HASH_MALFORMED);
+ if (rv != SDCH_OK) {
+ LogSdchProblem(rv);
decoding_status_ = DECODING_ERROR;
return FILTER_ERROR;
}
+ DCHECK(dictionary_.get());
vcdiff_streaming_decoder_.reset(new open_vcdiff::VCDiffStreamingDecoder);
vcdiff_streaming_decoder_->SetAllowVcdTarget(false);
vcdiff_streaming_decoder_->StartDecoding(dictionary_->text().data(),
@@ -446,4 +490,11 @@ int SdchFilter::OutputBufferExcess(char* const dest_buffer,
return amount;
}
+void SdchFilter::LogSdchProblem(SdchProblemCode problem) {
+ SdchManager::SdchErrorRecovery(problem);
+ filter_context_.GetNetLog().AddEvent(
+ NetLog::TYPE_SDCH_DECODING_ERROR,
+ base::Bind(&NetLogSdchResourceProblemCallback, problem));
+}
+
} // namespace net
diff --git a/net/filter/sdch_filter.h b/net/filter/sdch_filter.h
index e9648b1..a1a6607 100644
--- a/net/filter/sdch_filter.h
+++ b/net/filter/sdch_filter.h
@@ -64,6 +64,9 @@ class NET_EXPORT_PRIVATE SdchFilter : public Filter {
// specified dest_buffer.
int OutputBufferExcess(char* const dest_buffer, size_t available_space);
+ // Add SDCH Problem to net-log and record histogram.
+ void LogSdchProblem(SdchProblemCode problem);
+
// Context data from the owner of this filter.
const FilterContext& filter_context_;
diff --git a/net/filter/sdch_filter_unittest.cc b/net/filter/sdch_filter_unittest.cc
index 2263001..79b5673 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)));
}
//------------------------------------------------------------------------------