Skip to content

Commit

Permalink
Increase WebDriverServer max buffer size.
Browse files Browse the repository at this point in the history
Resolves timeout issues when screenshots exceed the default 1mb buffer
size and are unable to be sent.

b/344007302

Change-Id: I8b7d7972fe0dbdf449b1c6ddc02ae50e397ec6a2
  • Loading branch information
briantting committed Jun 3, 2024
1 parent 6d442f4 commit 3805c7b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cobalt/webdriver/server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ class ResponseHandlerImpl : public WebDriverServer::ResponseHandler {
ResponseHandlerImpl(net::HttpServer* server, int connection_id)
: task_runner_(base::SequencedTaskRunner::GetCurrentDefault()),
server_(server),
connection_id_(connection_id) {}
connection_id_(connection_id) {
server_->SetReceiveBufferSize(connection_id_, kMaxRecieveBufferSize);
server_->SetSendBufferSize(connection_id_, kMaxSendBufferSize);
}

// https://www.selenium.dev/documentation/legacy/json_wire_protocol/#responses
void Success(std::unique_ptr<base::Value> value) override {
Expand Down
3 changes: 3 additions & 0 deletions cobalt/webdriver/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ class WebDriverServer : public net::HttpServer::Delegate {
// client.
class ResponseHandler {
public:
static const int kMaxRecieveBufferSize = 2 * 1024 * 1024; // 2 Mbytes.
static const int kMaxSendBufferSize = 8 * 1024 * 1024; // 8 Mbytes.

// Called after a successful WebDriver command.
// https://www.selenium.dev/documentation/legacy/json_wire_protocol/#responses
virtual void Success(std::unique_ptr<base::Value>) = 0;
Expand Down

0 comments on commit 3805c7b

Please sign in to comment.