🧪 iBrowe Testing Infrastructure Overview

iBrowe uses two primary categories of automated tests:

  • Unit Tests – focused on individual functions or logic blocks
  • Browser Tests – integration-style tests that rely on a full browser instance

🧱 Unit Tests

🔹 C++ Unit Tests

Compiled C++ tests validating individual modules or classes.

Run with:

npm run test -- ibrowe_unit_tests

Sample output:

> ibrowe@1.0.0 test /Users/dev/projects/ibrowe/ibrowe
> node ./scripts/commands.js test "ibrowe_unit_tests"

ninja -C ./src/out/Release ibrowe_unit_tests
./ibrowe_unit_tests --enable-logging --v=0
Using 8 parallel jobs.
[1/9] NetworkHelperTest.NoChangeURL
[9/9] ImporterTest.ImportFavicons
SUCCESS: all tests passed.

Run a specific test interactively:

./ibrowe_unit_tests --gtest_filter=YourTestName --single-process-tests

🔹 JavaScript Unit Tests

Run from the root of the project:

npm run test-unit

To run only specific test files:

npm run test-unit -- --findRelatedTests ./components/test/foo_test.ts

🌐 Browser Tests

These compile iBrowe’s browser binary together with C++ test harnesses.

Run with:

npm run test -- ibrowe_browser_tests

Example:

[1/4] AdBlockServiceTest.BlocksAds
[4/4] HTTPSRedirectTest.RedirectsKnownSite
SUCCESS: all tests passed.

Filter to specific test suites:

npm run test -- ibrowe_browser_tests --filter=ContentSettingsObserverTest.*

Run in release mode:

npm run test -- ibrowe_browser_tests Release

Run headless on Linux using xvfb:

./src/testing/xvfb.py npm run test -- ibrowe_browser_tests

🔕 Disabling Tests

Mark a test as disabled by renaming:

- TEST(MyFeatureTest, Crashes)
+ TEST(MyFeatureTest, DISABLED_Crashes)

Create a tracking issue for re-enabling.


🧩 Other Targets

You can pass any Chromium-compatible target to npm run test:

npm run test -- browser_tests

Some upstream Chromium tests may fail due to iBrowe-specific changes.


🔐 Security & Network Privacy Audits

Run automated privacy checks:

npm run test-security
# For non-debug builds:
npm run test-security -- --output_path="/path/to/iBrowe/binary"

Manual test procedure:

open /Applications/iBrowe\ Browser.app --args \
  --log-net-log=/tmp/netlog.json \
  --net-log-capture-mode=IncludeSocketBytes

Explore chrome://net-internals, import the log, and search for:

URL_REQUEST
GOOGLE_OWNED_SERVICE

📱 Android-Specific Testing

🧰 Emulator Setup

No need to set up an emulator manually—defaults are used. To use a specific emulator:

# List available AVDs
~/Android/Sdk/emulator/emulator -list-avds

# Start one
~/Android/Sdk/emulator/emulator @MyEmulator

Use x86-based images for best performance.

⚙️ Build & Run Tests

npm run init -- --target_os=android --target_arch=x86
npm run build -- --target_os=android --target_arch=x86
npm run test -- ibrowe_unit_tests --target_os=android --target_arch=x86

🔄 Upstream Chromium Tests

Run upstream Chromium tests locally:

npm test browser_tests
npm test unit_tests

To skip broken tests, modify filters in:

ibrowe-core/test/filters/

Include a reason and tracking issue for each disabled test.


📎 Source: Adapted from Brave’s developer testing documentation, restructured for the iBrowe project