chromium/extensions/renderer/bindings/api_signature_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/bindings/api_signature.h"

#include <string_view>

#include "base/values.h"
#include "extensions/renderer/bindings/api_binding_test.h"
#include "extensions/renderer/bindings/api_binding_test_util.h"
#include "extensions/renderer/bindings/api_invocation_errors.h"
#include "extensions/renderer/bindings/api_type_reference_map.h"
#include "extensions/renderer/bindings/argument_spec.h"
#include "extensions/renderer/bindings/argument_spec_builder.h"
#include "extensions/renderer/bindings/binding_access_checker.h"
#include "extensions/renderer/bindings/returns_async_builder.h"
#include "gin/converter.h"
#include "gin/dictionary.h"

namespace extensions {

ArgumentError;
InvalidType;
kTypeBoolean;
kTypeInteger;
kTypeString;
NoMatchingSignature;

namespace {

SpecVector;
ReturnsAsync;

std::unique_ptr<APISignature> OneString() {}

SpecVector StringAndIntSpec() {}

std::unique_ptr<APISignature> StringAndInt() {}

SpecVector StringOptionalIntAndBoolSpec() {}

std::unique_ptr<APISignature> StringOptionalIntAndBool() {}

SpecVector StringAndOptionalIntSpec() {}

std::unique_ptr<APISignature> OneObject() {}

std::unique_ptr<APISignature> NoArgs() {}

std::unique_ptr<APISignature> IntAndCallback() {}

std::unique_ptr<APISignature> IntAndOptionalCallback() {}

std::unique_ptr<APISignature> OptionalIntAndCallback() {}

std::unique_ptr<APISignature> OptionalCallback() {}

std::unique_ptr<APISignature> IntAnyOptionalObjectOptionalCallback() {}

std::unique_ptr<APISignature> RefObj() {}

std::unique_ptr<APISignature> RefEnum() {}

std::unique_ptr<APISignature> OptionalObjectAndOptionalCallback() {}

std::unique_ptr<APISignature> OptionalIntAndNumber() {}

std::unique_ptr<APISignature> OptionalIntAndInt() {}

v8::LocalVector<v8::Value> StringToV8Vector(v8::Local<v8::Context> context,
                                            const char* args) {}

}  // namespace

class APISignatureTest : public APIBindingTest {};

TEST_F(APISignatureTest, BasicSignatureParsing) {}

TEST_F(APISignatureTest, TypeRefsTest) {}

TEST_F(APISignatureTest, ExpectedSignature) {}

TEST_F(APISignatureTest, ParseIgnoringSchema) {}

TEST_F(APISignatureTest, ParseIgnoringSchemaWithPromises) {}

TEST_F(APISignatureTest, ParseArgumentsToV8) {}

// Tests that unspecified optional callback is filled with NullCallback in
// APISignature.
//
// Regression test for https://crbug.com/1218569.
TEST_F(APISignatureTest, ParseArgumentsToV8WithUnspecifiedOptionalCallback) {}

// Tests response validation, which is stricter than typical validation.
TEST_F(APISignatureTest, ValidateResponse) {}

// Tests signature parsing when promise-based responses are supported.
TEST_F(APISignatureTest, PromisesSupport) {}

}  // namespace extensions