Overview
Testing is critical for maintaining Helium’s stability, performance, and privacy guarantees. This guide covers the testing utilities, validation scripts, and best practices for ensuring code quality.Testing Philosophy
Core Testing Principles
- Privacy First - Ensure no data leakage or tracking
- Cross-Platform - Test on Windows, macOS, and Linux
- Regression Prevention - Validate patches don’t break existing functionality
- Automated Validation - Use provided scripts before submitting changes
Development Utilities
Helium provides comprehensive testing utilities in thedevutils/ directory:
Validation Scripts
validate_patches.py
Validates that all patches apply cleanly against the Chromium source tree
validate_config.py
Runs sanity checks over all configuration files
check_patch_files.py
Verifies patch file integrity and series consistency
check_gn_flags.py
Ensures GN flags are sorted and not duplicated
Running Tests
Complete Validation Suite
Run all validation checks before submitting changes:- All patches exist and are referenced
- No duplicate patches in series
- Patches are readable and properly formatted
- GN flags in
flags.gnare sorted and unique downloads.inihas correct format and schema
Exit code 0 means no problems detected. Exit code 1 indicates warnings or errors.
Patch Validation
- Remote Validation
- Local Validation
- Cache Remote Files
Validates patches against files downloaded from Google:Features:
- Downloads only required source files
- Validates against exact Chromium version
- No local source tree needed
- Python
requestsmodule - Internet connection
Patch File Checks
Validate patch file integrity:Patch Readability
Verifies all patches in the series file are:
- Present on disk
- Parseable as valid unified diff format
- Free of syntax errors
Series Consistency
Ensures:
- No duplicate entries in series file
- All patches are referenced exactly once
GN Flags Validation
Verify GN build flags are properly formatted:- Flags are sorted alphabetically
- No duplicate flag definitions
- Proper flag syntax
Python Code Quality
Helium includes utilities for maintaining Python code quality:Linting
Code Formatting
Format code with YAPF (Yet Another Python Formatter):Unit Tests
Run Python unit tests:- Patch validation logic
- Domain substitution
- Configuration parsing
- File integrity checks
Pre-Commit Checklist
Before committing changes, run this comprehensive checklist:Platform-Specific Testing
Windows Testing
Build Testing
Build Testing
- Verify builds complete without errors
- Test installer generation
- Validate file associations
- Check update mechanisms (not yet auto-update)
Functionality Testing
Functionality Testing
- Browser launch and stability
- Extensions (uBlock Origin, etc.)
- Privacy features
- UI rendering and responsiveness
macOS Testing
Build Testing
Build Testing
- Universal binary (Intel + Apple Silicon)
- Code signing and notarization
- DMG packaging
- Auto-update functionality
Functionality Testing
Functionality Testing
- Native menu integration
- Keyboard shortcuts
- Touch Bar support (if applicable)
- macOS-specific privacy features
Linux Testing
Build Testing
Build Testing
- AppImage generation
- Dependencies bundling
- Desktop integration
- Auto-update via AppImageUpdate
Functionality Testing
Functionality Testing
- Wayland and X11 compatibility
- System theme integration
- File picker integration
- Clipboard functionality
Debugging Test Failures
Verbose Output
Enable detailed logging for debugging:- Line-by-line patch application details
- Exact mismatch locations
- Context from source files
patch --dry-runoutput for failures
Common Test Failures
Patch doesn't apply cleanly
Patch doesn't apply cleanly
Symptoms:Solutions:
- Check Chromium version matches
- Refresh patch against current source
- Manually resolve conflicts
- Re-run validation
GN flags not sorted
GN flags not sorted
Symptoms:Solution:
Manually sort flags alphabetically in
flags.gnDuplicate patch in series
Duplicate patch in series
Symptoms:Solution:
Remove duplicate entry from
patches/seriesUnused patch detected
Unused patch detected
Symptoms:Solutions:
- Add patch to series file if needed
- Remove patch file if obsolete
- Document reason if intentionally unused
Python linting errors
Python linting errors
Symptoms:Solution:
Auto-format and fix linting issues:
Continuous Integration
Automated Testing
When you submit a pull request:-
Validation runs automatically
- Patch validation
- Config validation
- Code linting
- Unit tests
-
Platform builds triggered
- Windows build
- macOS build (Intel + ARM)
- Linux AppImage
-
Manual testing required
- You must test locally before PR
- Indicate tested platforms in PR template
Local CI Simulation
Simulate CI checks locally:Manual Testing Guidelines
Privacy Testing
Network traffic analysis
Use tools like Wireshark or mitmproxy to verify:
- No unexpected Google domains
- No telemetry or analytics
- No tracking beacons
Storage inspection
Check for:
- No unexpected cookies
- No tracking tokens in localStorage
- Proper incognito mode isolation
Functional Testing
- Basic browsing - Load various websites
- Extensions - Install and use extensions
- Downloads - Test download functionality
- Forms - Test autofill and form submission
- Media - Play video and audio
- PDF viewer - Open and view PDFs
- Settings - Navigate and modify settings
Performance Testing
- Startup time - Measure cold and warm starts
- Memory usage - Monitor with multiple tabs
- CPU usage - Check during heavy workloads
- Responsiveness - Test UI lag and jank
Reporting Test Results
When reporting test results in PRs:Comprehensive testing helps maintain Helium’s quality and privacy guarantees. Always test thoroughly before submitting changes.