chromium/v8/test/unittests/api/accessor-unittest.cc

// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "include/v8-context.h"
#include "include/v8-function.h"
#include "include/v8-isolate.h"
#include "include/v8-local-handle.h"
#include "include/v8-object.h"
#include "include/v8-template.h"
#include "src/api/api-inl.h"
#include "src/debug/debug.h"
#include "src/execution/isolate.h"
#include "src/objects/objects-inl.h"
#include "test/unittests/test-utils.h"
#include "testing/gmock-support.h"
#include "testing/gtest/include/gtest/gtest.h"

i;

IsInt32;
IsString;
IsUndefined;

using AccessorTest = v8::TestWithContext;

// The goal is to avoid the callback.
static void UnreachableCallback(
    const v8::FunctionCallbackInfo<v8::Value>& info) {}

TEST_F(AccessorTest, CachedAccessor) {}

TEST_F(AccessorTest, CachedAccessorTurboFan) {}

TEST_F(AccessorTest, CachedAccessorOnGlobalObject) {}

namespace {

// Getter return value should be non-null to trigger lazy property paths.
void Getter(v8::Local<v8::Name> name,
            const v8::PropertyCallbackInfo<v8::Value>& info) {}

void StringGetter(v8::Local<v8::Name> name,
                  const v8::PropertyCallbackInfo<v8::Value>& info) {}

int set_accessor_call_count =;

void Setter(v8::Local<v8::Name> name, v8::Local<v8::Value> value,
            const v8::PropertyCallbackInfo<void>& info) {}

void EmptyCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {}

}  // namespace

// Re-declaration of non-configurable accessors should throw.
TEST_F(AccessorTest, RedeclareAccessor) {}

class NoopDelegate : public v8::debug::DebugDelegate {};

static void CheckSideEffectFreeAccesses(v8::Isolate* isolate,
                                        v8::Local<v8::String> call_getter,
                                        v8::Local<v8::String> call_setter) {}

TEST_F(AccessorTest, AccessorsWithSideEffects) {}

TEST_F(AccessorTest, TemplateAccessorsWithSideEffects) {}

TEST_F(AccessorTest, NativeTemplateAccessorWithSideEffects) {}

TEST_F(AccessorTest, NativeAccessorsWithSideEffects) {}

// Accessors can be allowlisted as side-effect-free via SetNativeDataProperty.
TEST_F(AccessorTest, AccessorSetHasNoSideEffect) {}

// Set accessors can be allowlisted as side-effect-free via
// SetNativeDataProperty.
TEST_F(AccessorTest, SetNativeDataPropertySetSideEffectReceiverCheck1) {}

static void ConstructCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {}

TEST_F(AccessorTest, SetNativeDataPropertySetSideEffectReceiverCheck2) {}

// Accessors can be allowlisted as side-effect-free via SetNativeDataProperty.
TEST_F(AccessorTest, AccessorSetNativeDataPropertyHasNoSideEffect) {}

// Accessors can be allowlisted as side-effect-free via SetLazyDataProperty.
TEST_F(AccessorTest, AccessorSetLazyDataPropertyHasNoSideEffect) {}

TEST_F(AccessorTest, ObjectTemplateSetNativeDataPropertyHasNoSideEffect) {}

TEST_F(AccessorTest, ObjectTemplateSetNativePropertyHasNoSideEffect) {}

TEST_F(AccessorTest, ObjectTemplateSetLazyPropertyHasNoSideEffect) {}

namespace {
void FunctionNativeGetter(v8::Local<v8::Name> property,
                          const v8::PropertyCallbackInfo<v8::Value>& info) {}
}  // namespace

TEST_F(AccessorTest, BindFunctionTemplateSetNativeDataProperty) {}

namespace {
v8::MaybeLocal<v8::Context> TestHostCreateShadowRealmContextCallback(
    v8::Local<v8::Context> initiator_context) {}
}  // namespace

TEST_F(AccessorTest, WrapFunctionTemplateSetNativeDataProperty) {}