#include "chrome/browser/extensions/api/messaging/native_message_process_host.h"
#include <stddef.h>
#include <stdint.h>
#include <memory>
#include <optional>
#include <utility>
#include <vector>
#include "base/base_paths.h"
#include "base/base_switches.h"
#include "base/command_line.h"
#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_file.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/json/json_reader.h"
#include "base/memory/page_size.h"
#include "base/path_service.h"
#include "base/rand_util.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/thread_pool.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/test_timeouts.h"
#include "base/threading/platform_thread.h"
#include "base/time/time.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/api/messaging/native_messaging_launch_from_native.h"
#include "chrome/browser/extensions/api/messaging/native_messaging_test_util.h"
#include "chrome/browser/extensions/api/messaging/native_process_launcher.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/testing_profile.h"
#include "components/version_info/version_info.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/test/browser_task_environment.h"
#include "extensions/common/extension.h"
#include "extensions/common/features/feature_channel.h"
#include "net/base/file_stream.h"
#include "testing/gtest/include/gtest/gtest.h"
#if BUILDFLAG(IS_POSIX)
#include "base/files/file_descriptor_watcher_posix.h"
#endif
#if BUILDFLAG(IS_WIN)
#include <windows.h>
#include "base/win/scoped_handle.h"
#else
#include <unistd.h>
#endif
namespace {
const char kTestMessage[] = …;
}
namespace extensions {
class FakeLauncher : public NativeProcessLauncher { … };
class NativeMessagingTest : public ::testing::Test,
public NativeMessageHost::Client { … };
TEST_F(NativeMessagingTest, SingleSendMessageRead) { … }
TEST_F(NativeMessagingTest, SingleSendMessageWrite) { … }
TEST_F(NativeMessagingTest, EchoConnect) { … }
TEST_F(NativeMessagingTest, ReconnectArgs) { … }
TEST_F(NativeMessagingTest, ReconnectArgs_Disabled) { … }
TEST_F(NativeMessagingTest, ReconnectArgsIfNativeConnectionDisallowed) { … }
TEST_F(NativeMessagingTest, UserLevel) { … }
TEST_F(NativeMessagingTest, DisallowUserLevel) { … }
}