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; delete this;
} }
bool OnHttpRequest(CefRefPtr<CefRequest> request, bool OnTestServerRequest(CefRefPtr<CefRequest> request,
const ResponseCallback& response_callback) override { const ResponseCallback& response_callback) override {
EXPECT_UI_THREAD(); EXPECT_UI_THREAD();
// Log the requests for better error reporting. // Log the requests for better error reporting.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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