#include "chrome/test/chromedriver/net/stub_sync_websocket.h"
#include "base/functional/bind.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/values.h"
#include "chrome/test/chromedriver/net/timeout.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
namespace {
bool ParseCommand(const base::Value::Dict& command,
int* cmd_id,
std::string* method,
base::Value::Dict* params,
std::string* session_id) { … }
bool ParseMessage(const std::string& message,
int* cmd_id,
std::string* method,
base::Value::Dict* params,
std::string* session_id) { … }
}
StubSyncWebSocket::StubSyncWebSocket() { … }
StubSyncWebSocket::~StubSyncWebSocket() = default;
bool StubSyncWebSocket::IsConnected() { … }
bool StubSyncWebSocket::Connect(const GURL& url) { … }
bool StubSyncWebSocket::Send(const std::string& message) { … }
SyncWebSocket::StatusCode StubSyncWebSocket::ReceiveNextMessage(
std::string* message,
const Timeout& timeout) { … }
bool StubSyncWebSocket::HasNextMessage() { … }
bool StubSyncWebSocket::PopMessage(std::string* dest) { … }
void StubSyncWebSocket::GenerateDefaultResponse(int cmd_id,
base::Value::Dict& response) { … }
void StubSyncWebSocket::EnqueueHandshakeResponse(int cmd_id,
const std::string& method) { … }
void StubSyncWebSocket::AddCommandHandler(const std::string& method,
CommandHandler handler) { … }
void StubSyncWebSocket::EnqueueResponse(const std::string& message) { … }
void StubSyncWebSocket::Disconnect() { … }
base::RepeatingClosure StubSyncWebSocket::DisconnectClosure() { … }
void StubSyncWebSocket::NotifyOnEmptyQueue(base::RepeatingClosure callback) { … }
void StubSyncWebSocket::SetResponseLimit(int count) { … }