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
  • Loading branch information
briantting authored and kaidokert committed Jun 4, 2024
1 parent 9bc5ee3 commit 94ce7aa
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 94ce7aa

Please sign in to comment.