chromium/extensions/renderer/api/runtime_hooks_delegate_unittest.cc

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "extensions/renderer/api/runtime_hooks_delegate.h"

#include <memory>
#include <string_view>

#include "base/memory/raw_ptr.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
#include "components/crx_file/id_util.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_builder.h"
#include "extensions/common/mojom/context_type.mojom.h"
#include "extensions/common/mojom/frame.mojom.h"
#include "extensions/common/mojom/message_port.mojom-shared.h"
#include "extensions/renderer/api/messaging/message_target.h"
#include "extensions/renderer/api/messaging/native_renderer_messaging_service.h"
#include "extensions/renderer/api/messaging/send_message_tester.h"
#include "extensions/renderer/bindings/api_binding_test_util.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 "extensions/renderer/script_context_set.h"

namespace extensions {
namespace {

void CallAPIAndExpectError(v8::Local<v8::Context> context,
                           std::string_view method_name,
                           std::string_view args) {}

}  // namespace

class RuntimeHooksDelegateTest : public NativeExtensionBindingsSystemUnittest {};

TEST_F(RuntimeHooksDelegateTest, RuntimeId) {}

TEST_F(RuntimeHooksDelegateTest, GetManifest) {}

TEST_F(RuntimeHooksDelegateTest, GetURL) {}

TEST_F(RuntimeHooksDelegateTest, Connect) {}

// Tests the end-to-end (renderer) flow for a call to runtime.sendMessage
// from the call in JS to the expected IPCs. The intricacies of sendMessage
// are also tested more in the renderer messaging service unittests.
TEST_F(RuntimeHooksDelegateTest, SendMessage) {}

// Test that some incorrect invocations of sendMessage() throw errors.
TEST_F(RuntimeHooksDelegateTest, SendMessageErrors) {}

TEST_F(RuntimeHooksDelegateTest, ConnectWithTrickyOptions) {}

class RuntimeHooksDelegateNativeMessagingTest
    : public RuntimeHooksDelegateTest {};

TEST_F(RuntimeHooksDelegateNativeMessagingTest, ConnectNative) {}

TEST_F(RuntimeHooksDelegateNativeMessagingTest, SendNativeMessage) {}

class RuntimeHooksDelegateMV3Test : public RuntimeHooksDelegateTest {};

TEST_F(RuntimeHooksDelegateMV3Test, SendMessageUsingPromise) {}

// Test that the asynchronous return from runtime.requestUpdateCheck differs in
// structure for callback based calls vs promise based calls.
// Note: This doesn't exercise the actual implementation of the API, just that
// the bindings modify the structure of the result.
TEST_F(RuntimeHooksDelegateMV3Test, RequestUpdateCheck) {}

class RuntimeHooksDelegateNativeMessagingMV3Test
    : public RuntimeHooksDelegateTest {};

TEST_F(RuntimeHooksDelegateNativeMessagingMV3Test, SendNativeMessage) {}

}  // namespace extensions