Test conversion

From nwjs/chromium.src · View interactive version

Test conversion is an AI agent skill from the GitHub repository nwjs/chromium.src. Workflow for converting unit tests to browser tests for Project Bedrock. Invoke this when the user wants to remove complex Browser dependencies from tests.

How to use this skill

Skill file

Role

You are an Elite Chromium Architecture Expert. Your objective is to orchestrate

a workflow to remove a Browser\* dependency from a unit test file. You will use

subagents for planning and review, but you will perform the implementation

yourself.

Workspace Context

You are operating in the root directory of the local chromium/src checkout.

All paths starting with // are relative to this root directory.

Inputs

Provide following inputs to subagents accordingly:

Instructions

a subagent, and ask the subagent to follow its original agent prompt.

messages when finished.

Failure Summary (see Exit Paths below) and halt.

Phase 1: Setup

.agents/bedrock_conversation

Phase 2: Research & Planning

general-purpose researcher. Use it to research the coding problem, explore the

codebase, and figure out a good approach.

remove Browser\* dependencies.

researcher:

Browser*, TestBrowserWindow, BrowserWithTestWindowTest,

TestWithBrowserView, or CreateBrowserWithTestWindowForParams are

minimal. Replace them with focused test objects.

complex. Rename the file to _browsertest.cc, move it in BUILD.gn, and

use InProcessBrowserTest.

written: <your_artifacts_directory>/EXECUTION_PLAN.md (where

<your_artifacts_directory> is your active brain directory)

EXECUTION_PLAN.md in your artifacts directory.

Phase 3: Implementation

your artifacts directory) yourself.

1. Read the design doc (EXECUTION_PLAN.md in your artifacts directory)

carefully.

2. Follow the changes specified in the plan.

3. Use appropriate output directories (e.g., out/chromeos for ChromeOS

tests, out/debug for others, out/dangling if you have dangling pointer

failures).

4. Build your changes: a. Format the working copy: jj fix b. Run

gn check <out-dir> to verify GN files (especially if you modified

BUILD.gn). c. Build the test binary: autoninja -C <out-dir> <test binary>

5. Fix any build errors and repeat until it passes. If you cannot fix a build

error, see if returning to Phase 2 helps.

you didn't touch (which often means upstream main is broken or has

introduced new changes since your checkout started), rebase your branch

onto the latest remote main:

1. Fetch remote changes: jj git fetch

2. Rebase your bookmark onto the remote main bookmark:

jj rebase -b my-branch -d main@origin

3. Synchronize dependencies: gclient sync

4. Clean your working directory of any local untracked diff/helper files,

and rebuild.

6. Run the tests:

./<out-dir>/<test binary> --gtest_filter=<gtest filter> --gunit_fail_fast

./<out-dir>/<test binary> --gtest_filter=<gtest filter> --gunit_fail_fast 2>&1 | tools/valgrind/asan/asan_symbolize.py

Repeat until the tests pass. If you cannot fix a test error, see if

returning to Phase 2 helps.

Phase 4: Code Review

Ensure each new commit is focused and easy to review."

blocking comments that are complex or ambiguous, return to Phase 2 to get

advice on how to fix them. If the blocking comments are all simple and easily

fixed, return to Phase 3 and fix them directly.

Phase 5: Upload and Presubmit

will become a separate CL, so make sure that small fixes to existing CLs are

squashed. An example CL description is:

[bedrock] Remove Browser* from [PATH TO TEST]

Bypass-Check-License: Moved files

detached HEAD state, specifying the base branch like origin/main is

required; see git-cl-helper skill for details on this command). Note that

uploading may take a long time. Please wait until it succeeds or times out.

delegate polling to a self subagent to run asynchronously.

1. Periodically poll the trybot and Gerrit comments status using the

git-cl-helper skill:

vpython3 agents/skills/git-cl-helper/scripts/git_cl_helper.py poll --gerrit_url <GERRIT_URL>.

2. Monitor for trybot completion (passed or failed) or new Gerrit

comments.

3. Report back to you immediately via send_message once trybots finish or

comment events occur.

to triage. Fix the errors yourself following the implementation workflow,

then **you MUST return to Phase 4 (Code Review) for a fresh reviewer

signoff** before uploading a corrected patchset.

then **you MUST return to Phase 4 (Code Review) for a fresh reviewer

signoff** before uploading a corrected patchset. Use git-cl-helper to post

response drafts.

the full CL link to the user at the end.

Exit Paths

Upon completion of the workflow (either by finishing the task or by reaching a

point where no further progress can be made), you must provide one of the

following:

  1. A finished CL:

Phase 5).

  1. A Failure Summary:

resolve after reasonable effort:

attempts, test runs).

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.