chromium/chrome/test/chromedriver/server/http_handler_unittest.cc

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/test/chromedriver/server/http_handler.h"

#include <memory>
#include <string>

#include "base/functional/bind.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/task_environment.h"
#include "base/threading/thread.h"
#include "base/values.h"
#include "chrome/test/chromedriver/chrome/status.h"
#include "chrome/test/chromedriver/command.h"
#include "chrome/test/chromedriver/server/http_server.h"
#include "net/http/http_status_code.h"
#include "net/server/http_server_request_info.h"
#include "net/server/http_server_response_info.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

_;
ContainsRegex;
Eq;
Field;
Optional;
Pointee;
Property;

namespace {

void DummyCommand(const Status& status,
                  const base::Value::Dict& params,
                  const std::string& session_id,
                  const CommandCallback& callback) {}

void OnResponse(net::HttpServerResponseInfo* response_to_set,
                std::unique_ptr<net::HttpServerResponseInfo> response) {}

template <int Code>
testing::AssertionResult StatusCodeIs(const Status& status) {}

testing::AssertionResult StatusOk(const Status& status) {}

std::string ToString(const base::Value::Dict& dict) {}

class MockHttpServer : public virtual HttpServerInterface {};

}  // namespace

TEST(HttpHandlerTest, HandleOutsideOfBaseUrl) {}

TEST(HttpHandlerTest, HandleUnknownCommand) {}

TEST(HttpHandlerTest, HandleNewSession) {}

TEST(HttpHandlerTest, HandleInvalidPost) {}

TEST(HttpHandlerTest, HandleUnimplementedCommand) {}

TEST(HttpHandlerTest, HandleCommand) {}

TEST(HttpHandlerTest, StandardResponse_ErrorNoMessage) {}

TEST(MatchesCommandTest, DiffMethod) {}

TEST(MatchesCommandTest, DiffPathLength) {}

TEST(MatchesCommandTest, DiffPaths) {}

TEST(MatchesCommandTest, Substitution) {}

TEST(MatchesCommandTest, DecodeEscape) {}

TEST(MatchesCommandTest, DecodePercent) {}

TEST(ParseBidiCommandTest, WellFormed) {}

TEST(ParseBidiCommandTest, MaxId) {}

TEST(ParseBidiCommandTest, MalformedJson) {}

TEST(ParseBidiCommandTest, NotDictionary) {}

TEST(ParseBidiCommandTest, NoId) {}

TEST(ParseBidiCommandTest, WrongIdType) {}

TEST(ParseBidiCommandTest, NoMethod) {}

TEST(ParseBidiCommandTest, WrongMethodType) {}

TEST(ParseBidiCommandTest, NoParams) {}

TEST(ParseBidiCommandTest, WrongParamsType) {}

TEST(CreateBidiErrorResponse, WithId) {}

TEST(CreateBidiErrorResponse, NoId) {}

class WebSocketMessageTest : public testing::Test {};

TEST_F(WebSocketMessageTest, UnknownSessionNoId) {}

TEST_F(WebSocketMessageTest, UnknownSessionNoIdIsPostedToIO) {}

TEST_F(WebSocketMessageTest, UnknownSessionWithId) {}

TEST_F(WebSocketMessageTest, UnknownSessionWithIdIsPostedToIO) {}

TEST_F(WebSocketMessageTest, SessionCommandWithIdUnboundConnection) {}

TEST_F(WebSocketMessageTest, SessionCommandWithIdPostedToIOUnboundConnection) {}

TEST_F(WebSocketMessageTest, SessionCommandNoIdUnboundConnection) {}

TEST_F(WebSocketMessageTest, SessionCommandNoIdPostedToIOUnboundConnection) {}

TEST_F(WebSocketMessageTest, SessionCommandNoIdBoundConnection) {}

TEST_F(WebSocketMessageTest, SessionCommandNoIdPostedToIOBoundConnection) {}

TEST_F(WebSocketMessageTest, NoMethodUnboundConnection) {}

TEST_F(WebSocketMessageTest, NoMethodPostedToIOUnboundConnection) {}

TEST_F(WebSocketMessageTest, NoMethodBoundConnection) {}

TEST_F(WebSocketMessageTest, NoMethodPostedToIOBoundConnection) {}

TEST_F(WebSocketMessageTest, SessionCommandNoParamsUnboundConnection) {}

TEST_F(WebSocketMessageTest,
       SessionCommandNoParamsPostedToIOUnboundConnection) {}

TEST_F(WebSocketMessageTest, SessionCommandNoParamsBoundConnection) {}

TEST_F(WebSocketMessageTest, SessionCommandNoParamsPostedToIOBoundConnection) {}

TEST_F(WebSocketMessageTest, MalformedJson) {}

TEST_F(WebSocketMessageTest, MalformedJsonPostedToIO) {}

TEST_F(WebSocketMessageTest, UnknownCommandUnboundConnection) {}

TEST_F(WebSocketMessageTest, UnknownCommandIsPostedToIOUnboundConnection) {}

TEST_F(WebSocketMessageTest, UnknownCommandBoundConnection) {}

TEST_F(WebSocketMessageTest, StaticCommandNoIdUnboundConnection) {}

TEST_F(WebSocketMessageTest, StaticCommandNoIdPostedToIOUnboundConnection) {}

TEST_F(WebSocketMessageTest, StaticCommandNoIdBoundConnection) {}

TEST_F(WebSocketMessageTest, StaticCommandNoIdPostedToBoundConnection) {}

TEST_F(WebSocketMessageTest, StaticCommandNoParamsUnboundConnection) {}

TEST_F(WebSocketMessageTest, StaticCommandNoParamsPostedToIOUnboundConnection) {}

TEST_F(WebSocketMessageTest, StaticCommandNoParamsBoundConnection) {}

TEST_F(WebSocketMessageTest, StaticCommandNoParamsPostedToIOBoundConnection) {}

TEST_F(WebSocketMessageTest, KnownStaticCommandReturnsSuccess) {}

TEST_F(WebSocketMessageTest, KnownStaticCommandReturnsError) {}

TEST_F(WebSocketMessageTest, KnownStaticCommandResponseIsPostedToIO) {}

TEST_F(WebSocketMessageTest, SessionCommandReturnsSuccess) {}

TEST_F(WebSocketMessageTest, SessionCommandNoReturnValue) {}

TEST_F(WebSocketMessageTest, SessionCommandReturnsError) {}

TEST_F(WebSocketMessageTest, SessionCommandResponseIsPostedToIO) {}

TEST_F(WebSocketMessageTest, StaticCommandOnSessionBoundConnection) {}

TEST_F(WebSocketMessageTest, SessionNew) {}

TEST_F(WebSocketMessageTest, SessionEnd) {}

class WebSocketRequestTest : public testing::Test {};

TEST_F(WebSocketRequestTest, UnknownPath) {}

TEST_F(WebSocketRequestTest, UnknownSession) {}

TEST_F(WebSocketRequestTest, ConnectionAlreadyBound) {}

TEST_F(WebSocketRequestTest, CreateUnboundConnection) {}