#include <memory>
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "mojo/public/cpp/bindings/associated_receiver_set.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "mojo/public/cpp/bindings/tests/bindings_test_base.h"
#include "mojo/public/cpp/bindings/unique_receiver_set.h"
#include "mojo/public/cpp/system/functions.h"
#include "mojo/public/interfaces/bindings/tests/ping_service.mojom.h"
#include "mojo/public/interfaces/bindings/tests/test_associated_interfaces.mojom.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace mojo {
namespace test {
class ReceiverSetStaticAssertTests { … };
namespace {
ReceiverSetTest;
template <typename ReceiverSetType, typename ContextType>
void ExpectContextHelper(const ReceiverSetType* receiver_set,
ContextType expected_context) { … }
template <typename ReceiverSetType, typename ContextType>
base::RepeatingClosure ExpectContext(const ReceiverSetType* receiver_set,
ContextType expected_context) { … }
template <typename ReceiverSetType, typename ContextType>
void ExpectMutableContextHelper(ReceiverSetType* receiver_set,
ContextType expected_context,
ContextType new_context) { … }
template <typename ReceiverSetType, typename ContextType>
base::RepeatingClosure ExpectMutableContext(ReceiverSetType* receiver_set,
ContextType expected_context,
ContextType new_context) { … }
template <typename ReceiverSetType>
void ExpectReceiverIdHelper(ReceiverSetType* receiver_set,
ReceiverId expected_receiver_id) { … }
template <typename ReceiverSetType>
base::RepeatingClosure ExpectReceiverId(ReceiverSetType* receiver_set,
ReceiverId expected_receiver_id) { … }
template <typename ReceiverSetType>
void ReportBadMessageHelper(ReceiverSetType* receiver_set,
const std::string& error) { … }
template <typename ReceiverSetType>
base::RepeatingClosure ReportBadMessage(ReceiverSetType* receiver_set,
const std::string& error) { … }
template <typename ReceiverSetType>
void SaveBadMessageCallbackHelper(ReceiverSetType* receiver_set,
ReportBadMessageCallback* callback) { … }
template <typename ReceiverSetType>
base::RepeatingClosure SaveBadMessageCallback(
ReceiverSetType* receiver_set,
ReportBadMessageCallback* callback) { … }
base::RepeatingClosure Sequence(base::RepeatingClosure first,
base::RepeatingClosure second) { … }
class PingImpl : public PingService { … };
TEST_P(ReceiverSetTest, ReceiverSetContext) { … }
TEST_P(ReceiverSetTest, ReceiverSetMutableContext) { … }
TEST_P(ReceiverSetTest, ReceiverSetGetContext) { … }
TEST_P(ReceiverSetTest, ReceiverSetGetAllContexts) { … }
TEST_P(ReceiverSetTest, ReceiverSetDispatchReceiver) { … }
TEST_P(ReceiverSetTest, ReceiverSetConnectionErrorWithReason) { … }
TEST_P(ReceiverSetTest, ReceiverSetReportBadMessage) { … }
TEST_P(ReceiverSetTest, ReceiverSetGetBadMessageCallback) { … }
TEST_P(ReceiverSetTest, ReceiverSetGetBadMessageCallbackOutlivesReceiverSet) { … }
class PingProviderImpl : public AssociatedPingProvider, public PingService { … };
TEST_P(ReceiverSetTest, AssociatedReceiverSetContext) { … }
TEST_P(ReceiverSetTest, PrimaryInterfaceReceiverSetContext) { … }
TEST_P(ReceiverSetTest, PrimaryInterfaceReceiverSetDispatchReceiver) { … }
TEST_P(ReceiverSetTest, AssociatedReceiverSetConnectionErrorWithReason) { … }
class PingInstanceCounter : public PingService { … };
int PingInstanceCounter::instance_count = …;
TEST_P(ReceiverSetTest, UniqueReceiverSetDestruction) { … }
TEST_P(ReceiverSetTest, UniqueReceiverSetDisconnect) { … }
TEST_P(ReceiverSetTest, UniqueReceiverSetRemoveEntry) { … }
INSTANTIATE_MOJO_BINDINGS_TEST_SUITE_P(…);
}
}
}