#include "remoting/signaling/ftl_signal_strategy.h"
#include <memory>
#include <string>
#include <vector>
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/test/task_environment.h"
#include "remoting/base/oauth_token_getter.h"
#include "remoting/base/protobuf_http_status.h"
#include "remoting/proto/ftl/v1/ftl_messages.pb.h"
#include "remoting/signaling/messaging_client.h"
#include "remoting/signaling/registration_manager.h"
#include "remoting/signaling/signaling_address.h"
#include "remoting/signaling/xmpp_constants.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/libjingle_xmpp/xmllite/xmlelement.h"
namespace remoting {
namespace {
_;
ByMove;
Mock;
Return;
constexpr char kFakeLocalUsername[] = …;
constexpr char kFakeRemoteUsername[] = …;
constexpr char kFakeOAuthToken[] = …;
constexpr char kFakeFtlAuthToken[] = …;
constexpr char kFakeLocalRegistrationId[] = …;
constexpr char kFakeRemoteRegistrationId[] = …;
constexpr char kFakeLocalFtlId[] = …;
constexpr char kFakeRemoteFtlId[] = …;
enum class Direction { … };
std::unique_ptr<jingle_xmpp::XmlElement> CreateXmlStanza(
Direction direction,
const std::string& id) { … }
class MockOAuthTokenGetter : public OAuthTokenGetter { … };
class FakeMessagingClient : public MessagingClient { … };
class FakeRegistrationManager : public RegistrationManager { … };
}
class FtlSignalStrategyTest : public testing::Test,
public SignalStrategy::Listener { … };
TEST_F(FtlSignalStrategyTest, OAuthTokenGetterAuthError) { … }
TEST_F(FtlSignalStrategyTest, SignInGaiaAuthError_InvalidatesOAuthToken) { … }
TEST_F(FtlSignalStrategyTest, StartStream_Success) { … }
TEST_F(FtlSignalStrategyTest, StartStream_Failure) { … }
TEST_F(FtlSignalStrategyTest, StreamRemotelyClosed) { … }
TEST_F(FtlSignalStrategyTest, SendStanza_Success) { … }
TEST_F(FtlSignalStrategyTest, SendStanza_AuthError) { … }
TEST_F(FtlSignalStrategyTest, SendStanza_NetworkError) { … }
TEST_F(FtlSignalStrategyTest, ReceiveStanza_Success) { … }
TEST_F(FtlSignalStrategyTest, ReceiveMessage_DelieverMessageAndDropStanza) { … }
TEST_F(FtlSignalStrategyTest, ReceiveStanza_DropMessageWithMalformedXmpp) { … }
TEST_F(FtlSignalStrategyTest, SendMessage_Success) { … }
TEST_F(FtlSignalStrategyTest, SendMessage_AuthError) { … }
TEST_F(FtlSignalStrategyTest, SendMessage_NetworkError) { … }
}