#include "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/json/json_reader.h"
#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
#include "base/synchronization/condition_variable.h"
#include "base/synchronization/lock.h"
#include "base/task/sequenced_task_runner.h"
#include "base/test/values_test_util.h"
#include "base/thread_annotations.h"
#include "base/values.h"
#include "content/services/auction_worklet/auction_v8_helper.h"
#include "content/services/auction_worklet/auction_v8_inspector_util.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
#include "v8/include/v8-inspector.h"
namespace auction_worklet {
namespace {
std::string ToString(v8_inspector::StringView sv) { … }
}
TestInspectorClient::TestInspectorClient(AuctionV8Helper* helper)
: … { … }
void TestInspectorClient::runIfWaitingForDebugger(int context_group_id) { … }
TestChannel::TestChannel(AuctionV8Helper* v8_helper)
: … { … }
TestChannel::~TestChannel() = default;
TestChannel::Event TestChannel::RunCommandAndWaitForResult(
int call_id,
std::string method,
std::string payload) { … }
std::list<TestChannel::Event> TestChannel::TakeAllEvents() { … }
TestChannel::Event TestChannel::WaitForEvent(EventPredicate predicate) { … }
TestChannel::Event TestChannel::WaitForMethodNotification(
const std::string& method) { … }
void TestChannel::WaitForAndValidateConsoleMessage(std::string_view type,
std::string_view json_args,
size_t stack_trace_size,
std::string_view function,
const GURL& url,
int line_number) { … }
void TestChannel::ExpectNoMoreConsoleEvents() { … }
void TestChannel::sendResponse(
int call_id,
std::unique_ptr<v8_inspector::StringBuffer> message) { … }
void TestChannel::sendNotification(
std::unique_ptr<v8_inspector::StringBuffer> message) { … }
void TestChannel::flushProtocolNotifications() { … }
void TestChannel::LogEvent(
Event::Type type,
int call_id,
std::unique_ptr<v8_inspector::StringBuffer> message) { … }
void TestChannel::RunCommand(int call_id,
std::string method,
std::string payload) { … }
void TestChannel::RunCommandOnV8Thread(int call_id,
std::string method,
std::string payload) { … }
ScopedInspectorSupport::ScopedInspectorSupport(AuctionV8Helper* v8_helper)
: … { … }
ScopedInspectorSupport::~ScopedInspectorSupport() = default;
TestChannel* ScopedInspectorSupport::ConnectDebuggerSession(
int context_group_id) { … }
TestChannel* ScopedInspectorSupport::ConnectDebuggerSessionAndRuntimeEnable(
int context_group_id) { … }
ScopedInspectorSupport::V8State::V8State() = default;
ScopedInspectorSupport::V8State::~V8State() { … }
void ScopedInspectorSupport::ConnectDebuggerSessionOnV8Thread(
int context_group_id,
TestChannel** result,
base::OnceClosure done) { … }
}