#include "remoting/signaling/ftl_messaging_client.h"
#include <algorithm>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "base/check.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "base/notreached.h"
#include "base/run_loop.h"
#include "base/task/thread_pool.h"
#include "base/test/bind.h"
#include "base/test/mock_callback.h"
#include "base/test/task_environment.h"
#include "remoting/base/fake_oauth_token_getter.h"
#include "remoting/base/protobuf_http_client.h"
#include "remoting/base/protobuf_http_status.h"
#include "remoting/base/protobuf_http_test_responder.h"
#include "remoting/base/scoped_protobuf_http_request.h"
#include "remoting/proto/ftl/v1/ftl_messages.pb.h"
#include "remoting/signaling/ftl_services_context.h"
#include "remoting/signaling/message_reception_channel.h"
#include "remoting/signaling/registration_manager.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace remoting {
namespace {
_;
Invoke;
Property;
Return;
Truly;
constexpr char kFakeServerEndpoint[] = …;
constexpr char kFakeSenderId[] = …;
constexpr char kFakeSenderRegId[] = …;
constexpr char kFakeReceiverId[] = …;
constexpr char kMessage1Id[] = …;
constexpr char kMessage2Id[] = …;
constexpr char kMessage1Text[] = …;
constexpr char kMessage2Text[] = …;
MATCHER(IsFakeSenderId, "") { … }
ftl::ChromotingMessage CreateXmppMessage(const std::string& message_text) { … }
ftl::InboxMessage CreateInboxMessage(const std::string& message_id,
const std::string& message_text) { … }
base::OnceCallback<void(const ProtobufHttpStatus&)>
CheckStatusThenQuitRunLoopCallback(
const base::Location& from_here,
ProtobufHttpStatus::Code expected_status_code,
base::RunLoop* run_loop) { … }
std::string GetChromotingMessageText(const ftl::InboxMessage& message) { … }
class MockMessageReceptionChannel : public MessageReceptionChannel { … };
class MockRegistrationManager : public RegistrationManager { … };
decltype(auto) StanzaTextMatches(const std::string& expected_stanza) { … }
}
class FtlMessagingClientTest : public testing::Test { … };
void FtlMessagingClientTest::SetUp() { … }
void FtlMessagingClientTest::TearDown() { … }
TEST_F(FtlMessagingClientTest, TestSendMessage_Unauthenticated) { … }
TEST_F(FtlMessagingClientTest, TestSendMessage_SendOneMessageWithoutRegId) { … }
TEST_F(FtlMessagingClientTest, TestSendMessage_SendOneMessageWithRegId) { … }
TEST_F(FtlMessagingClientTest, TestStartReceivingMessages_CallbacksForwarded) { … }
TEST_F(FtlMessagingClientTest, TestStopReceivingMessages_CallForwarded) { … }
TEST_F(FtlMessagingClientTest,
TestStreamOpener_StreamsTwoMessagesThenCloseByServer) { … }
TEST_F(FtlMessagingClientTest,
TestOnMessageReceived_MessagePassedToSubscriberAndAcked) { … }
TEST_F(FtlMessagingClientTest, ReceivedDuplicatedMessage_AckAndDrop) { … }
}