5#ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_TESTING_TEST_BINARY_MESSENGER_H_
6#define FLUTTER_SHELL_PLATFORM_WINDOWS_TESTING_TEST_BINARY_MESSENGER_H_
12#include "flutter/fml/logging.h"
13#include "flutter/fml/macros.h"
14#include "flutter/shell/platform/common/client_wrapper/include/flutter/binary_messenger.h"
28 : send_handler_(
std::move(send_handler)) {}
39 auto handler = registered_handlers_.find(channel);
40 if (handler == registered_handlers_.end()) {
43 (handler->second)(
message, message_size, reply);
48 void Send(
const std::string& channel,
54 send_handler_(channel,
message, message_size, reply);
61 registered_handlers_[channel] = handler;
63 registered_handlers_.erase(channel);
69 SendHandler send_handler_;
72 std::map<std::string, BinaryMessageHandler> registered_handlers_;
void Send(const std::string &channel, const uint8_t *message, size_t message_size, BinaryReply reply) const override
virtual ~TestBinaryMessenger()=default
void SetMessageHandler(const std::string &channel, BinaryMessageHandler handler) override
TestBinaryMessenger(SendHandler send_handler=nullptr)
std::function< void(const std::string &channel, const uint8_t *message, size_t message_size, BinaryReply reply)> SendHandler
bool SimulateEngineMessage(const std::string &channel, const uint8_t *message, size_t message_size, BinaryReply reply)
#define FML_DCHECK(condition)
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Dart_NativeFunction function
std::function< void(const uint8_t *message, size_t message_size, BinaryReply reply)> BinaryMessageHandler
std::function< void(const uint8_t *reply, size_t reply_size)> BinaryReply