Add NetworkService support for response filtering (see issue #2622).

To test: ResourceRequestHandlerTest.Filter* tests pass with NetworkService
enabled.
This commit is contained in:
Marshall Greenblatt 2019-05-19 22:21:20 +03:00
parent e5c7fd1c55
commit 9ddb013875
9 changed files with 506 additions and 37 deletions

View File

@ -413,6 +413,8 @@ static_library("libcef_static") {
"libcef/browser/net_service/resource_handler_wrapper.h", "libcef/browser/net_service/resource_handler_wrapper.h",
"libcef/browser/net_service/resource_request_handler_wrapper.cc", "libcef/browser/net_service/resource_request_handler_wrapper.cc",
"libcef/browser/net_service/resource_request_handler_wrapper.h", "libcef/browser/net_service/resource_request_handler_wrapper.h",
"libcef/browser/net_service/response_filter_wrapper.cc",
"libcef/browser/net_service/response_filter_wrapper.h",
"libcef/browser/net_service/stream_reader_url_loader.cc", "libcef/browser/net_service/stream_reader_url_loader.cc",
"libcef/browser/net_service/stream_reader_url_loader.h", "libcef/browser/net_service/stream_reader_url_loader.h",
"libcef/browser/net_service/url_loader_factory_getter.cc", "libcef/browser/net_service/url_loader_factory_getter.cc",

View File

@ -352,7 +352,7 @@ void InterceptedRequest::Restart() {
base::BindOnce(&InterceptedRequest::BeforeRequestReceived, base::BindOnce(&InterceptedRequest::BeforeRequestReceived,
weak_factory_.GetWeakPtr(), original_url), weak_factory_.GetWeakPtr(), original_url),
base::BindOnce(&InterceptedRequest::SendErrorAndCompleteImmediately, base::BindOnce(&InterceptedRequest::SendErrorAndCompleteImmediately,
weak_factory_.GetWeakPtr(), net::ERR_ABORTED)); weak_factory_.GetWeakPtr()));
} }
void InterceptedRequest::OnLoaderCreated( void InterceptedRequest::OnLoaderCreated(
@ -524,7 +524,9 @@ void InterceptedRequest::OnTransferSizeUpdated(int32_t transfer_size_diff) {
void InterceptedRequest::OnStartLoadingResponseBody( void InterceptedRequest::OnStartLoadingResponseBody(
mojo::ScopedDataPipeConsumerHandle body) { mojo::ScopedDataPipeConsumerHandle body) {
target_client_->OnStartLoadingResponseBody(std::move(body)); target_client_->OnStartLoadingResponseBody(
factory_->request_handler_->OnFilterResponseBody(id_, request_,
std::move(body)));
} }
void InterceptedRequest::OnComplete( void InterceptedRequest::OnComplete(
@ -988,6 +990,14 @@ void InterceptedRequestHandler::OnRequestResponse(
redirect_info.has_value() ? redirect_info->new_url : GURL()); redirect_info.has_value() ? redirect_info->new_url : GURL());
} }
mojo::ScopedDataPipeConsumerHandle
InterceptedRequestHandler::OnFilterResponseBody(
const RequestId& id,
const network::ResourceRequest& request,
mojo::ScopedDataPipeConsumerHandle body) {
return body;
}
//============================== //==============================
// ProxyURLLoaderFactory // ProxyURLLoaderFactory
//============================== //==============================

View File

@ -39,7 +39,7 @@ class InterceptedRequestHandler {
using OnBeforeRequestResultCallback = using OnBeforeRequestResultCallback =
base::OnceCallback<void(bool /* intercept_request */, base::OnceCallback<void(bool /* intercept_request */,
bool /* intercept_only */)>; bool /* intercept_only */)>;
using CancelRequestCallback = base::OnceClosure; using CancelRequestCallback = base::OnceCallback<void(int /* error_code */)>;
virtual void OnBeforeRequest(const RequestId& id, virtual void OnBeforeRequest(const RequestId& id,
network::ResourceRequest* request, network::ResourceRequest* request,
bool request_was_redirected, bool request_was_redirected,
@ -102,6 +102,12 @@ class InterceptedRequestHandler {
base::Optional<net::RedirectInfo> redirect_info, base::Optional<net::RedirectInfo> redirect_info,
OnRequestResponseResultCallback callback); OnRequestResponseResultCallback callback);
// Called to optionally filter the response body.
virtual mojo::ScopedDataPipeConsumerHandle OnFilterResponseBody(
const RequestId& id,
const network::ResourceRequest& request,
mojo::ScopedDataPipeConsumerHandle body);
// Called on completion notification from the loader (successful or not). // Called on completion notification from the loader (successful or not).
virtual void OnRequestComplete( virtual void OnRequestComplete(
const RequestId& id, const RequestId& id,

View File

@ -10,6 +10,7 @@
#include "libcef/browser/net_service/cookie_helper.h" #include "libcef/browser/net_service/cookie_helper.h"
#include "libcef/browser/net_service/proxy_url_loader_factory.h" #include "libcef/browser/net_service/proxy_url_loader_factory.h"
#include "libcef/browser/net_service/resource_handler_wrapper.h" #include "libcef/browser/net_service/resource_handler_wrapper.h"
#include "libcef/browser/net_service/response_filter_wrapper.h"
#include "libcef/browser/resource_context.h" #include "libcef/browser/resource_context.h"
#include "libcef/browser/thread_util.h" #include "libcef/browser/thread_util.h"
#include "libcef/common/content_client.h" #include "libcef/common/content_client.h"
@ -478,7 +479,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
if (!allow) { if (!allow) {
// Cancel the request. // Cancel the request.
std::move(state->cancel_callback_).Run(); std::move(state->cancel_callback_).Run(net::ERR_ABORTED);
return; return;
} }
@ -713,6 +714,43 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
std::move(callback).Run(); std::move(callback).Run();
} }
mojo::ScopedDataPipeConsumerHandle OnFilterResponseBody(
const RequestId& id,
const network::ResourceRequest& request,
mojo::ScopedDataPipeConsumerHandle body) override {
CEF_REQUIRE_IOT();
RequestState* state = GetState(id);
DCHECK(state);
if (state->handler_) {
auto filter = state->handler_->GetResourceResponseFilter(
GetBrowser(), frame_, state->pending_request_.get(),
state->pending_response_.get());
if (filter) {
return CreateResponseFilterHandler(
filter, std::move(body),
base::BindOnce(&InterceptedRequestHandlerWrapper::OnFilterError,
weak_ptr_factory_.GetWeakPtr(), id));
}
}
return body;
}
void OnFilterError(const RequestId& id) {
CEF_REQUIRE_IOT();
RequestState* state = GetState(id);
if (!state) {
// The request may have been canceled while the async callback was
// pending.
return;
}
std::move(state->cancel_callback_).Run(net::ERR_CONTENT_DECODING_FAILED);
}
void OnRequestComplete( void OnRequestComplete(
const RequestId& id, const RequestId& id,
const network::ResourceRequest& request, const network::ResourceRequest& request,
@ -852,7 +890,8 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
// Cancel any pending requests. // Cancel any pending requests.
while (!request_map_.empty()) { while (!request_map_.empty()) {
// Results in a call to RemoveState(). // Results in a call to RemoveState().
std::move(request_map_.begin()->second->cancel_callback_).Run(); std::move(request_map_.begin()->second->cancel_callback_)
.Run(net::ERR_ABORTED);
} }
} }

View File

@ -0,0 +1,296 @@
// Copyright (c) 2019 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "libcef/browser/net_service/response_filter_wrapper.h"
#include <queue>
#include "mojo/public/cpp/system/simple_watcher.h"
#include "mojo/public/cpp/system/string_data_pipe_producer.h"
namespace net_service {
namespace {
// Match the default |capacity_num_bytes| value from mojo::Core::CreateDataPipe.
static const size_t kBufferSize = 64 * 1024; // 64 Kbytes.
static const size_t kMinBufferSpace = 1024; // 1 Kbytes.
class ResponseFilterWrapper {
public:
ResponseFilterWrapper(CefRefPtr<CefResponseFilter> filter,
mojo::ScopedDataPipeConsumerHandle source_handle,
base::OnceClosure error_callback);
// Creates and returns the output handle, or |source_handle| on failure.
bool CreateOutputHandle(mojo::ScopedDataPipeConsumerHandle* output_handle);
private:
void OnSourceReadable(MojoResult, const mojo::HandleSignalsState&);
void Filter(const char* data, size_t size);
void Write(std::unique_ptr<std::string> data);
void OnWriteComplete(std::unique_ptr<std::string>, MojoResult result);
void Drain(bool complete);
void MaybeSuccess();
void Cleanup(bool success);
CefRefPtr<CefResponseFilter> filter_;
mojo::ScopedDataPipeConsumerHandle source_handle_;
base::OnceClosure error_callback_;
std::unique_ptr<mojo::StringDataPipeProducer> forwarder_;
mojo::SimpleWatcher source_watcher_;
bool read_pending_ = false;
bool write_pending_ = false;
std::queue<std::unique_ptr<std::string>> pending_data_;
cef_response_filter_status_t last_status_ = RESPONSE_FILTER_NEED_MORE_DATA;
DISALLOW_COPY_AND_ASSIGN(ResponseFilterWrapper);
};
ResponseFilterWrapper::ResponseFilterWrapper(
CefRefPtr<CefResponseFilter> filter,
mojo::ScopedDataPipeConsumerHandle source_handle,
base::OnceClosure error_callback)
: filter_(filter),
source_handle_(std::move(source_handle)),
error_callback_(std::move(error_callback)),
source_watcher_(FROM_HERE, mojo::SimpleWatcher::ArmingPolicy::MANUAL) {}
bool ResponseFilterWrapper::CreateOutputHandle(
mojo::ScopedDataPipeConsumerHandle* output_handle) {
if (!filter_->InitFilter()) {
*output_handle = std::move(source_handle_);
return false;
}
mojo::ScopedDataPipeProducerHandle forwarding_handle;
if (CreateDataPipe(nullptr, &forwarding_handle, output_handle) !=
MOJO_RESULT_OK) {
*output_handle = std::move(source_handle_);
return false;
}
forwarder_ = std::make_unique<mojo::StringDataPipeProducer>(
std::move(forwarding_handle));
source_watcher_.Watch(
source_handle_.get(),
MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
MOJO_TRIGGER_CONDITION_SIGNALS_SATISFIED,
base::BindRepeating(&ResponseFilterWrapper::OnSourceReadable,
base::Unretained(this)));
source_watcher_.ArmOrNotify();
read_pending_ = true;
return true;
}
void ResponseFilterWrapper::OnSourceReadable(MojoResult,
const mojo::HandleSignalsState&) {
const void* buffer = nullptr;
uint32_t read_bytes = 0;
MojoResult result = source_handle_->BeginReadData(&buffer, &read_bytes,
MOJO_READ_DATA_FLAG_NONE);
if (result == MOJO_RESULT_SHOULD_WAIT) {
source_watcher_.ArmOrNotify();
return;
}
if (result != MOJO_RESULT_OK) {
// Whole body has been read, or something went wrong.
Drain(result == MOJO_RESULT_FAILED_PRECONDITION);
return;
}
Filter(static_cast<const char*>(buffer), read_bytes);
if (last_status_ == RESPONSE_FILTER_ERROR) {
// Something went wrong.
Drain(false);
return;
}
source_handle_->EndReadData(read_bytes);
source_watcher_.ArmOrNotify();
}
void ResponseFilterWrapper::Filter(const char* data, size_t size) {
size_t data_in_size = size;
auto data_in_ptr = data_in_size > 0 ? data : nullptr;
size_t data_out_offset = 0;
std::unique_ptr<std::string> data_out;
while (true) {
size_t data_in_read = 0;
if (!data_out) {
// Start a new buffer. Should have no offset to begin with.
DCHECK_EQ(0U, data_out_offset);
data_out = std::make_unique<std::string>();
data_out->resize(kBufferSize);
}
auto data_out_ptr = data_out->data() + data_out_offset;
size_t data_out_size = kBufferSize - data_out_offset;
size_t data_out_written = 0;
last_status_ = filter_->Filter(
const_cast<char*>(data_in_ptr), data_in_size, data_in_read,
const_cast<char*>(data_out_ptr), data_out_size, data_out_written);
if (last_status_ == RESPONSE_FILTER_ERROR)
break;
// Validate the out values.
if (data_in_read > data_in_size) {
LOG(ERROR) << "potential buffer overflow; data_in_read > data_in_size";
last_status_ = RESPONSE_FILTER_ERROR;
break;
}
if (data_out_written > data_out_size) {
LOG(ERROR)
<< "potential buffer overflow; data_out_written > data_out_size";
last_status_ = RESPONSE_FILTER_ERROR;
break;
}
if (data_out_written == 0 && data_in_read != data_in_size) {
LOG(ERROR) << "when no data is written all input must be consumed; "
"data_out_written == 0 && data_in_read != data_in_size";
last_status_ = RESPONSE_FILTER_ERROR;
break;
}
if (data_out_written > 0) {
data_out_offset += data_out_written;
if (data_out_offset > kBufferSize - kMinBufferSpace) {
// The buffer is full or almost full. Write the data that we've
// received so far and start a new buffer.
data_out->resize(data_out_offset);
Write(std::move(data_out));
data_out_offset = 0;
}
}
if (data_in_read < data_in_size) {
// Keep going until the user reads all data.
data_in_ptr += data_in_read;
data_in_size -= data_in_read;
continue;
}
// At this point the user has read all data...
if (data_in_ptr) {
// Clear the input buffer.
data_in_read = data_in_size = 0;
data_in_ptr = nullptr;
}
if (data_out_written == data_out_size &&
last_status_ == RESPONSE_FILTER_NEED_MORE_DATA) {
// Output buffer was filled, but data is still pending.
continue;
}
if (data_out_offset > 0) {
// Write the last of the data that we've received.
data_out->resize(data_out_offset);
Write(std::move(data_out));
}
break;
}
}
void ResponseFilterWrapper::Write(std::unique_ptr<std::string> data) {
if (write_pending_) {
// Only one write at a time is supported.
pending_data_.push(std::move(data));
return;
}
write_pending_ = true;
base::StringPiece string_piece(*data);
forwarder_->Write(string_piece,
mojo::StringDataPipeProducer::AsyncWritingMode::
STRING_STAYS_VALID_UNTIL_COMPLETION,
base::BindOnce(&ResponseFilterWrapper::OnWriteComplete,
base::Unretained(this), std::move(data)));
}
void ResponseFilterWrapper::OnWriteComplete(std::unique_ptr<std::string>,
MojoResult result) {
write_pending_ = false;
if (result != MOJO_RESULT_OK) {
// Something went wrong.
Cleanup(false);
return;
}
MaybeSuccess();
}
void ResponseFilterWrapper::Drain(bool complete) {
read_pending_ = false;
source_handle_.reset();
source_watcher_.Cancel();
if (!complete) {
// Something went wrong.
Cleanup(false);
return;
}
if (last_status_ == RESPONSE_FILTER_NEED_MORE_DATA) {
// Let the user write any remaining data.
Filter(nullptr, 0);
if (last_status_ != RESPONSE_FILTER_DONE) {
// Something went wrong.
Cleanup(false);
return;
}
}
MaybeSuccess();
}
void ResponseFilterWrapper::MaybeSuccess() {
if (!write_pending_ && !pending_data_.empty()) {
// Write the next data segment.
auto next = std::move(pending_data_.front());
pending_data_.pop();
Write(std::move(next));
return;
}
if (!read_pending_ && !write_pending_)
Cleanup(true);
}
void ResponseFilterWrapper::Cleanup(bool success) {
if (!success && error_callback_)
std::move(error_callback_).Run();
delete this;
}
} // namespace
mojo::ScopedDataPipeConsumerHandle CreateResponseFilterHandler(
CefRefPtr<CefResponseFilter> filter,
mojo::ScopedDataPipeConsumerHandle source_handle,
base::OnceClosure error_callback) {
// |filter_wrapper| will delete itself when filtering is complete if
// CreateOutputHandle returns true. Otherwise, it will return the
// original |source_handle|.
auto filter_wrapper = new ResponseFilterWrapper(
filter, std::move(source_handle), std::move(error_callback));
mojo::ScopedDataPipeConsumerHandle output_handle;
if (!filter_wrapper->CreateOutputHandle(&output_handle))
delete filter_wrapper;
return output_handle;
}
} // namespace net_service

View File

@ -0,0 +1,26 @@
// Copyright (c) 2019 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_NET_SERVICE_RESPONSE_FILTER_WRAPPER_H_
#define CEF_LIBCEF_BROWSER_NET_SERVICE_RESPONSE_FILTER_WRAPPER_H_
#include "include/cef_response_filter.h"
#include "mojo/public/cpp/system/data_pipe.h"
namespace net_service {
// Create a filter handler that will read from |source_handle| and pass the data
// through |filter|. If filtering cannot be initialized then |source_handle|
// will be returned, otherwise a new handle for retrieving the filtered output
// will be returned. If filtering fails after initialization then
// |error_callback| will be executed.
mojo::ScopedDataPipeConsumerHandle CreateResponseFilterHandler(
CefRefPtr<CefResponseFilter> filter,
mojo::ScopedDataPipeConsumerHandle source_handle,
base::OnceClosure error_callback);
} // namespace net_service
#endif // CEF_LIBCEF_BROWSER_NET_SERVICE_RESPONSE_FILTER_WRAPPER_H_

View File

@ -3,7 +3,73 @@
<title>Response Filter Test</title> <title>Response Filter Test</title>
</head> </head>
<body bgcolor="white"> <body bgcolor="white">
<p>The text shown below in <font color="red">red</font> has been replaced by the filter. This document is > 32kb in order to exceed the standard output buffer size.</p> <p>The text shown below in <font color="red">red</font> has been replaced by the filter. This document is > 64kb in order to exceed the standard output buffer size.</p>
<p><font color="red">REPLACE_THIS_STRING</font></p>
<p>0. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>1. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>2. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>3. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>4. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>5. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>6. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>7. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>8. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>9. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p><font color="red">REPLACE_THIS_STRING</font></p>
<p>0. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>1. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>2. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>3. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>4. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>5. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>6. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>7. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>8. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>9. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p><font color="red">REPLACE_THIS_STRING</font></p>
<p>0. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>1. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>2. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>3. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>4. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>5. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>6. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>7. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>8. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>9. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p><font color="red">REPLACE_THIS_STRING</font></p>
<p>0. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>1. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>2. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>3. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>4. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>5. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>6. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>7. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>8. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>9. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p><font color="red">REPLACE_THIS_STRING</font></p>
<p>0. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>1. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>2. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>3. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>4. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>5. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>6. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>7. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>8. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>9. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p><font color="red">REPLACE_THIS_STRING</font></p>
<p>0. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>1. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>2. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>3. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>4. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>5. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>6. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>7. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>8. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>9. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p><font color="red">REPLACE_THIS_STRING</font></p> <p><font color="red">REPLACE_THIS_STRING</font></p>
<p>0. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p> <p>0. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>
<p>1. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p> <p>1. It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way -- in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only.</p>

View File

@ -342,12 +342,7 @@ class RequestSendRecvTestHandler : public TestHandler {
EXPECT_TRUE(got_before_resource_load_); EXPECT_TRUE(got_before_resource_load_);
EXPECT_TRUE(got_resource_handler_); EXPECT_TRUE(got_resource_handler_);
EXPECT_TRUE(got_resource_response_); EXPECT_TRUE(got_resource_response_);
if (IsNetworkServiceEnabled()) { EXPECT_TRUE(got_resource_response_filter_);
// TODO(network): Add support for GetResourceResponseFilter.
EXPECT_FALSE(got_resource_response_filter_);
} else {
EXPECT_TRUE(got_resource_response_filter_);
}
EXPECT_TRUE(got_resource_load_complete_); EXPECT_TRUE(got_resource_load_complete_);
TestHandler::DestroyTest(); TestHandler::DestroyTest();

View File

@ -385,8 +385,11 @@ class BasicResponseTest : public TestHandler {
EXPECT_EQ(1, get_resource_handler_ct_); EXPECT_EQ(1, get_resource_handler_ct_);
EXPECT_EQ(0, on_resource_redirect_ct_); EXPECT_EQ(0, on_resource_redirect_ct_);
if (IsNetworkServiceEnabled()) { if (IsNetworkServiceEnabled()) {
// TODO(network): Add support for GetResourceResponseFilter. // Unhandled requests won't see a call to GetResourceResponseFilter.
EXPECT_EQ(0, get_resource_response_filter_ct_); if (unhandled_)
EXPECT_EQ(0, get_resource_response_filter_ct_);
else
EXPECT_EQ(1, get_resource_response_filter_ct_);
} else { } else {
EXPECT_EQ(1, get_resource_response_filter_ct_); EXPECT_EQ(1, get_resource_response_filter_ct_);
} }
@ -408,8 +411,11 @@ class BasicResponseTest : public TestHandler {
EXPECT_EQ(2, get_resource_handler_ct_); EXPECT_EQ(2, get_resource_handler_ct_);
EXPECT_EQ(0, on_resource_redirect_ct_); EXPECT_EQ(0, on_resource_redirect_ct_);
if (IsNetworkServiceEnabled()) { if (IsNetworkServiceEnabled()) {
// TODO(network): Add support for GetResourceResponseFilter. // Unhandled requests won't see a call to GetResourceResponseFilter.
EXPECT_EQ(0, get_resource_response_filter_ct_); if (unhandled_)
EXPECT_EQ(0, get_resource_response_filter_ct_);
else
EXPECT_EQ(1, get_resource_response_filter_ct_);
} else { } else {
EXPECT_EQ(2, get_resource_response_filter_ct_); EXPECT_EQ(2, get_resource_response_filter_ct_);
} }
@ -444,8 +450,11 @@ class BasicResponseTest : public TestHandler {
} }
} }
if (IsNetworkServiceEnabled()) { if (IsNetworkServiceEnabled()) {
// TODO(network): Add support for GetResourceResponseFilter. // Unhandled requests won't see a call to GetResourceResponseFilter.
EXPECT_EQ(0, get_resource_response_filter_ct_); if (unhandled_)
EXPECT_EQ(0, get_resource_response_filter_ct_);
else
EXPECT_EQ(1, get_resource_response_filter_ct_);
} else { } else {
if (mode_ == REDIRECT_RESOURCE_RESPONSE) if (mode_ == REDIRECT_RESOURCE_RESPONSE)
EXPECT_EQ(2, get_resource_response_filter_ct_); EXPECT_EQ(2, get_resource_response_filter_ct_);
@ -1285,8 +1294,11 @@ class SubresourceResponseTest : public RoutingTestHandler {
EXPECT_EQ(1, get_resource_handler_ct_); EXPECT_EQ(1, get_resource_handler_ct_);
EXPECT_EQ(0, on_resource_redirect_ct_); EXPECT_EQ(0, on_resource_redirect_ct_);
if (IsNetworkServiceEnabled()) { if (IsNetworkServiceEnabled()) {
// TODO(network): Add support for GetResourceResponseFilter. // Unhandled requests won't see a call to GetResourceResponseFilter.
EXPECT_EQ(0, get_resource_response_filter_ct_); if (unhandled_)
EXPECT_EQ(0, get_resource_response_filter_ct_);
else
EXPECT_EQ(1, get_resource_response_filter_ct_);
} else { } else {
EXPECT_EQ(1, get_resource_response_filter_ct_); EXPECT_EQ(1, get_resource_response_filter_ct_);
} }
@ -1309,8 +1321,11 @@ class SubresourceResponseTest : public RoutingTestHandler {
EXPECT_EQ(2, get_resource_handler_ct_); EXPECT_EQ(2, get_resource_handler_ct_);
EXPECT_EQ(0, on_resource_redirect_ct_); EXPECT_EQ(0, on_resource_redirect_ct_);
if (IsNetworkServiceEnabled()) { if (IsNetworkServiceEnabled()) {
// TODO(network): Add support for GetResourceResponseFilter. // Unhandled requests won't see a call to GetResourceResponseFilter.
EXPECT_EQ(0, get_resource_response_filter_ct_); if (unhandled_)
EXPECT_EQ(0, get_resource_response_filter_ct_);
else
EXPECT_EQ(1, get_resource_response_filter_ct_);
} else { } else {
EXPECT_EQ(2, get_resource_response_filter_ct_); EXPECT_EQ(2, get_resource_response_filter_ct_);
} }
@ -1341,8 +1356,11 @@ class SubresourceResponseTest : public RoutingTestHandler {
} }
} }
if (IsNetworkServiceEnabled()) { if (IsNetworkServiceEnabled()) {
// TODO(network): Add support for GetResourceResponseFilter. // Unhandled requests won't see a call to GetResourceResponseFilter.
EXPECT_EQ(0, get_resource_response_filter_ct_); if (unhandled_)
EXPECT_EQ(0, get_resource_response_filter_ct_);
else
EXPECT_EQ(1, get_resource_response_filter_ct_);
} else { } else {
if (mode_ == REDIRECT_RESOURCE_RESPONSE) if (mode_ == REDIRECT_RESOURCE_RESPONSE)
EXPECT_EQ(2, get_resource_response_filter_ct_); EXPECT_EQ(2, get_resource_response_filter_ct_);
@ -2000,8 +2018,8 @@ class RedirectResponseTest : public TestHandler {
EXPECT_EQ(expected_resource_response_ct_, resource_response_ct_); EXPECT_EQ(expected_resource_response_ct_, resource_response_ct_);
EXPECT_EQ(expected_resource_response_ct_, get_resource_handler_ct_); EXPECT_EQ(expected_resource_response_ct_, get_resource_handler_ct_);
if (IsNetworkServiceEnabled()) { if (IsNetworkServiceEnabled()) {
// TODO(network): Add support for GetResourceResponseFilter. EXPECT_EQ(expected_resource_load_complete_ct_,
EXPECT_EQ(0U, get_resource_response_filter_ct_); get_resource_response_filter_ct_);
} else { } else {
EXPECT_EQ(expected_resource_response_ct_, EXPECT_EQ(expected_resource_response_ct_,
get_resource_response_filter_ct_); get_resource_response_filter_ct_);
@ -2563,7 +2581,17 @@ namespace {
// - Filter error. // - Filter error.
const char kResponseFilterTestUrl[] = "http://tests.com/response_filter.html"; const char kResponseFilterTestUrl[] = "http://tests.com/response_filter.html";
const size_t kResponseBufferSize = 1024 * 32; // 32kb
size_t GetResponseBufferSize() {
if (IsNetworkServiceEnabled()) {
// Match the default |capacity_num_bytes| value from
// mojo::Core::CreateDataPipe.
return 64 * 1024; // 64kb
} else {
// Match |kBufferSize| from net/filter/filter_source_stream.cc.
return 32 * 1024; // 32kb
}
}
const char kInputHeader[] = "<html><head></head><body>"; const char kInputHeader[] = "<html><head></head><body>";
const char kInputFooter[] = "</body></html>"; const char kInputFooter[] = "</body></html>";
@ -2691,7 +2719,7 @@ class ResponseFilterPassThru : public ResponseFilterTestBase {
} }
std::string GetInput() override { std::string GetInput() override {
input_ = CreateInput("FOOBAR ", kResponseBufferSize * 2U); input_ = CreateInput("FOOBAR ", GetResponseBufferSize() * 2U + 1);
return input_; return input_;
} }
@ -2702,12 +2730,12 @@ class ResponseFilterPassThru : public ResponseFilterTestBase {
received_content); received_content);
if (limit_read_) if (limit_read_)
// Expected to read 2 full buffers of kResponseBufferSize at 1kb // Expected to read 2 full buffers of GetResponseBufferSize() at 1kb
// increments (2 * 32) and one partial buffer. // increments and one partial buffer.
EXPECT_EQ(2U * 32U + 1U, filter_count_); EXPECT_EQ(2U * (GetResponseBufferSize() / 1024) + 1U, filter_count_);
else { else {
// Expected to read 2 full buffers of kResponseBufferSize and one partial // Expected to read 2 full buffers of GetResponseBufferSize() and one
// buffer. // partial buffer.
EXPECT_EQ(3U, filter_count_); EXPECT_EQ(3U, filter_count_);
} }
EXPECT_STREQ(input_.c_str(), received_content.c_str()); EXPECT_STREQ(input_.c_str(), received_content.c_str());
@ -2812,8 +2840,9 @@ class ResponseFilterNeedMore : public ResponseFilterTestBase {
} }
std::string GetInput() override { std::string GetInput() override {
const std::string& input = CreateInput( const std::string& input =
std::string(kFindString) + " ", kResponseBufferSize * 2U, &repeat_ct_); CreateInput(std::string(kFindString) + " ",
GetResponseBufferSize() * 2U + 1, &repeat_ct_);
input_size_ = input.size(); input_size_ = input.size();
const size_t find_size = sizeof(kFindString) - 1; const size_t find_size = sizeof(kFindString) - 1;
@ -2842,8 +2871,8 @@ class ResponseFilterNeedMore : public ResponseFilterTestBase {
// Filtered content length should be the output size. // Filtered content length should be the output size.
EXPECT_EQ(output.size(), received_content.size()); EXPECT_EQ(output.size(), received_content.size());
// Expected to read 2 full buffers of kResponseBufferSize and one partial // Expected to read 2 full buffers of GetResponseBufferSize() and one
// buffer, and then one additional call to drain the overflow. // partial buffer, and then one additional call to drain the overflow.
EXPECT_EQ(4U, filter_count_); EXPECT_EQ(4U, filter_count_);
} }