#include "chrome/renderer/v8_unwinder.h"
#include <memory>
#include <utility>
#include <vector>
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/location.h"
#include "base/profiler/module_cache.h"
#include "base/profiler/stack_sampling_profiler_test_util.h"
#include "base/synchronization/waitable_event.h"
#include "base/test/bind.h"
#include "base/test/task_environment.h"
#include "build/build_config.h"
#include "gin/public/isolate_holder.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "v8/include/v8.h"
namespace {
AllOf;
AnyOf;
Contains;
Eq;
Field;
NotNull;
Pointee;
Property;
v8::Local<v8::String> ToV8String(const char* str) { … }
v8::Local<v8::Object> CreatePointerHolder(const void* ptr) { … }
template <typename T>
T* GetPointerFromHolder(v8::Local<v8::Object> holder) { … }
class ScopedV8Environment { … };
void WaitForSampleNative(const v8::FunctionCallbackInfo<v8::Value>& info) { … }
base::FunctionAddressRange CallThroughV8(
const base::RepeatingCallback<void(v8::Isolate*)>& report_isolate,
base::OnceClosure wait_for_sample) { … }
class UpdateModulesTestUnwinder : public V8Unwinder { … };
v8::MemoryRange GetEmbeddedCodeRange(v8::Isolate* isolate) { … }
}
TEST(V8UnwinderTest, EmbeddedCodeRangeModule) { … }
TEST(V8UnwinderTest, EmbeddedCodeRangeModulePreservedOnUpdate) { … }
TEST(V8UnwinderTest, EmbeddedCodeRangeModulePreservedOnOverCapacityUpdate) { … }
TEST(V8UnwinderTest, UpdateModules_ModuleAdded) { … }
TEST(V8UnwinderTest, UpdateModules_ModuleAddedBeforeLast) { … }
TEST(V8UnwinderTest, UpdateModules_ModuleRetained) { … }
TEST(V8UnwinderTest, UpdateModules_ModuleRetainedWithDifferentSize) { … }
TEST(V8UnwinderTest, UpdateModules_ModuleRemoved) { … }
TEST(V8UnwinderTest, UpdateModules_ModuleRemovedBeforeLast) { … }
TEST(V8UnwinderTest, UpdateModules_CapacityExceeded) { … }
TEST(V8UnwinderTest, UpdateModules_CapacitySubstantiallyExceeded) { … }
TEST(V8UnwinderTest, CanUnwindFrom_V8Module) { … }
TEST(V8UnwinderTest, CanUnwindFrom_OtherModule) { … }
TEST(V8UnwinderTest, CanUnwindFrom_NullModule) { … }
#if (BUILDFLAG(IS_WIN) && defined(ARCH_CPU_64_BITS)) || BUILDFLAG(IS_MAC) || \
(BUILDFLAG(IS_ANDROID) && defined(ARCH_CPU_ARMEL))
#define MAYBE_UnwindThroughV8Frames …
#else
#define MAYBE_UnwindThroughV8Frames …
#endif
TEST(V8UnwinderTest, MAYBE_UnwindThroughV8Frames) { … }