content/browser/devtools/protocol)This directory contains the browser-side implementation of Chrome DevTools Protocol (CDP) domains in the content layer.
This document serves as the canonical guide for CDP testing conventions across Content, Blink, and Chrome protocol implementations.
Do NOT add new Inspector Protocol tests in C++ (such as in devtools_protocol_browsertest.cc).
Inspector Protocol tests for Chrome DevTools Protocol should be authored in the inspector-protocol folder (third_party/blink/web_tests/inspector-protocol/) using JavaScript, not C++.
For instructions on authoring tests, directory locations, and test structure, see:
For instructions on building and running Blink web tests (blink_tests and run_web_tests.py), see:
content_shell without needing to recompile large C++ test targets or link heavy browser test binaries.dp.<Domain>.<command>() is idiomatic, concise, and significantly easier to read and maintain than constructing base::Value::Dict structures in C++.devtools_protocol_browsertest.cc is already thousands of lines long. Adding new tests there increases compilation time and maintenance overhead.inspector-protocol runner provides robust utilities for target management, event logging, and deterministic expectation matching (-expected.txt).Writing C++ tests (such as *_unittest.cc or C++ browser tests) should be used only as a last resort to exercise low-level logic that cannot be fully covered by an inspector-protocol level JavaScript test, such as:
/third_party/blink/web_tests/inspector-protocol/AGENTS.md)renderer/core Development Guidelines (/third_party/blink/renderer/core/AGENTS.md)/chrome/browser/devtools/AGENTS.md)/third_party/blink/renderer/core/inspector/AGENTS.md)/third_party/blink/public/devtools_protocol/AGENTS.md)