chromium/content/services/auction_worklet/worklet_v8_debug_test_util.h

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

#ifndef CONTENT_SERVICES_AUCTION_WORKLET_WORKLET_V8_DEBUG_TEST_UTIL_H_
#define CONTENT_SERVICES_AUCTION_WORKLET_WORKLET_V8_DEBUG_TEST_UTIL_H_

#include <list>
#include <memory>
#include <string>
#include <vector>

#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h"
#include "base/synchronization/condition_variable.h"
#include "base/synchronization/lock.h"
#include "base/task/sequenced_task_runner.h"
#include "base/thread_annotations.h"
#include "base/values.h"
#include "url/gurl.h"
#include "v8/include/v8-inspector.h"

namespace auction_worklet {

// This is a collection of helpers for testing debugging by directly setting a
// V8Inspector (with minimalist test versions of various dependencies) on an
// AuctionV8Helper.

class AuctionV8Helper;

// Absolutely minimal implelementation of V8InspectorClient, which isn't
// good enough for anything like breakpoints.
class TestInspectorClient : public v8_inspector::V8InspectorClient {};

// A thread-safe output channel that records everything that V8 tells it,
// and lets one wait for particular events. It also keeps track of a
// v8_inspector::V8InspectorSession* pointer to send commands the other way.
class TestChannel : public v8_inspector::V8Inspector::Channel {};

// Class that helps set a V8Inspector w/a TestInspectorClient on an
// AuctionV8Helper, and clean it up properly. Assumes v8 thread is separate from
// main thread it runs on. Also helps with connecting debugger sessions.
class ScopedInspectorSupport {};

}  // namespace auction_worklet

#endif  // CONTENT_SERVICES_AUCTION_WORKLET_WORKLET_V8_DEBUG_TEST_UTIL_H_