Chrome Release Bot (LUCI) 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
..
android 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
DEPS 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
OWNERS 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
README.md 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
accessibility_notification_waiter.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
accessibility_notification_waiter.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
attribution_config.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
attribution_simulator.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
attribution_simulator_environment.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
audio_service_test_helper.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
audio_service_test_helper.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
back_forward_cache_util.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
back_forward_cache_util.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
background_color_change_waiter.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
background_color_change_waiter.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
background_sync_test_util.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
background_sync_test_util.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
blink_test_browser_support.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
blink_test_environment.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
blink_test_environment.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
bluetooth_test_utils.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
bluetooth_test_utils.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
browser_task_environment.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
browser_task_environment.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
browser_task_environment_unittest.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
browser_test.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
browser_test_base.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
browser_test_base.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
browser_test_utils.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
browser_test_utils.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
browsing_data_remover_test_util.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
browsing_data_remover_test_util.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
browsing_topics_test_util.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
browsing_topics_test_util.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
commit_message_delayer.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
commit_message_delayer.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
content_browser_test.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
content_browser_test.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
content_browser_test.rs 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
content_browser_test_shell_main_delegate.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
content_browser_test_shell_main_delegate.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
content_browser_test_utils.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
content_browser_test_utils.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
content_browser_test_utils_mac.mm 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
content_cert_verifier_browser_test.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
content_cert_verifier_browser_test.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
content_mock_cert_verifier.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
content_mock_cert_verifier.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
content_public_browsertest_support.rs 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
content_test_suite_base.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
content_test_suite_base.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
devtools_permission_overrides_unittest.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
download_test_observer.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
download_test_observer.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
fake_download_item.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
fake_download_item.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
fake_frame_widget.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
fake_frame_widget.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
fake_local_frame.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
fake_local_frame.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
fake_remote_frame.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
fake_remote_frame.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
fake_render_widget_host.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
fake_render_widget_host.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
fake_service_worker_context.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
fake_service_worker_context.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
fake_speech_recognition_manager.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
fake_speech_recognition_manager.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
fenced_frame_test_util.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
fenced_frame_test_util.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
find_test_utils.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
find_test_utils.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
focus_changed_observer.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
focus_changed_observer.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
frame_load_waiter.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
frame_load_waiter.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
frame_test_utils.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
frame_test_utils.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
hit_test_region_observer.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
hit_test_region_observer.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
javascript_test_observer.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
javascript_test_observer.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
local_frame_host_interceptor.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
local_frame_host_interceptor.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
media_start_stop_observer.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
media_start_stop_observer.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
mock_browsing_data_remover_delegate.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
mock_browsing_data_remover_delegate.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
mock_client_hints_controller_delegate.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
mock_download_manager.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
mock_download_manager.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
mock_navigation_handle.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
mock_navigation_handle.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
mock_notification_observer.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
mock_notification_observer.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
mock_permission_controller.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
mock_permission_controller.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
mock_permission_manager.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
mock_permission_manager.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
mock_policy_container_host.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
mock_policy_container_host.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
mock_render_process_host.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
mock_render_process_host.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
mock_render_thread.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
mock_render_thread.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
mock_resource_context.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
mock_resource_context.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
mock_web_contents_observer.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
mock_web_contents_observer.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
navigation_handle_observer.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
navigation_handle_observer.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
navigation_simulator.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
nested_message_pump_android.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
nested_message_pump_android.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
network_connection_change_simulator.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
network_connection_change_simulator.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
network_service_test_helper.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
network_service_test_helper.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
no_renderer_crashes_assertion.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
no_renderer_crashes_assertion.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
no_renderer_crashes_assertion_unittest.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
permission_type_unittest.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
permissions_test_utils.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
permissions_test_utils.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
policy_container_utils.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
policy_container_utils.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
ppapi_test_utils.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
ppapi_test_utils.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
preloading_test_util.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
preloading_test_util.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
prerender_test_util.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
prerender_test_util.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
private_network_access_util.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
private_network_access_util.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
referrer_unittest.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
render_frame_host_test_support.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
render_frame_host_test_support.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
render_view_test.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
render_view_test.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
scoped_overscroll_modes.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
scoped_overscroll_modes.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
scoped_page_focus_override.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
scoped_page_focus_override.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
scoped_time_zone.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
scoped_time_zone.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
scoped_web_ui_controller_factory_registration.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
scoped_web_ui_controller_factory_registration.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
service_worker_host_interceptor.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
service_worker_host_interceptor.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
service_worker_test_helpers.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
service_worker_test_helpers.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
shared_storage_test_utils.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
shared_storage_test_utils.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
signed_exchange_browser_test_helper.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
signed_exchange_browser_test_helper.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
simple_url_loader_test_helper.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
simple_url_loader_test_helper.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
slow_download_http_response.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
slow_download_http_response.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
slow_http_response.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
slow_http_response.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_aggregation_service.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_aggregation_service.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_browser_context.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_browser_context.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_cert_verifier_service_factory.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_cert_verifier_service_factory.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_content_client_initializer.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_content_client_initializer.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_devtools_protocol_client.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_devtools_protocol_client.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_download_http_response.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_download_http_response.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_file_error_injector.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_file_error_injector.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_fileapi_operation_waiter.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_fileapi_operation_waiter.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_frame_navigation_observer.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_frame_navigation_observer.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_host_resolver.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_host_resolver.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_launcher.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_launcher.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_navigation_observer.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_navigation_observer.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_navigation_throttle.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_navigation_throttle.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_navigation_throttle_inserter.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_navigation_throttle_inserter.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_navigation_ui_data.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_navigation_ui_data.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_notification_tracker.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_notification_tracker.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_renderer_host.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_renderer_host.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_service.mojom 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_storage_partition.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_storage_partition.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_synchronous_compositor_android.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_synchronous_compositor_android.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_utils.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_utils.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_utils_unittest.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_web_contents_factory.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_web_ui.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_web_ui.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_web_ui_data_source.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_web_ui_data_source.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_web_ui_listener_observer.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
test_web_ui_listener_observer.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
text_input_test_utils.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
text_input_test_utils.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
text_input_test_utils_mac.mm 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
theme_change_waiter.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
theme_change_waiter.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
unittest_test_suite.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
unittest_test_suite.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
url_loader_interceptor.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
url_loader_interceptor.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
url_loader_monitor.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
url_loader_monitor.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
web_contents_tester.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
web_contents_tester.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
web_transport_simple_test_server.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
web_transport_simple_test_server.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
web_ui_browsertest_util.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
web_ui_browsertest_util.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
xr_test_utils.cc 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago
xr_test_utils.h 4762b62e7d Publish DEPS for 106.0.5249.13 1 year ago

