ceftests: Rename test_server::Observer::OnHttpRequest to OnTestServerRequest (see issue #3348)

This commit is contained in:
Marshall Greenblatt 2022-08-01 21:14:12 -04:00
parent 0b1c3938c6
commit 952f2b0829
10 changed files with 35 additions and 32 deletions

View File

@ -1321,8 +1321,8 @@ class CookieAccessServerHandler : public test_server::ObserverHelper,
delete this;
}
bool OnHttpRequest(CefRefPtr<CefRequest> request,
const ResponseCallback& response_callback) override {
bool OnTestServerRequest(CefRefPtr<CefRequest> request,
const ResponseCallback& response_callback) override {
EXPECT_UI_THREAD();
// Log the requests for better error reporting.

View File

@ -313,8 +313,8 @@ class TestServerObserver : public test_server::ObserverHelper {
std::move(ready_callback_).Run();
}
bool OnHttpRequest(CefRefPtr<CefRequest> request,
const ResponseCallback& response_callback) override {
bool OnTestServerRequest(CefRefPtr<CefRequest> request,
const ResponseCallback& response_callback) override {
CEF_REQUIRE_UI_THREAD();
Resource* resource = setup_->GetResource(request);
if (!resource) {

View File

@ -253,8 +253,8 @@ void Manager::OnServerHandlerDeleted() {
delete this;
}
void Manager::OnHttpRequest(CefRefPtr<CefRequest> request,
const ResponseCallback& response_callback) {
void Manager::OnTestServerRequest(CefRefPtr<CefRequest> request,
const ResponseCallback& response_callback) {
CEF_REQUIRE_UI_THREAD();
// TODO(chrome-runtime): Debug why favicon requests don't always have the
@ -276,7 +276,7 @@ void Manager::OnHttpRequest(CefRefPtr<CefRequest> request,
ObserverList::const_iterator it = list.begin();
for (; it != list.end(); ++it) {
if ((*it)->OnHttpRequest(request, response_callback)) {
if ((*it)->OnTestServerRequest(request, response_callback)) {
handled = true;
break;
}

View File

@ -74,8 +74,8 @@ class Manager : public Runner::Delegate {
void OnServerCreated(const std::string& server_origin) override;
void OnServerDestroyed() override;
void OnServerHandlerDeleted() override;
void OnHttpRequest(CefRefPtr<CefRequest> request,
const ResponseCallback& response_callback) override;
void OnTestServerRequest(CefRefPtr<CefRequest> request,
const ResponseCallback& response_callback) override;
private:
const bool https_server_;

View File

@ -30,8 +30,9 @@ class Observer {
// Return true and execute |response_callback| either synchronously or
// asynchronously if the request was handled. Do not execute
// |response_callback| when returning false.
virtual bool OnHttpRequest(CefRefPtr<CefRequest> request,
const ResponseCallback& response_callback) = 0;
virtual bool OnTestServerRequest(
CefRefPtr<CefRequest> request,
const ResponseCallback& response_callback) = 0;
protected:
virtual ~Observer() = default;

View File

@ -73,8 +73,8 @@ class TestServerObserver : public test_server::ObserverHelper {
weak_ptr_factory_.GetWeakPtr()));
}
bool OnHttpRequest(CefRefPtr<CefRequest> request,
const ResponseCallback& response_callback) override {
bool OnTestServerRequest(CefRefPtr<CefRequest> request,
const ResponseCallback& response_callback) override {
CEF_REQUIRE_UI_THREAD();
const std::string& url = request->GetURL();
if (url != url_)

View File

@ -31,8 +31,9 @@ class Runner {
virtual void OnServerHandlerDeleted() = 0;
// Server request notification.
virtual void OnHttpRequest(CefRefPtr<CefRequest> request,
const ResponseCallback& response_callback) = 0;
virtual void OnTestServerRequest(
CefRefPtr<CefRequest> request,
const ResponseCallback& response_callback) = 0;
protected:
virtual ~Delegate() = default;

View File

@ -59,7 +59,7 @@ class ServerHandler : public CefServerHandler {
const CefString& client_address,
CefRefPtr<CefRequest> request) override {
EXPECT_TRUE(server->GetTaskRunner()->BelongsToCurrentThread());
NotifyHttpRequest(server, connection_id, client_address, request);
NotifyTestServerRequest(server, connection_id, client_address, request);
}
void OnWebSocketRequest(CefRefPtr<CefServer> server,
@ -95,20 +95,20 @@ class ServerHandler : public CefServerHandler {
delegate_->OnServerDestroyed();
}
void NotifyHttpRequest(CefRefPtr<CefServer> server,
int connection_id,
const CefString& client_address,
CefRefPtr<CefRequest> request) {
void NotifyTestServerRequest(CefRefPtr<CefServer> server,
int connection_id,
const CefString& client_address,
CefRefPtr<CefRequest> request) {
if (!CefCurrentlyOn(TID_UI)) {
CefPostTask(TID_UI, base::BindOnce(&ServerHandler::NotifyHttpRequest,
this, server, connection_id,
client_address, request));
CefPostTask(TID_UI, base::BindOnce(
&ServerHandler::NotifyTestServerRequest, this,
server, connection_id, client_address, request));
return;
}
auto response_callback = base::BindRepeating(&ServerHandler::SendResponse,
server, connection_id);
delegate_->OnHttpRequest(request, response_callback);
delegate_->OnTestServerRequest(request, response_callback);
}
static void SendResponse(CefRefPtr<CefServer> server,

View File

@ -54,7 +54,7 @@ class ServerHandler : public CefTestServerHandler {
CefRefPtr<CefTestServer> server,
CefRefPtr<CefRequest> request,
CefRefPtr<CefTestServerConnection> connection) override {
NotifyHttpRequest(request, connection);
NotifyTestServerRequest(request, connection);
return true;
}
@ -69,17 +69,18 @@ class ServerHandler : public CefTestServerHandler {
delegate_->OnServerDestroyed();
}
void NotifyHttpRequest(CefRefPtr<CefRequest> request,
CefRefPtr<CefTestServerConnection> connection) {
void NotifyTestServerRequest(CefRefPtr<CefRequest> request,
CefRefPtr<CefTestServerConnection> connection) {
if (!CefCurrentlyOn(TID_UI)) {
CefPostTask(TID_UI, base::BindOnce(&ServerHandler::NotifyHttpRequest,
this, request, connection));
CefPostTask(TID_UI,
base::BindOnce(&ServerHandler::NotifyTestServerRequest, this,
request, connection));
return;
}
auto response_callback =
base::BindRepeating(&ServerHandler::SendResponse, connection);
delegate_->OnHttpRequest(request, response_callback);
delegate_->OnTestServerRequest(request, response_callback);
}
static void SendResponse(CefRefPtr<CefTestServerConnection> connection,

View File

@ -1303,8 +1303,8 @@ class RequestServerHandler : public test_server::ObserverHelper {
delete this;
}
bool OnHttpRequest(CefRefPtr<CefRequest> request,
const ResponseCallback& response_callback) override {
bool OnTestServerRequest(CefRefPtr<CefRequest> request,
const ResponseCallback& response_callback) override {
EXPECT_UI_THREAD();
// Log the requests for better error reporting.