#include "extensions/renderer/api/messaging/one_time_message_handler.h"
#include <memory>
#include <string_view>
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/test/gmock_callback_support.h"
#include "extensions/common/api/messaging/message.h"
#include "extensions/common/api/messaging/port_id.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_builder.h"
#include "extensions/common/mojom/context_type.mojom.h"
#include "extensions/common/mojom/message_port.mojom-shared.h"
#include "extensions/renderer/api/messaging/message_target.h"
#include "extensions/renderer/api/messaging/messaging_util.h"
#include "extensions/renderer/api/messaging/mock_message_port_host.h"
#include "extensions/renderer/bindings/api_binding_test_util.h"
#include "extensions/renderer/bindings/api_binding_types.h"
#include "extensions/renderer/bindings/api_bindings_system.h"
#include "extensions/renderer/bindings/api_request_handler.h"
#include "extensions/renderer/native_extension_bindings_system.h"
#include "extensions/renderer/native_extension_bindings_system_test_base.h"
#include "extensions/renderer/script_context.h"
#include "gin/data_object_builder.h"
#include "ipc/ipc_message.h"
namespace extensions {
namespace {
constexpr char kEchoArgsAndError[] = …;
}
class OneTimeMessageHandlerTest : public NativeExtensionBindingsSystemUnittest { … };
TEST_F(OneTimeMessageHandlerTest, SendMessageAndDontExpectReply) { … }
TEST_F(OneTimeMessageHandlerTest, SendMessageAndExpectCallbackReply) { … }
TEST_F(OneTimeMessageHandlerTest, SendMessageAndExpectPromiseReply) { … }
TEST_F(OneTimeMessageHandlerTest, DisconnectOpenerCallback) { … }
TEST_F(OneTimeMessageHandlerTest, DisconnectOpenerPromise) { … }
TEST_F(OneTimeMessageHandlerTest, DeliverMessageToReceiverWithNoReply) { … }
TEST_F(OneTimeMessageHandlerTest, DeliverMessageToReceiverAndReply) { … }
TEST_F(OneTimeMessageHandlerTest, TryReplyingMultipleTimes) { … }
TEST_F(OneTimeMessageHandlerTest, SendMessageInListener) { … }
TEST_F(OneTimeMessageHandlerTest, SendMessageInCallback) { … }
TEST_F(OneTimeMessageHandlerTest, ResponseCallbackGarbageCollected) { … }
TEST_F(OneTimeMessageHandlerTest, ChannelClosedIfTrueNotReturned) { … }
}