README.md

Content Browser Test Tips

A random collection of useful things to know when writing browser tests.

[TOC]

Executing JavaScript

If the test needs to use the return value of the script, use EvalJs():

  // Works with numerical types...
  EXPECT_EQ(0, EvalJs(shell(), "1 * 0");

  // ... string types ...
  EXPECT_EQ("BODY", EvalJs(shell(), "document.body.tagName");

  // and booleans too. Note the explicit use of EXPECT_EQ() instead of
  // EXPECT_TRUE() or EXPECT_FALSE(); this is intentional, and the latter
  // will not compile.
  EXPECT_EQ(false, EvalJs(shell(), "2 + 2 == 5"));

Like many other test helpers (e.g. the navigation helpers), the first argument accepts RenderFrameHost, WebContents, and other types.

  // Executes in the main frame.
  EXPECT_EQ(true, EvalJs(shell()->GetWebContents(), "window.top == window"));

  // Also executes in the main frame.
  EXPECT_EQ(true, EvalJs(shell(), "window.top == window"));

  // Executes in the first child frame of the main frame.
  EXPECT_EQ(
      false,
      EvalJs(ChildFrameAt(shell()->GetWebContents()->GetPrimaryMainFrame(), 0),
             "window.top == window"));

Otherwise, simply use ExecJs():

  EXPECT_TRUE(ExecJs("console.log('Hello world!')"));

Note that these helpers block until the script completes. For async execution, use ExecuteScriptAsync().

Finally, JsReplace() provides a convenient way to build strings for script execution:

  EXPECT_EQ("00", EvalJs(JsReplace("$1 + $2", 0, "0")));

Simulating Input

A wide range of methods are provided to simulate input such as clicks, touch, mouse moves and so on. Many reside in https://source.chromium.org/chromium/chromium/src/+/main:content/public/test/browser_test_utils.h.

When using input in tests, be aware that the renderer drops all input received when the main frame is not being updated or rendered immediately after load. There are three ways, in order of preference, to ensure that the input will be processed. Use these when your test input seems to be having no effect:

  • Use the ‘WaitForHitTestData method’ from content/public/test/hit_test_region_observer.h

  • Include visible text in the web contents you are interacting with.

  • Add ‘blink::switches::kAllowPreCommitInput’ as a command line flag.

Cross-origin navigations

For cross-origin navigations, it is to simplest to configure all hostnames to resolve to 127.0.0.1 in tests, using a snippet like this:

  void SetUpOnMainThread() override {
    host_resolver()->AddRule("*", "127.0.0.1");
    ASSERT_TRUE(embedded_test_server()->Start());
  }

After that, EmbeddedTestServer::GetURL() can be used to generate navigable URLs with the specific origin:

  const GURL& url_a = embedded_test_server()->GetURL("a.com", "/title1.html");
  const GURL& url_b = embedded_test_server()->GetURL("b.com", "/empty.html");

Most test resources are located in //content/test/data, e.g. navigating to GetURL("a.com", "/title1.html") will serve //content/test/data/title1.html as the content.

Browser-initiated navigation to a specific origin

Note: using arbitrary hostnames requires the host resolver to be correctly configured.

NavigateToURL() begins and waits for the navigation to complete, as if the navigation was browser-initiated, e.g. from the omnibox:

  GURL url(embedded_test_server()->GetURL("a.com", "/title1.html"));
  EXPECT_TRUE(NavigateToURL(shell(), url));

Note: NavigateToURL() allows subframes to be targetted, but outside of history navigations, subframe navigations are generally renderer-initiated.

Renderer-initiated navigation to a specific origin

Note: using arbitrary hostnames requires the host resolver to be correctly configured.

NavigateToURLFromRenderer() begins and waits for the navigation to complete, as if the navigation was renderer-initiated, e.g. by setting window.location:

  // Navigates the main frame.
  GURL url_1(embedded_test_server()->GetURL("a.com", "/title1.html"));
  EXPECT_TRUE(NavigateToURLFromRenderer(shell()->GetWebContents(), url_1));

  // Navigates the main frame too.
  GURL url_2(embedded_test_server()->GetURL("b.com", "/page_with_iframe.html"));
  EXPECT_TRUE(NavigateToURLFromRenderer(shell()->GetWebContents(), url_2));

  // Navigates the first child frame.
  GURL url_3(embedded_test_server()->GetURL("a.com", "/empty.html"));
  EXPECT_TRUE(
      NavigateToURLFromRenderer(
          ChildFrameAt(shell()->GetWebContents()->GetPrimaryMainFrame(), 0),
          url_3));

Dynamically generating a page with iframes

Note: using arbitrary hostnames requires the host resolver to be correctly configured.

cross_site_iframe_factory.html is a helper that makes it easy to generate a page with an arbitrary frame tree by navigating to a URL. The query string to the URL allows configuration of the frame tree, the origin of each frame, and a number of other options:

  GURL url(embedded_test_server()->GetURL(
      "a.com", "/cross_site_iframe_factory.html?a(b(a),c,example.com)"));
  EXPECT_TRUE(NavigateToURL(shell(), url));

Will generate a page with:

Main frame with origin `a.com`
  ├─ Child frame #1 with origin `b.com`
  │    └─ Grandchild frame with origin `a.com`
  ├─ Child frame #2 with origin `c.com`
  └─ Child frame #3 with origin `example.com`

Embedding an <iframe> with a specific origin

Note: using arbitrary hostnames requires the host resolver to be correctly configured.

Sometimes, a test page may need to embed a cross-origin URL. This is problematic for pages that contain only static HTML, as the embedded test server runs on a randomly selected port. Instead, static HTML can use the cross-site redirector to generate a cross-origin frame:

<!-- static_iframe.html -->
<html>
  <body>
    <iframe src="/cross-site/b.com/title1.html">
  </body>
</iframe>

Important: the cross-site redirector is not enabled by default. Override SetUpOnMainThread() to configure it like this:

  void SetUpOnMainThread() override {
    ...
    SetupCrossSiteRedirector(embedded_test_server());
    ...
  }

Simulating a slow load

Navigates to a page that takes 60 seconds to load.

  GURL url(embedded_test_server()->GetURL("/slow?60");
  EXPECT_TRUE(NavigateToURL(shell(), url));

The embedded test server also registers other default handlers that may be useful.