chromium/remoting/protocol/jingle_session_unittest.cc

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

#include "remoting/protocol/jingle_session.h"

#include <memory>
#include <utility>
#include <vector>

#include "base/callback_list.h"
#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/test/task_environment.h"
#include "base/test/test_timeouts.h"
#include "base/time/time.h"
#include "net/socket/socket.h"
#include "net/socket/stream_socket.h"
#include "net/url_request/url_request_context_getter.h"
#include "remoting/base/constants.h"
#include "remoting/protocol/authenticator.h"
#include "remoting/protocol/channel_authenticator.h"
#include "remoting/protocol/chromium_port_allocator_factory.h"
#include "remoting/protocol/connection_tester.h"
#include "remoting/protocol/errors.h"
#include "remoting/protocol/fake_authenticator.h"
#include "remoting/protocol/jingle_session_manager.h"
#include "remoting/protocol/network_settings.h"
#include "remoting/protocol/protocol_mock_objects.h"
#include "remoting/protocol/session_observer.h"
#include "remoting/protocol/session_plugin.h"
#include "remoting/protocol/transport.h"
#include "remoting/protocol/transport_context.h"
#include "remoting/signaling/fake_signal_strategy.h"
#include "remoting/signaling/xmpp_constants.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

_;
AtLeast;
AtMost;
DeleteArg;
DoAll;
InSequence;
Invoke;
InvokeWithoutArgs;
Return;
SaveArg;
SetArgPointee;
WithArg;

namespace remoting::protocol {

namespace {

const char kHostJid[] =;
const char kClientJid[] =;

// kHostJid the way it would be stored in the directory.
const char kNormalizedHostJid[] =;

class MockSessionManagerListener {};

class MockSessionEventHandler : public Session::EventHandler {};

class FakeTransport : public Transport {};

class FakePlugin : public SessionPlugin {};

std::unique_ptr<jingle_xmpp::XmlElement> CreateTransportInfo(
    const std::string& id) {}

}  // namespace

class JingleSessionTest : public testing::Test {};

// Verify that we can create and destroy session managers without a
// connection.
TEST_F(JingleSessionTest, CreateAndDestoy) {}

// Verify that an incoming session can be rejected, and that the
// status of the connection is set to FAILED in this case.
TEST_F(JingleSessionTest, RejectConnection) {}

// Verify that we can connect two endpoints with single-step authentication.
TEST_F(JingleSessionTest, Connect) {}

// Verify that we can connect two endpoints with multi-step authentication.
TEST_F(JingleSessionTest, ConnectWithMultistep) {}

TEST_F(JingleSessionTest, ConnectWithOutOfOrderIqs) {}

// Verify that out-of-order messages are handled correctly when the session is
// torn down after the first message.
TEST_F(JingleSessionTest, ConnectWithOutOfOrderIqsDestroyOnFirstMessage) {}

// Verify that connection is terminated when single-step auth fails.
TEST_F(JingleSessionTest, ConnectWithBadAuth) {}

// Verify that connection is terminated when multi-step auth fails.
TEST_F(JingleSessionTest, ConnectWithBadMultistepAuth) {}

// Verify that incompatible protocol configuration is handled properly.
TEST_F(JingleSessionTest, TestIncompatibleProtocol) {}

// Verify that GICE-only client is rejected with an appropriate error code.
TEST_F(JingleSessionTest, TestLegacyIceConnection) {}

TEST_F(JingleSessionTest, DeleteSessionOnIncomingConnection) {}

TEST_F(JingleSessionTest, DeleteSessionOnAuth) {}

// Verify that incoming transport-info messages are handled correctly while in
// AUTHENTICATING state.
TEST_F(JingleSessionTest, TransportInfoDuringAuthentication) {}

TEST_F(JingleSessionTest, TestSessionPlugin) {}

TEST_F(JingleSessionTest, SessionPluginShouldNotBeInvolvedInSessionTerminate) {}

TEST_F(JingleSessionTest, ImmediatelyCloseSessionAfterConnect) {}

TEST_F(JingleSessionTest, AuthenticatorRejectedAfterAccepted) {}

TEST_F(JingleSessionTest, ObserverIsNotified) {}

TEST_F(JingleSessionTest, ObserverIsNotNotifiedAfterSubscriptionIsDestroyed) {}

}  // namespace remoting::protocol