blob: 89422d02a83f6aeec40efff109de725231cf634c [file] [log] [blame]
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <memory>
namespace net {
class StreamSocket;
namespace test_server {
// An interface for connection event notifications.
class EmbeddedTestServerConnectionListener {
// Notified when a socket was accepted by the EmbeddedTestServer. The listener
// can return |socket| or a wrapper to customize the socket behavior.
virtual std::unique_ptr<StreamSocket> AcceptedSocket(
std::unique_ptr<StreamSocket> socket) = 0;
// Notified when a socket was read from by the EmbeddedTestServer.
virtual void ReadFromSocket(const StreamSocket& socket, int rv) = 0;
// Notified when the EmbeddedTestServer has completed a request and response
// successfully on |socket|. The listener can take |socket| to manually handle
// further traffic on it (for example, if doing a proxy tunnel), otherwise
// |socket| is destroyed.
virtual void OnResponseCompletedSuccessfully(
std::unique_ptr<StreamSocket> socket) {}
EmbeddedTestServerConnectionListener() {}
virtual ~EmbeddedTestServerConnectionListener() {}
} // namespace test_server
} // namespace net