chromium/content/renderer/v8_value_converter_impl_unittest.cc

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

#include "content/renderer/v8_value_converter_impl.h"

#include <stddef.h>
#include <stdint.h>

#include <cmath>
#include <memory>

#include "base/containers/span.h"
#include "base/memory/raw_ptr.h"
#include "base/test/task_environment.h"
#include "base/test/values_test_util.h"
#include "base/values.h"
#include "gin/public/isolate_holder.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "v8/include/v8-array-buffer.h"
#include "v8/include/v8-container.h"
#include "v8/include/v8-context.h"
#include "v8/include/v8-date.h"
#include "v8/include/v8-isolate.h"
#include "v8/include/v8-local-handle.h"
#include "v8/include/v8-microtask-queue.h"
#include "v8/include/v8-object.h"
#include "v8/include/v8-persistent-handle.h"
#include "v8/include/v8-primitive.h"
#include "v8/include/v8-regexp.h"
#include "v8/include/v8-script.h"
#include "v8/include/v8-template.h"
#include "v8/include/v8-typed-array.h"

namespace content {

// To improve the performance of
// V8ValueConverterImpl::UpdateAndCheckUniqueness, identity hashes of objects
// are used during checking for duplicates. For testing purposes we need to
// ignore the hash sometimes. Create this helper object to avoid using identity
// hashes for the lifetime of the helper.
class ScopedAvoidIdentityHashForTesting {};

ScopedAvoidIdentityHashForTesting::ScopedAvoidIdentityHashForTesting(
    content::V8ValueConverterImpl* converter)
    :{}

ScopedAvoidIdentityHashForTesting::~ScopedAvoidIdentityHashForTesting() {}

class V8ValueConverterImplTest : public testing::Test {};

TEST_F(V8ValueConverterImplTest, BasicRoundTrip) {}

TEST_F(V8ValueConverterImplTest, KeysWithDots) {}

TEST_F(V8ValueConverterImplTest, ObjectExceptions) {}

TEST_F(V8ValueConverterImplTest, ArrayExceptions) {}

TEST_F(V8ValueConverterImplTest, WeirdTypes) {}

TEST_F(V8ValueConverterImplTest, Prototype) {}

TEST_F(V8ValueConverterImplTest, ObjectPrototypeSetter) {}

TEST_F(V8ValueConverterImplTest, ArrayPrototypeSetter) {}

TEST_F(V8ValueConverterImplTest, StripNullFromObjects) {}

TEST_F(V8ValueConverterImplTest, RecursiveObjects) {}

TEST_F(V8ValueConverterImplTest, WeirdProperties) {}

TEST_F(V8ValueConverterImplTest, ArrayGetters) {}

TEST_F(V8ValueConverterImplTest, UndefinedValueBehavior) {}

TEST_F(V8ValueConverterImplTest, ObjectsWithClashingIdentityHash) {}

TEST_F(V8ValueConverterImplTest, DetectCycles) {}

// Tests that reused object values with no cycles do not get nullified.
TEST_F(V8ValueConverterImplTest, ReuseObjects) {}

TEST_F(V8ValueConverterImplTest, MaxRecursionDepth) {}

TEST_F(V8ValueConverterImplTest, NegativeZero) {}

class V8ValueConverterOverridingStrategyForTesting
    : public V8ValueConverter::Strategy {};

TEST_F(V8ValueConverterImplTest, StrategyOverrides) {}

class V8ValueConverterBypassStrategyForTesting
    : public V8ValueConverter::Strategy {};

// Verify that having a strategy that fallbacks to default behaviour
// actually preserves it.
TEST_F(V8ValueConverterImplTest, StrategyBypass) {}

}  // namespace content