tests/occlusion: the pointer, not the focus, is what the cover must not move

Run 45620136865 refuted the focus reading: with an X cover over the pointer 458 of 463 runs were red, FocusOut 0 of 40 on the old arrangement. With no window manager the focus is PointerRoot, the pointer sits inside the covered window, and a window mapped over it makes the pointer leave the toplevel; GDK turns that crossing into a GTK focus-out that redraws the window after FullyObscured.

- the display: the test warps the pointer to the bottom-right pixel of the root (from its read-back geometry) before any session starts.
- cover_rectangle keeps the pointer outside the cover (the margin shrinks on that side) and cover_window fails with "the pointer is inside the covered window, no free point on the screen".
- watch also selects Enter/LeaveWindowMask; crossings and focus events are kept with time, mode and detail; the pointer is read back once after the cover is up.
- precondition (both halves, before the page is judged): no crossing and no focus event on the covered toplevel, pointer outside both rectangles; message starts "arrangement: the covering moved the pointer or the focus".
- unit cases for all of it; min_tests of wrapper.unit.all.* raised by 11.
This commit is contained in:
feder-cr committed 2026-11-25 15:27:21 +01:00
1 parent 063a507a9c
commit 2706c29676
4 files changed
+401 -106

No files matched your search

+2 -2
View File
@@ -14,8 +14,8 @@
{"id": "wrapper.e2e.fakeweb", "giro": "G2", "os": ["linux", "windows"], "min_tests": 7, "exact": true, "tests": ["tests/test_fakeweb_p2_e2e.py", "tests/test_fakeweb_p4_e2e.py"], "marker": "e2e", "needs_root": false, "note": "The fake web, offline: our browser on the hard pages (profile P2: a reused routed page reaches networkidle every time, also under a load of three other browsers; the other site is another process) and on the 17-step journey of a person (profile P4: every step as stock, and every page left only once its noise is done), each judged against what stock Firefox does, as tests/fakeweb/pages.json declares it. 7 = 3 + 4 (the last two: a `load` that takes 20 s is a step that succeeds, and a `load` that never comes ends in an error that names the wait and the page). Stock itself is held to that declaration, and compared with ours step by step, by scripts/run_fakeweb.py in .github/workflows/fakeweb.yml. Needs the candidate binary (STEALTHFOX_E2E_BINARY).", "stock_firefox": true, "extra_steps": ["fakeweb_profiles"]},
{"id": "wrapper.e2e.fontconfig", "giro": "G2", "os": ["linux"], "min_tests": 2, "exact": true, "tests": ["tests/test_the_parent_reads_the_bundle_from_fontconfig_s_cache_linux_e2e.py"], "marker": "e2e", "needs_root": false, "linux_only": "Fontconfig exists only on Linux: the parent of the engine shows <GRE>/fonts to it (FcConfigAppFontAddDir) to rebuild a font from a path and a face index. On Windows DirectWrite opens the file from its path, with no folder to scan and no cache to read, so this test has no Windows counterpart.", "note": "2 = (1) the stand-in that runs the engine under strace stays in the engine's place, as the core launches it (the leader of a process group of its own): a fake engine with a child, no browser; the process the launcher holds lives as long as the fake engine, and the group killed holds strace and the child (the stand-in that exec'd setsid forked and exited 0 at once: candidate 44161687675); (2) the warm launch of the parent reads the bundle from fontconfig's cache and does not scan it again (from firefox-66, engine_at_least). Two launches under strace with the same XDG_CACHE_HOME of the test, the first cold and the second warm: the cold parent opens every font file of <GRE>/fonts (the folder as the disk lists it) before any page and fontconfig writes its cache; the warm parent does not open every one of them, and it opens a *.cache-* file of fontconfig (a few files are opened to be used, so the verdict asks about the whole folder, as a scan does). Scan and drawing are told apart by position: only what the parent opens before the first page counts (the opens that draw are written as after_startup). Evidence in RUNNER_TEMP/invpw-evidence/fontconfig-cache: the interval and the number of opens of the bundle, the names of the files of the bundle each launch opened before the first page, the size of the cache file, the VmRSS of the parent after about:blank and after a page with every family, and a third launch with gfx.bundled-fonts.activate=0 (the behaviour before), which is evidence only. Needs strace on the runner: without it both are red, not skipped. No threshold."},
{"id": "wrapper.unit.compositing", "giro": "G1", "os": ["linux", "windows"], "min_tests": 30, "exact": true, "tests": ["tests/test_the_page_bytes_reference_compares_decoded_pixels.py"], "marker": "unit", "needs_root": false, "note": "The helpers of wrapper.e2e.compositing on known inputs, no browser: the PNG compared on decoded pixels (another deBG chunk and compression are the same, one pixel is not, every scanline filter), the comparison with a reference (changed, missing and extra keys named, the entry to record), the type of an engine process, an engine process known by its executable and not by the name it gives itself (Linux), and the CPU of a window, and the shape of the committed Windows reference, and the box cut out of a screenshot (its pixels, a box outside the picture refused, written as a PNG and read back, two boxes told apart by a pixel that is named, the pixels that are not grey)."},
{"id": "wrapper.unit.all.linux", "giro": "G1", "os": ["linux"], "min_tests": 3655, "exact": true, "tests": ["tests/test_a_162_message_is_read_like_a_161_one.py", "tests/test_a_click_makes_one_mousemove_at_its_point.py", "tests/test_a_closed_context_leaves_nothing_in_the_registry.py", "tests/test_a_closed_page_says_nothing.py", "tests/test_a_closed_pipe_is_a_closed_target.py", "tests/test_a_commit_at_any_point_of_the_hand_over_reaches_the_client_once.py", "tests/test_a_context_proxy_carries_its_measured_udp_exit.py", "tests/test_a_context_route_disables_the_cache.py", "tests/test_a_detached_frame_answers_detached.py", "tests/test_a_dialog_is_a_protocol_object.py", "tests/test_a_dialog_is_answered_after_a_pause.py", "tests/test_a_download_finished_before_it_was_announced_is_finished.py", "tests/test_a_failed_expect_carries_its_call_log.py", "tests/test_a_failed_generation_of_the_security_state_keeps_its_evidence.py", "tests/test_a_failed_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_file_chooser_is_never_dropped_in_silence.py", "tests/test_a_frame_tap_needs_a_context_with_touch.py", "tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.py", "tests/test_a_launch_gives_the_core_its_engine_for_the_security_state.py", "tests/test_a_launch_has_one_deadline.py", "tests/test_a_launch_without_a_session_gets_one.py", "tests/test_a_live_event_does_not_overtake_the_replay_of_a_new_page.py", "tests/test_a_module_that_leaves_a_browser_open_fails.py", "tests/test_a_new_page_waits_for_the_engine.py", "tests/test_a_non_finite_number_crosses_the_wire_as_a_tag.py", "tests/test_a_page_closed_before_its_announcement_is_not_announced.py", "tests/test_a_page_is_handed_over_only_when_the_engine_says_it_is_ready.py", "tests/test_a_path_leaves_as_one_stroke.py", "tests/test_a_port_number_is_held_until_it_is_used.py", "tests/test_a_read_whose_probe_ran_out_is_the_callers_timeout.py", "tests/test_a_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_screenshot_sends_its_scale_to_the_engine.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_streamed_upload_is_staged_in_the_session.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_ab_host.py", "tests/test_ab_host_aa_stable.py", "tests/test_ab_network.py", "tests/test_ab_oracle.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_element_handle_serves_every_method_of_the_client.py", "tests/test_an_expect_reads_its_value_once.py", "tests/test_async_api.py", "tests/test_browser_output_is_drained.py", "tests/test_ci_downloads_are_authenticated.py", "tests/test_ci_drive_gate_goes_through_the_core.py", "tests/test_ci_host_gate.py", "tests/test_ci_host_gate_ab.py", "tests/test_ci_lab_geoip.py", "tests/test_ci_lab_geoip_verify.py", "tests/test_ci_lab_intermediates.py", "tests/test_ci_lab_security_state.py", "tests/test_ci_linux_legs_read_no_mirror.py", "tests/test_ci_poison_host.py", "tests/test_ci_real_geoip_check.py", "tests/test_ci_real_geoip_exit_code.py", "tests/test_ci_runs_once_per_commit.py", "tests/test_ci_suite_run.py", "tests/test_ci_verdict.py", "tests/test_ci_workflows_build_the_geoip_database.py", "tests/test_ci_workflows_set_the_intermediates_list.py", "tests/test_ci_workflows_set_the_security_state.py", "tests/test_cli.py", "tests/test_click_rhythm.py", "tests/test_connect_does_not_start_threads_on_the_loop.py", "tests/test_context_locale_is_a_list.py", "tests/test_core_pin.py", "tests/test_cpu_by_type_window.py", "tests/test_cross_origin_iframe.py", "tests/test_cursor_dispatch.py", "tests/test_cursor_wiring.py", "tests/test_docs_name_the_mcp_repo_as_it_is.py", "tests/test_doh_session_prefs_unit.py", "tests/test_drag_motion.py", "tests/test_e2e_hermetic.py", "tests/test_element_handle_actions.py", "tests/test_every_argument_reaches_the_page_as_playwright_sends_it.py", "tests/test_every_held_request_of_the_journey_starts_after_the_load.py", "tests/test_every_order_of_the_events_of_a_popup_gives_one_page_event.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_every_refusal_is_declared.py", "tests/test_every_route_command_is_answered_may_fail.py", "tests/test_every_suite_runs_on_linux_and_windows.py", "tests/test_every_wire_method_is_served_or_refused.py", "tests/test_expose_binding_refusal.py", "tests/test_fakeweb_p4_report.py", "tests/test_fission_identity_parity_e2e.py", "tests/test_fixtures_name_why_the_package_is_missing.py", "tests/test_fork.py", "tests/test_frame_dispatch.py", "tests/test_geoip_used.py", "tests/test_glean_ready.py", "tests/test_goto_follows_the_base_url.py", "tests/test_hook_wiring.py", "tests/test_imports.py", "tests/test_integration.py", "tests/test_juggler_event_buffer.py", "tests/test_juggler_event_listeners.py", "tests/test_juggler_injected.py", "tests/test_juggler_lives_in_tLine truncated
{"id": "wrapper.unit.all.windows", "giro": "G1", "os": ["windows"], "min_tests": 3656, "exact": true, "tests": ["tests/test_a_162_message_is_read_like_a_161_one.py", "tests/test_a_click_makes_one_mousemove_at_its_point.py", "tests/test_a_closed_context_leaves_nothing_in_the_registry.py", "tests/test_a_closed_page_says_nothing.py", "tests/test_a_closed_pipe_is_a_closed_target.py", "tests/test_a_commit_at_any_point_of_the_hand_over_reaches_the_client_once.py", "tests/test_a_context_proxy_carries_its_measured_udp_exit.py", "tests/test_a_context_route_disables_the_cache.py", "tests/test_a_detached_frame_answers_detached.py", "tests/test_a_dialog_is_a_protocol_object.py", "tests/test_a_dialog_is_answered_after_a_pause.py", "tests/test_a_download_finished_before_it_was_announced_is_finished.py", "tests/test_a_failed_expect_carries_its_call_log.py", "tests/test_a_failed_generation_of_the_security_state_keeps_its_evidence.py", "tests/test_a_failed_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_file_chooser_is_never_dropped_in_silence.py", "tests/test_a_frame_tap_needs_a_context_with_touch.py", "tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.py", "tests/test_a_launch_gives_the_core_its_engine_for_the_security_state.py", "tests/test_a_launch_has_one_deadline.py", "tests/test_a_launch_without_a_session_gets_one.py", "tests/test_a_live_event_does_not_overtake_the_replay_of_a_new_page.py", "tests/test_a_module_that_leaves_a_browser_open_fails.py", "tests/test_a_new_page_waits_for_the_engine.py", "tests/test_a_non_finite_number_crosses_the_wire_as_a_tag.py", "tests/test_a_page_closed_before_its_announcement_is_not_announced.py", "tests/test_a_page_is_handed_over_only_when_the_engine_says_it_is_ready.py", "tests/test_a_path_leaves_as_one_stroke.py", "tests/test_a_port_number_is_held_until_it_is_used.py", "tests/test_a_read_whose_probe_ran_out_is_the_callers_timeout.py", "tests/test_a_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_screenshot_sends_its_scale_to_the_engine.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_streamed_upload_is_staged_in_the_session.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_ab_host.py", "tests/test_ab_host_aa_stable.py", "tests/test_ab_network.py", "tests/test_ab_oracle.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_element_handle_serves_every_method_of_the_client.py", "tests/test_an_expect_reads_its_value_once.py", "tests/test_async_api.py", "tests/test_browser_output_is_drained.py", "tests/test_ci_downloads_are_authenticated.py", "tests/test_ci_drive_gate_goes_through_the_core.py", "tests/test_ci_host_gate.py", "tests/test_ci_host_gate_ab.py", "tests/test_ci_lab_geoip.py", "tests/test_ci_lab_geoip_verify.py", "tests/test_ci_lab_intermediates.py", "tests/test_ci_lab_security_state.py", "tests/test_ci_linux_legs_read_no_mirror.py", "tests/test_ci_poison_host.py", "tests/test_ci_real_geoip_check.py", "tests/test_ci_real_geoip_exit_code.py", "tests/test_ci_runs_once_per_commit.py", "tests/test_ci_suite_run.py", "tests/test_ci_verdict.py", "tests/test_ci_workflows_build_the_geoip_database.py", "tests/test_ci_workflows_set_the_intermediates_list.py", "tests/test_ci_workflows_set_the_security_state.py", "tests/test_cli.py", "tests/test_click_rhythm.py", "tests/test_connect_does_not_start_threads_on_the_loop.py", "tests/test_context_locale_is_a_list.py", "tests/test_core_pin.py", "tests/test_cpu_by_type_window.py", "tests/test_cross_origin_iframe.py", "tests/test_cursor_dispatch.py", "tests/test_cursor_wiring.py", "tests/test_docs_name_the_mcp_repo_as_it_is.py", "tests/test_doh_session_prefs_unit.py", "tests/test_drag_motion.py", "tests/test_e2e_hermetic.py", "tests/test_element_handle_actions.py", "tests/test_every_argument_reaches_the_page_as_playwright_sends_it.py", "tests/test_every_held_request_of_the_journey_starts_after_the_load.py", "tests/test_every_order_of_the_events_of_a_popup_gives_one_page_event.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_every_refusal_is_declared.py", "tests/test_every_route_command_is_answered_may_fail.py", "tests/test_every_suite_runs_on_linux_and_windows.py", "tests/test_every_wire_method_is_served_or_refused.py", "tests/test_expose_binding_refusal.py", "tests/test_fakeweb_p4_report.py", "tests/test_fission_identity_parity_e2e.py", "tests/test_fixtures_name_why_the_package_is_missing.py", "tests/test_fork.py", "tests/test_frame_dispatch.py", "tests/test_geoip_used.py", "tests/test_glean_ready.py", "tests/test_goto_follows_the_base_url.py", "tests/test_hook_wiring.py", "tests/test_imports.py", "tests/test_integration.py", "tests/test_juggler_event_buffer.py", "tests/test_juggler_event_listeners.py", "tests/test_juggler_injected.py", "tests/test_juggler_lives_Line truncated
{"id": "wrapper.unit.all.linux", "giro": "G1", "os": ["linux"], "min_tests": 3666, "exact": true, "tests": ["tests/test_a_162_message_is_read_like_a_161_one.py", "tests/test_a_click_makes_one_mousemove_at_its_point.py", "tests/test_a_closed_context_leaves_nothing_in_the_registry.py", "tests/test_a_closed_page_says_nothing.py", "tests/test_a_closed_pipe_is_a_closed_target.py", "tests/test_a_commit_at_any_point_of_the_hand_over_reaches_the_client_once.py", "tests/test_a_context_proxy_carries_its_measured_udp_exit.py", "tests/test_a_context_route_disables_the_cache.py", "tests/test_a_detached_frame_answers_detached.py", "tests/test_a_dialog_is_a_protocol_object.py", "tests/test_a_dialog_is_answered_after_a_pause.py", "tests/test_a_download_finished_before_it_was_announced_is_finished.py", "tests/test_a_failed_expect_carries_its_call_log.py", "tests/test_a_failed_generation_of_the_security_state_keeps_its_evidence.py", "tests/test_a_failed_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_file_chooser_is_never_dropped_in_silence.py", "tests/test_a_frame_tap_needs_a_context_with_touch.py", "tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.py", "tests/test_a_launch_gives_the_core_its_engine_for_the_security_state.py", "tests/test_a_launch_has_one_deadline.py", "tests/test_a_launch_without_a_session_gets_one.py", "tests/test_a_live_event_does_not_overtake_the_replay_of_a_new_page.py", "tests/test_a_module_that_leaves_a_browser_open_fails.py", "tests/test_a_new_page_waits_for_the_engine.py", "tests/test_a_non_finite_number_crosses_the_wire_as_a_tag.py", "tests/test_a_page_closed_before_its_announcement_is_not_announced.py", "tests/test_a_page_is_handed_over_only_when_the_engine_says_it_is_ready.py", "tests/test_a_path_leaves_as_one_stroke.py", "tests/test_a_port_number_is_held_until_it_is_used.py", "tests/test_a_read_whose_probe_ran_out_is_the_callers_timeout.py", "tests/test_a_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_screenshot_sends_its_scale_to_the_engine.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_streamed_upload_is_staged_in_the_session.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_ab_host.py", "tests/test_ab_host_aa_stable.py", "tests/test_ab_network.py", "tests/test_ab_oracle.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_element_handle_serves_every_method_of_the_client.py", "tests/test_an_expect_reads_its_value_once.py", "tests/test_async_api.py", "tests/test_browser_output_is_drained.py", "tests/test_ci_downloads_are_authenticated.py", "tests/test_ci_drive_gate_goes_through_the_core.py", "tests/test_ci_host_gate.py", "tests/test_ci_host_gate_ab.py", "tests/test_ci_lab_geoip.py", "tests/test_ci_lab_geoip_verify.py", "tests/test_ci_lab_intermediates.py", "tests/test_ci_lab_security_state.py", "tests/test_ci_linux_legs_read_no_mirror.py", "tests/test_ci_poison_host.py", "tests/test_ci_real_geoip_check.py", "tests/test_ci_real_geoip_exit_code.py", "tests/test_ci_runs_once_per_commit.py", "tests/test_ci_suite_run.py", "tests/test_ci_verdict.py", "tests/test_ci_workflows_build_the_geoip_database.py", "tests/test_ci_workflows_set_the_intermediates_list.py", "tests/test_ci_workflows_set_the_security_state.py", "tests/test_cli.py", "tests/test_click_rhythm.py", "tests/test_connect_does_not_start_threads_on_the_loop.py", "tests/test_context_locale_is_a_list.py", "tests/test_core_pin.py", "tests/test_cpu_by_type_window.py", "tests/test_cross_origin_iframe.py", "tests/test_cursor_dispatch.py", "tests/test_cursor_wiring.py", "tests/test_docs_name_the_mcp_repo_as_it_is.py", "tests/test_doh_session_prefs_unit.py", "tests/test_drag_motion.py", "tests/test_e2e_hermetic.py", "tests/test_element_handle_actions.py", "tests/test_every_argument_reaches_the_page_as_playwright_sends_it.py", "tests/test_every_held_request_of_the_journey_starts_after_the_load.py", "tests/test_every_order_of_the_events_of_a_popup_gives_one_page_event.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_every_refusal_is_declared.py", "tests/test_every_route_command_is_answered_may_fail.py", "tests/test_every_suite_runs_on_linux_and_windows.py", "tests/test_every_wire_method_is_served_or_refused.py", "tests/test_expose_binding_refusal.py", "tests/test_fakeweb_p4_report.py", "tests/test_fission_identity_parity_e2e.py", "tests/test_fixtures_name_why_the_package_is_missing.py", "tests/test_fork.py", "tests/test_frame_dispatch.py", "tests/test_geoip_used.py", "tests/test_glean_ready.py", "tests/test_goto_follows_the_base_url.py", "tests/test_hook_wiring.py", "tests/test_imports.py", "tests/test_integration.py", "tests/test_juggler_event_buffer.py", "tests/test_juggler_event_listeners.py", "tests/test_juggler_injected.py", "tests/test_juggler_lives_in_tLine truncated
{"id": "wrapper.unit.all.windows", "giro": "G1", "os": ["windows"], "min_tests": 3667, "exact": true, "tests": ["tests/test_a_162_message_is_read_like_a_161_one.py", "tests/test_a_click_makes_one_mousemove_at_its_point.py", "tests/test_a_closed_context_leaves_nothing_in_the_registry.py", "tests/test_a_closed_page_says_nothing.py", "tests/test_a_closed_pipe_is_a_closed_target.py", "tests/test_a_commit_at_any_point_of_the_hand_over_reaches_the_client_once.py", "tests/test_a_context_proxy_carries_its_measured_udp_exit.py", "tests/test_a_context_route_disables_the_cache.py", "tests/test_a_detached_frame_answers_detached.py", "tests/test_a_dialog_is_a_protocol_object.py", "tests/test_a_dialog_is_answered_after_a_pause.py", "tests/test_a_download_finished_before_it_was_announced_is_finished.py", "tests/test_a_failed_expect_carries_its_call_log.py", "tests/test_a_failed_generation_of_the_security_state_keeps_its_evidence.py", "tests/test_a_failed_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_file_chooser_is_never_dropped_in_silence.py", "tests/test_a_frame_tap_needs_a_context_with_touch.py", "tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.py", "tests/test_a_launch_gives_the_core_its_engine_for_the_security_state.py", "tests/test_a_launch_has_one_deadline.py", "tests/test_a_launch_without_a_session_gets_one.py", "tests/test_a_live_event_does_not_overtake_the_replay_of_a_new_page.py", "tests/test_a_module_that_leaves_a_browser_open_fails.py", "tests/test_a_new_page_waits_for_the_engine.py", "tests/test_a_non_finite_number_crosses_the_wire_as_a_tag.py", "tests/test_a_page_closed_before_its_announcement_is_not_announced.py", "tests/test_a_page_is_handed_over_only_when_the_engine_says_it_is_ready.py", "tests/test_a_path_leaves_as_one_stroke.py", "tests/test_a_port_number_is_held_until_it_is_used.py", "tests/test_a_read_whose_probe_ran_out_is_the_callers_timeout.py", "tests/test_a_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_screenshot_sends_its_scale_to_the_engine.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_streamed_upload_is_staged_in_the_session.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_ab_host.py", "tests/test_ab_host_aa_stable.py", "tests/test_ab_network.py", "tests/test_ab_oracle.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_element_handle_serves_every_method_of_the_client.py", "tests/test_an_expect_reads_its_value_once.py", "tests/test_async_api.py", "tests/test_browser_output_is_drained.py", "tests/test_ci_downloads_are_authenticated.py", "tests/test_ci_drive_gate_goes_through_the_core.py", "tests/test_ci_host_gate.py", "tests/test_ci_host_gate_ab.py", "tests/test_ci_lab_geoip.py", "tests/test_ci_lab_geoip_verify.py", "tests/test_ci_lab_intermediates.py", "tests/test_ci_lab_security_state.py", "tests/test_ci_linux_legs_read_no_mirror.py", "tests/test_ci_poison_host.py", "tests/test_ci_real_geoip_check.py", "tests/test_ci_real_geoip_exit_code.py", "tests/test_ci_runs_once_per_commit.py", "tests/test_ci_suite_run.py", "tests/test_ci_verdict.py", "tests/test_ci_workflows_build_the_geoip_database.py", "tests/test_ci_workflows_set_the_intermediates_list.py", "tests/test_ci_workflows_set_the_security_state.py", "tests/test_cli.py", "tests/test_click_rhythm.py", "tests/test_connect_does_not_start_threads_on_the_loop.py", "tests/test_context_locale_is_a_list.py", "tests/test_core_pin.py", "tests/test_cpu_by_type_window.py", "tests/test_cross_origin_iframe.py", "tests/test_cursor_dispatch.py", "tests/test_cursor_wiring.py", "tests/test_docs_name_the_mcp_repo_as_it_is.py", "tests/test_doh_session_prefs_unit.py", "tests/test_drag_motion.py", "tests/test_e2e_hermetic.py", "tests/test_element_handle_actions.py", "tests/test_every_argument_reaches_the_page_as_playwright_sends_it.py", "tests/test_every_held_request_of_the_journey_starts_after_the_load.py", "tests/test_every_order_of_the_events_of_a_popup_gives_one_page_event.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_every_refusal_is_declared.py", "tests/test_every_route_command_is_answered_may_fail.py", "tests/test_every_suite_runs_on_linux_and_windows.py", "tests/test_every_wire_method_is_served_or_refused.py", "tests/test_expose_binding_refusal.py", "tests/test_fakeweb_p4_report.py", "tests/test_fission_identity_parity_e2e.py", "tests/test_fixtures_name_why_the_package_is_missing.py", "tests/test_fork.py", "tests/test_frame_dispatch.py", "tests/test_geoip_used.py", "tests/test_glean_ready.py", "tests/test_goto_follows_the_base_url.py", "tests/test_hook_wiring.py", "tests/test_imports.py", "tests/test_integration.py", "tests/test_juggler_event_buffer.py", "tests/test_juggler_event_listeners.py", "tests/test_juggler_injected.py", "tests/test_juggler_lives_Line truncated
{"id": "wrapper.e2e.securitystate", "giro": "G2", "os": ["linux", "windows"], "min_tests": 4, "exact": true, "tests": ["tests/test_security_state_engine_e2e.py"], "marker": "e2e", "needs_root": false, "note": "The security state the core declares, against the engine: the engine launched directly in its generate mode makes what it is given (the contract's result, security_state/ with the bytes of the full filter and of the delta, the core's own validation of it); a normal launch declares no pref of the mode and re-imports nothing; a certificate that Mozilla's CRLite test data say is revoked in a delta is refused at the first navigation (SEC_ERROR_REVOKED_CERTIFICATE) while a valid one loads, and the revoked one loads when the ready directory has no data; a ready directory with no or an empty security_state/ starts. Certificates made on the run (a fresh root trusted in cert9.db by the engine's own xpcshell, Mozilla's default test key as the key of CN=int), servers on loopback, no network. Red on firefox-67 (no generate mode).", "core_dumps": "invpw-cores"},
{"id": "wrapper.e2e.suite.linux.1", "giro": "G2", "os": ["linux"], "min_tests": 415, "exact": true, "tests": ["tests/test_a_closed_browser_leaves_the_others_alone_e2e.py", "tests/test_a_context_that_ends_leaves_no_process_e2e.py", "tests/test_a_cors_preflight_is_not_a_request_of_the_page_e2e.py", "tests/test_a_declared_webgl_extension_survives_its_use_e2e.py", "tests/test_a_granted_permission_is_the_one_the_page_asks_for_e2e.py", "tests/test_a_held_ice_port_blinds_the_loopback_checks_e2e.py", "tests/test_a_launch_without_a_session_gets_one_e2e.py", "tests/test_a_left_documents_body_is_evicted_e2e.py", "tests/test_a_mouse_click_makes_one_mousemove_on_its_point_e2e.py", "tests/test_a_page_over_ipv6_gathers_on_a_machine_declared_without_it_e2e.py", "tests/test_a_popup_is_reported_when_the_engine_says_it_is_ready_as_playwright_does_e2e.py", "tests/test_a_screenshot_draws_the_text_of_the_bundled_fonts_as_the_content_does_e2e.py", "tests/test_a_screenshot_honours_its_scale_e2e.py", "tests/test_a_served_browser_answers_a_plain_client_e2e.py", "tests/test_a_tiny_download_on_a_served_browser_is_saved_e2e.py", "tests/test_a_turn_name_over_tcp_goes_through_the_proxy_of_the_context_e2e.py", "tests/test_accept_language_on_the_wire_e2e.py", "tests/test_browser_output_is_drained.py", "tests/test_click_rhythm.py", "tests/test_closing_one_of_four_browsers_does_not_hold_the_loop_e2e.py", "tests/test_control_a_selects_all_in_a_field_e2e.py", "tests/test_cross_origin_iframe.py", "tests/test_declared_host_network_e2e.py", "tests/test_detectors_e2e.py", "tests/test_e2e.py", "tests/test_element_handle_actions.py", "tests/test_element_screenshot_e2e.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_file_chooser.py", "tests/test_fingerprint_surface.py", "tests/test_fission_frames_history_and_processes_e2e.py", "tests/test_fission_frames_workers_storage_and_special_frames_e2e.py", "tests/test_frames_outlive_the_back_forward_cache_e2e.py", "tests/test_goto_networkidle_after_spa_e2e.py", "tests/test_goto_script_redirect_e2e.py", "tests/test_hidden_display_linux.py", "tests/test_ice_names_by_the_context_proxy_e2e.py::test_the_ice_name_of_a_context_goes_by_the_proxy_of_that_context", "tests/test_ignore_https_errors_e2e.py", "tests/test_injected_node_surface.py", "tests/test_juggler_connection.py", "tests/test_juggler_posix_pipe.py", "tests/test_juggler_transport.py", "tests/test_navigation_across_processes_e2e.py", "tests/test_navigation_response.py", "tests/test_networkidle_reaches_the_client_e2e.py", "tests/test_oop_frame_element.py", "tests/test_oop_frame_geometry.py", "tests/test_page_number_follows_the_call.py", "tests/test_persistent_profile_keeps_state.py", "tests/test_pointer_position.py", "tests/test_popups_reach_the_client_e2e.py", "tests/test_preload_newtab_turns_the_privileged_about_process_off_e2e.py", "tests/test_realness_behind_a_declared_exit_e2e.py", "tests/test_resolver_race_e2e.py", "tests/test_route_header_order_e2e.py", "tests/test_same_document_goto_e2e.py", "tests/test_screencast.py", "tests/test_screencast_stop_e2e.py", "tests/test_screenshot_looks_where_you_are.py", "tests/test_security_state_engine_e2e.py", "tests/test_service_worker.py", "tests/test_service_worker_controller_e2e.py", "tests/test_set_offline_e2e.py", "tests/test_shadow_trusted_input.py", "tests/test_strict_and_force.py", "tests/test_the_callers_code_is_not_counted_e2e.py", "tests/test_the_device_enumeration_takes_the_declared_time_e2e.py", "tests/test_the_engine_is_born_in_the_job_e2e.py::test_a_launch_scans_no_process_of_the_machine", "tests/test_the_engine_is_born_in_the_job_e2e.py::test_after_close_no_process_of_the_session_is_left", "tests/test_the_hosts_file_of_the_host_is_never_read_e2e.py", "tests/test_trial_does_not_act.py", "tests/test_turn_over_tcp_is_tried_for_real_e2e.py", "tests/test_ua_widget_not_selectable.py", "tests/test_voices_e2e.py", "tests/test_wait_for_function.py", "tests/test_webgl_draws_on_the_engine_s_own_gl_e2e.py", "tests/test_webgl_noise_active.py", "tests/test_webrtc_realness.py::test_a_gateway_that_is_far_away_still_gives_the_page_a_srflx_born_through_its_relay", "tests/test_webrtc_realness.py::test_a_gather_after_the_page_loaded_through_the_gateway_costs_only_the_road_to_the_server", "tests/test_webrtc_realness.py::test_a_host_with_ipv6_addresses_gathers_through_an_ipv4_relay", "tests/test_webrtc_realness.py::test_a_proxy_that_does_not_relay_udp_gives_no_srflx_at_all", "tests/test_webrtc_realness.py::test_a_proxy_whose_relay_never_answers_gives_no_srflx_at_all", "tests/test_webrtc_realness.py::test_a_proxy_whose_udp_leaves_from_another_address_gives_no_srflx_at_all", "tests/test_webrtc_realness.py::test_not_blocked_behind_tcp_only_socks", "tests/test_webrtc_realness.py::test_the_first_candidate_of_a_gather_does_not_wait_for_a_gateway_that_is_far_away", "tests/test_webrtc_realness.py::test_the_turn_over_tcp_of_a_context_goes_through_the_proxy_of_that_context", "tests/test_webrtc_realness.py::test_Line truncated
{"id": "wrapper.e2e.suite.linux.2", "giro": "G2", "os": ["linux"], "min_tests": 414, "exact": true, "tests": ["tests/test_a_click_waits_for_the_navigation_it_plans_e2e.py", "tests/test_a_context_init_script_runs_once_e2e.py", "tests/test_a_drag_keeps_its_buttons_pressed_e2e.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_goto_to_a_response_with_no_document_ends_e2e.py", "tests/test_a_keepalive_request_reaches_the_client_e2e.py", "tests/test_a_latin_letter_on_a_cyrillic_persona_e2e.py", "tests/test_a_page_cannot_probe_the_juggler_e2e.py", "tests/test_a_page_that_moves_on_e2e.py", "tests/test_a_pointer_event_is_handled_before_the_call_returns_e2e.py", "tests/test_a_request_says_what_it_is_e2e.py", "tests/test_a_worker_comes_back_with_its_page_from_the_cache_e2e.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_isolated_page_and_the_next_e2e.py", "tests/test_bypass_csp_e2e.py", "tests/test_caller_world_handles_e2e.py", "tests/test_canvas_reads_as_drawn.py", "tests/test_canvas_render_stealth.py", "tests/test_context_locale_e2e.py", "tests/test_context_proxy_only_resolves_by_doh_e2e.py", "tests/test_doh_through_the_proxy_e2e.py", "tests/test_doh_under_stress_e2e.py", "tests/test_download_is_intercepted_e2e.py", "tests/test_drag_motion.py", "tests/test_expose_binding_e2e.py", "tests/test_fakeweb_p4_e2e.py", "tests/test_fingerprint_consistency.py", "tests/test_fission_frames_dialogs_downloads_popups_e2e.py", "tests/test_fission_frames_route_and_bindings_e2e.py", "tests/test_fission_identity_parity_e2e.py", "tests/test_fission_iframe_crash_e2e.py", "tests/test_fission_strategy1_bench.py", "tests/test_goto_to_the_same_url_e2e.py", "tests/test_http3_through_the_proxy_e2e.py", "tests/test_input_is_born_before_the_page_sees_it_e2e.py", "tests/test_juggler_actions.py", "tests/test_juggler_event_listeners.py", "tests/test_juggler_injected.py::test_a_javascript_that_THROWS_arrives_as_an_error_not_as_None", "tests/test_juggler_injected.py::test_actionability_DISTINGUISHES_instead_of_always_saying_yes", "tests/test_juggler_injected.py::test_reads_that_make_no_sense_are_REJECTED", "tests/test_juggler_injected.py::test_states_DISCRIMINATE_instead_of_always_saying_true", "tests/test_juggler_injected.py::test_the_DOM_READING_group", "tests/test_juggler_injected.py::test_the_selector_engines_respond", "tests/test_juggler_injected.py::test_the_text_reads", "tests/test_juggler_lifecycle_e2e.py", "tests/test_key_delay_reaches_the_keyboard.py", "tests/test_keyboard_rhythm.py", "tests/test_long_session_e2e.py", "tests/test_mouse.py", "tests/test_mouse_events_keep_their_values_e2e.py", "tests/test_new_page_defaults.py", "tests/test_popup_destinations_e2e.py", "tests/test_popup_pages.py", "tests/test_proxy_http_auth_e2e.py", "tests/test_proxy_reaches_the_browser.py", "tests/test_proxy_socks_auth_e2e.py", "tests/test_requestless_navigation.py", "tests/test_route_abort_code.py", "tests/test_route_e2e.py", "tests/test_route_post_data_e2e.py", "tests/test_route_sends_a_navigation_elsewhere_e2e.py", "tests/test_route_superseded_e2e.py", "tests/test_same_document_navigation.py", "tests/test_screenshot_of_text_returns_linux_e2e.py", "tests/test_scroll_into_view.py", "tests/test_scroll_only_if_needed_e2e.py", "tests/test_service_workers_blocked.py", "tests/test_set_input_files_payloads.py", "tests/test_software_compositing_is_declared_e2e.py", "tests/test_the_association_is_ready_when_the_peerconnection_is_born_e2e.py", "tests/test_the_callers_code_runs_once_e2e.py", "tests/test_the_close_returns_when_the_browser_has_exited_e2e.py", "tests/test_the_favicon_stays_out_of_sight_e2e.py", "tests/test_the_font_list_is_the_bundle_e2e.py", "tests/test_the_parent_reads_the_bundle_from_fontconfig_s_cache_linux_e2e.py", "tests/test_the_scheme_is_the_personas_e2e.py", "tests/test_the_whole_udp_chain_by_name_e2e.py::test_a_turn_srflx_by_name_arrives_through_the_relay_when_the_exit_of_the_lab_is_loopback", "tests/test_typing_a_character_without_a_key_e2e.py", "tests/test_wait_for_timeout.py", "tests/test_web_fonts_of_closed_contexts_e2e.py"], "marker": "e2e", "needs_root": false, "windows_twin": "wrapper.e2e.suite.windows.2", "note": "Part 2 of the whole e2e suite of the wrapper (every test that opens the browser: what e2e.yml runs on the published engine), on the engine under test, as two passes through scripts/ci_suite_run.py (4 browsers at once, then the wall_clock tests alone; no rerun). The files of the 2 rows of linux are the files of tests/ that tests/test_the_e2e_suite_is_accounted_for.py holds one by one: a file whole when every test of it is here, else its tests by name. Partition from the junits of runs 44942540063 and 44985244053, test time balanced (about 564 s of estimated wall time, 4 browsers). A new file is added by hand to a row of each system and the minimum of the row goes up by hand. Left out of every row, with the reason in the accounting test: the files and tests of wrapLine truncated
+163 -38
View File
@@ -1,5 +1,5 @@
"""What X itself says about two toplevels of a private display: which one is above, where they are, what visibility X sends the lower one, and whether the
focus moved while it was covered.
pointer or the focus moved while it was covered.
The occlusion e2e test (``test_window_occlusion_e2e.py``) judges a page's ``document.visibilityState`` after a window has covered the first session's one. On
Linux the engine turns a window ``OCCLUDED`` only on a ``VisibilityNotify`` with ``FullyObscured`` of its toplevel (``nsWindow::OnVisibilityNotifyEvent``,
@@ -8,25 +8,34 @@ test reads it without the engine, through a connection of its own to the same di
reuses).
The cover on Linux is a window of the test's own (``cover_window``): an override-redirect ``InputOutput`` window on the private display, larger than the covered
toplevel on every side (``COVER_MARGIN``, inside the screen when it fits), mapped and raised, and never given the input focus (nothing calls ``XSetInputFocus``;
an override-redirect window is not focused). It is not a second Firefox session's window, as it was before, because that window took the X focus when it
mapped: the covered toplevel got ``FocusOut`` and GTK draws a window that loses the focus (``nsWindow::OnExposeEvent``, ``NotifyOcclusionState(VISIBLE)``).
When X delivered ``PartiallyObscured``, ``FocusOut`` and ``FullyObscured`` in one batch, that draw ran 0.4 to 15 ms AFTER the ``FullyObscured`` and turned the
window ``VISIBLE`` again before the posted visibility update ran, so the page never recorded ``hidden`` (hunt run 45603211231, 58 reds of 1294; shard 1
it-0014: ``VisibilityNotify state 1`` at 54.355670, ``OnContainerFocusOutEvent`` at 54.355752, ``state 2`` at 54.356290, ``OnExposeEvent`` with
``mIsFullyOccluded 0`` at 54.359166). That is Mozilla's behaviour, in retail too; the arrangement must not move the focus, and ``focus_moved`` says it did.
toplevel on every side (``COVER_MARGIN``, inside the screen when it fits), mapped and raised, and never given the input focus (nothing calls ``XSetInputFocus``).
It is not a second Firefox session's window, as it was before. Why the arrangement must not move the pointer: the private Xvfb has no window manager, so the
focus is ``PointerRoot`` and GDK treats the toplevel under the pointer as the focused one. Any window mapped over the pointer makes the pointer leave the covered
toplevel; GDK turns that crossing into a GTK focus-out (``OnContainerFocusOutEvent``, then a ``leave notify``) and GTK draws a window that loses the focus
(``nsWindow::OnExposeEvent``, ``NotifyOcclusionState(VISIBLE)``). When X delivered ``PartiallyObscured`` and ``FullyObscured`` close to that crossing, the draw
ran 0.4 to 15 ms AFTER the ``FullyObscured`` and turned the window ``VISIBLE`` again before the posted visibility update ran, so the page never recorded
``hidden`` (hunt run 45603211231, 58 reds of 1294; shard 1 it-0014: ``VisibilityNotify state 1`` at 54.355670, ``OnContainerFocusOutEvent`` at 54.355752,
``state 2`` at 54.356290, ``OnExposeEvent`` with ``mIsFullyOccluded 0`` at 54.359166). That is Mozilla's behaviour, in retail too. The first reading, that the
focus moved to a second session's window and X sent a ``FocusOut``, was refuted by run 45620136865: 458 reds of 463 with an X cover over the pointer, and no
``FocusOut`` in 40 iterations of the old arrangement; the trigger is the pointer crossing. So the test warps the pointer to the bottom-right pixel of the
root (computed from the root's geometry) before any session starts, the cover keeps the pointer outside it, and ``pointer_or_focus_moved`` judges that no
crossing and no focus event reached the covered toplevel and that the pointer, read back once, is outside both rectangles.
* ``watch``: ``XSelectInput(VisibilityChangeMask | FocusChangeMask)`` on the covered toplevel, before the cover is mapped. Every client that selects a mask gets
its own copy of the events, so the engine's own selection is untouched. The ``FocusIn`` and ``FocusOut`` events are kept with their time;
* ``cover_window``: creates, maps and raises the cover (``cover_rectangle`` gives its rectangle); ``destroy_window`` destroys it;
* ``warp_pointer_to_the_corner``: ``XWarpPointer`` through this connection to ``(width - 1, height - 1)`` of the root, then ``XSync``;
* ``watch``: ``XSelectInput(VisibilityChangeMask | FocusChangeMask | EnterWindowMask | LeaveWindowMask)`` on the covered toplevel, before the cover is mapped.
Every client that selects a mask gets its own copy of the events, so the engine's own selection is untouched. The ``EnterNotify``, ``LeaveNotify``,
``FocusIn`` and ``FocusOut`` events are kept with their time, mode and detail;
* ``cover_window``: reads the pointer (``XQueryPointer`` of the root), creates, maps and raises the cover (``cover_rectangle`` gives its rectangle, the pointer
outside it); ``destroy_window`` destroys it;
* ``raise_and_read``: ``XRaiseWindow`` of the covering toplevel, then ONE read-back of the stacking (``XQueryTree`` of the root, bottom to top: no window
manager reparents the toplevels) and of the two geometries (``XGetWindowAttributes``, relative to the root);
* ``drain``: the ``VisibilityNotify`` and the focus events that arrived, with the time since ``watch`` (evidence, and the precondition ``focus_moved``);
* ``read_pointer_back``: ONE ``XQueryPointer`` right after the cover is up, kept in the record with whether the pointer lies outside both rectangles;
* ``drain``: the visibility, crossing and focus events that arrived, with the time since ``watch`` (evidence, and the precondition);
* ``shrink_by_one``: ``XResizeWindow`` of the covered toplevel, one pixel narrower, the cover left above it and larger: a draw of a window that stays
covered (see ``control_sees_hidden``).
The pure parts (``visibility_of``, ``focus_of``, ``cover_rectangle``, ``arrangement``, ``VisibilityRecord``, ``focus_moved``, ``control_sees_hidden``,
``product_stays_visible``) are tested without a display in ``test_the_x_record_of_the_occlusion_test.py``.
The pure parts (``visibility_of``, ``focus_of``, ``crossing_of``, ``cover_rectangle``, ``arrangement``, ``VisibilityRecord``, ``pointer_or_focus_moved``,
``control_sees_hidden``, ``product_stays_visible``) are tested without a display in ``test_the_x_record_of_the_occlusion_test.py``.
"""
from __future__ import annotations
@@ -47,6 +56,12 @@ FOCUS_MODES = {0: "NotifyNormal", 1: "NotifyGrab", 2: "NotifyUngrab", 3: "Notify
FOCUS_DETAILS = {0: "NotifyAncestor", 1: "NotifyVirtual", 2: "NotifyInferior", 3: "NotifyNonlinear", 4: "NotifyNonlinearVirtual", 5: "NotifyPointer",
6: "NotifyPointerRoot", 7: "NotifyDetailNone"}
FOCUS_NAMES = {FOCUS_IN: "FocusIn", FOCUS_OUT: "FocusOut"}
#: ``EnterNotify`` and ``LeaveNotify`` (``X.h``), ``EnterWindowMask`` (bit 4) and ``LeaveWindowMask`` (bit 5); their ``mode`` and ``detail`` read as the focus ones.
ENTER_NOTIFY, LEAVE_NOTIFY = 7, 8
ENTER_WINDOW_MASK, LEAVE_WINDOW_MASK = 1 << 4, 1 << 5
CROSSING_NAMES = {ENTER_NOTIFY: "EnterNotify", LEAVE_NOTIFY: "LeaveNotify"}
#: What ``watch`` selects on the covered toplevel.
WATCH_MASK = VISIBILITY_CHANGE_MASK | FOCUS_CHANGE_MASK | ENTER_WINDOW_MASK | LEAVE_WINDOW_MASK
#: ``CWBackPixel`` and ``CWOverrideRedirect`` of ``XChangeWindowAttributes``, the margin the cover has on every side of the covered toplevel (pixels) and its
#: background pixel.
CW_BACK_PIXEL, CW_OVERRIDE_REDIRECT = 1 << 1, 1 << 9
@@ -87,6 +102,13 @@ class XFocusChangeEvent(ctypes.Structure):
("window", ctypes.c_ulong), ("mode", ctypes.c_int), ("detail", ctypes.c_int)]
class XCrossingEvent(ctypes.Structure):
_fields_ = [("type", ctypes.c_int), ("serial", ctypes.c_ulong), ("send_event", ctypes.c_int), ("display", ctypes.c_void_p),
("window", ctypes.c_ulong), ("root", ctypes.c_ulong), ("subwindow", ctypes.c_ulong), ("time", ctypes.c_ulong),
("x", ctypes.c_int), ("y", ctypes.c_int), ("x_root", ctypes.c_int), ("y_root", ctypes.c_int), ("mode", ctypes.c_int),
("detail", ctypes.c_int), ("same_screen", ctypes.c_int), ("focus", ctypes.c_int), ("state", ctypes.c_uint)]
class XSetWindowAttributes(ctypes.Structure):
_fields_ = [("background_pixmap", ctypes.c_ulong), ("background_pixel", ctypes.c_ulong), ("border_pixmap", ctypes.c_ulong), ("border_pixel", ctypes.c_ulong),
("bit_gravity", ctypes.c_int), ("win_gravity", ctypes.c_int), ("backing_store", ctypes.c_int), ("backing_planes", ctypes.c_ulong),
@@ -95,8 +117,9 @@ class XSetWindowAttributes(ctypes.Structure):
class XEvent(ctypes.Union):
"""Xlib's ``XEvent``: the type, the visibility and focus members, and the padding of 24 longs that gives the union its size."""
_fields_ = [("type", ctypes.c_int), ("xvisibility", XVisibilityEvent), ("xfocus", XFocusChangeEvent), ("pad", ctypes.c_long * 24)]
"""Xlib's ``XEvent``: the type, the visibility, focus and crossing members, and the padding of 24 longs that gives the union its size."""
_fields_ = [("type", ctypes.c_int), ("xvisibility", XVisibilityEvent), ("xfocus", XFocusChangeEvent), ("xcrossing", XCrossingEvent),
("pad", ctypes.c_long * 24)]
def visibility_of(event: XEvent) -> Optional[Tuple[int, str]]:
@@ -116,19 +139,57 @@ def focus_of(event: XEvent) -> Optional[Tuple[int, str, str, str]]:
FOCUS_DETAILS.get(focus.detail, "detail %d" % focus.detail))
def crossing_of(event: XEvent) -> Optional[Tuple[int, str, str, str, int, int]]:
"""(window, ``EnterNotify`` or ``LeaveNotify``, mode name, detail name, x_root, y_root) of a crossing event; None for any other event."""
if event.type not in CROSSING_NAMES:
return None
crossing = event.xcrossing
return (int(crossing.window), CROSSING_NAMES[event.type], FOCUS_MODES.get(crossing.mode, "mode %d" % crossing.mode),
FOCUS_DETAILS.get(crossing.detail, "detail %d" % crossing.detail), int(crossing.x_root), int(crossing.y_root))
def corner_of(screen: Dict[str, int]) -> Tuple[int, int]:
"""The point the pointer is warped to: the bottom-right pixel of the root, from its read-back geometry (never a fixed number)."""
return (int(screen["width"]) - 1, int(screen["height"]) - 1)
def point_in(point: Tuple[int, int], rectangle: Tuple[int, int, int, int]) -> bool:
"""Whether ``point`` is a pixel of ``rectangle`` (left, top, right, bottom; the right and bottom edges are outside, as in X)."""
return rectangle[0] <= point[0] < rectangle[2] and rectangle[1] <= point[1] < rectangle[3]
def outer(geometry: Dict[str, int]) -> Tuple[int, int, int, int]:
"""(left, top, right, bottom) of a window with its border, from ``x``, ``y``, ``width``, ``height``, ``border``."""
border = geometry.get("border", 0)
return (geometry["x"], geometry["y"], geometry["x"] + geometry["width"] + 2 * border, geometry["y"] + geometry["height"] + 2 * border)
def cover_rectangle(covered: Dict[str, int], screen: Dict[str, int], margin: int = COVER_MARGIN) -> Tuple[int, int, int, int]:
def cover_rectangle(covered: Dict[str, int], screen: Dict[str, int], margin: int = COVER_MARGIN,
pointer: Optional[Tuple[int, int]] = None) -> Tuple[int, int, int, int]:
"""(x, y, width, height) of the cover: the covered toplevel's rectangle with its border (``outer``) and ``margin`` pixels more on every side, kept inside
the screen (``screen``: ``width`` and ``height`` of the root) where that fits; a side that the screen cuts is the covered window's own side, so the cover
always contains the covered rectangle."""
always contains the covered rectangle.
With a ``pointer`` (x, y in root coordinates) the cover also leaves that pixel outside it: on the side where the margin would include the pointer, the
margin shrinks until the pointer is outside (never below the covered rectangle). A pointer inside the covered rectangle itself has no such side: an
AssertionError "arrangement: the pointer is inside the covered window, no free point on the screen"."""
left, top, right, bottom = outer(covered)
inner = (left, top, right, bottom)
if pointer is not None and point_in(pointer, inner):
raise AssertionError("arrangement: the pointer is inside the covered window, no free point on the screen: pointer %r, covered %r" % (tuple(pointer), inner))
left, top = max(left - margin, min(0, left)), max(top - margin, min(0, top))
right, bottom = min(right + margin, max(screen["width"], right)), min(bottom + margin, max(screen["height"], bottom))
if pointer is not None and point_in(pointer, (left, top, right, bottom)):
px, py = pointer
il, it, ir, ib = inner
if px >= ir:
right = px
elif px < il:
left = px + 1
elif py >= ib:
bottom = py
else:
top = py + 1
return (left, top, right - left, bottom - top)
@@ -147,13 +208,16 @@ def arrangement(stacking: Sequence[int], covered: int, cover: int, geometries: D
class VisibilityRecord:
"""The ``VisibilityNotify`` and the focus events (``FocusIn``, ``FocusOut``) of one watched window, each with the seconds since the watch began; events of
other windows are not kept."""
"""The ``VisibilityNotify``, crossing (``EnterNotify``, ``LeaveNotify``) and focus (``FocusIn``, ``FocusOut``) events of one watched window, each with the
seconds since the watch began; events of other windows are not kept."""
def __init__(self, window: int) -> None:
self.window = window
self.events: List[Dict[str, object]] = []
self.focus: List[Dict[str, object]] = []
self.crossings: List[Dict[str, object]] = []
#: The pointer read back once after the cover was up (``XVisibility.read_pointer_back``), or None.
self.pointer: Optional[Dict[str, object]] = None
def add(self, window: int, state: str, since: float) -> None:
if window == self.window:
@@ -163,6 +227,10 @@ class VisibilityRecord:
if window == self.window:
self.focus.append({"event": kind, "mode": mode, "detail": detail, "t": round(since, 4)})
def add_crossing(self, window: int, kind: str, mode: str, detail: str, since: float, x_root: int = 0, y_root: int = 0) -> None:
if window == self.window:
self.crossings.append({"event": kind, "mode": mode, "detail": detail, "t": round(since, 4), "at": [x_root, y_root]})
def first(self, state: str = FULLY_OBSCURED) -> Optional[Dict[str, object]]:
return next((event for event in self.events if event["state"] == state), None)
@@ -171,11 +239,13 @@ class VisibilityRecord:
return next((event for event in self.focus if event["event"] == "FocusOut"), None)
def line(self) -> str:
"""One line: the states X sent, in order, with their times, then the focus events (none: nothing is said of them)."""
"""One line: the states X sent, in order, with their times, then the crossings and the focus events (none: nothing is said of them)."""
if not self.events:
seen = "X sent window 0x%x no VisibilityNotify" % self.window
else:
seen = "X sent window 0x%x: %s" % (self.window, ", ".join("%s at +%.3f s" % (event["state"], event["t"]) for event in self.events))
if self.crossings:
seen += "; pointer: %s" % ", ".join("%s at +%.3f s (%s, %s)" % (event["event"], event["t"], event["mode"], event["detail"]) for event in self.crossings)
if self.focus:
seen += "; focus: %s" % ", ".join("%s at +%.3f s (%s, %s)" % (event["event"], event["t"], event["mode"], event["detail"]) for event in self.focus)
return seen
@@ -184,18 +254,32 @@ class VisibilityRecord:
first, out = self.first(), self.focus_out()
return {"window": "0x%x" % self.window, "events": list(self.events), "fully obscured arrived": first is not None,
"fully obscured at": first["t"] if first else None, "focus events": list(self.focus), "focus out arrived": out is not None,
"focus out at": out["t"] if out else None}
"focus out at": out["t"] if out else None, "crossings": list(self.crossings), "pointer read back": self.pointer}
def focus_moved(record: Optional[VisibilityRecord]) -> str:
"""The judgement of the precondition: '' when the covered toplevel got no ``FocusOut`` since the watch began, else the message of the red, which starts with
"arrangement: the covering moved the focus" and carries the X record. A ``FocusOut`` makes GTK draw the window (``nsWindow::OnExposeEvent``,
``NotifyOcclusionState(VISIBLE)``) at a moment the test does not control, so a run that had one proves nothing about the verdict."""
out = record.focus_out() if record is not None else None
if out is None:
def pointer_or_focus_moved(record: Optional[VisibilityRecord]) -> str:
"""The judgement of the precondition: '' when the covered toplevel got no ``EnterNotify``, ``LeaveNotify``, ``FocusIn`` or ``FocusOut`` since the watch began
and the pointer, read back once after the cover was up, lies outside both rectangles; else the message of the red, which starts with "arrangement: the
covering moved the pointer or the focus" and carries the X record. A pointer crossing is turned by GDK into a GTK focus-out and that makes GTK draw the
window (``nsWindow::OnExposeEvent``, ``NotifyOcclusionState(VISIBLE)``) at a moment the test does not control, so a run that had one proves nothing about
the verdict. A record with no pointer read back is not judged on the pointer (the test asserts that the read-back was made)."""
if record is None:
return ""
return ("arrangement: the covering moved the focus: the covered toplevel got FocusOut at +%.3f s after the watch began, so the page may have been drawn "
"again after X's FullyObscured and the run proves nothing about the engine; %s" % (out["t"], record.line()))
reasons = []
if record.crossings:
first = record.crossings[0]
reasons.append("the covered toplevel got %s at +%.3f s after the watch began (%d crossing event(s))" % (first["event"], first["t"], len(record.crossings)))
if record.focus:
first = record.focus[0]
reasons.append("the covered toplevel got %s at +%.3f s after the watch began (%d focus event(s))" % (first["event"], first["t"], len(record.focus)))
pointer = record.pointer
if pointer is not None and not (pointer.get("outside covered") and pointer.get("outside cover")):
reasons.append("the pointer read back at %r is inside the covered rectangle (outside: %s) or the cover's (outside: %s)" % (
pointer.get("at"), pointer.get("outside covered"), pointer.get("outside cover")))
if not reasons:
return ""
return ("arrangement: the covering moved the pointer or the focus: %s, so the page may have been drawn again after X's FullyObscured and the run proves "
"nothing about the engine; %s" % ("; ".join(reasons), record.line()))
class XVisibility(XFocus):
@@ -213,20 +297,48 @@ class XVisibility(XFocus):
x11.XMapWindow.argtypes = (ctypes.c_void_p, ctypes.c_ulong)
x11.XDestroyWindow.argtypes = (ctypes.c_void_p, ctypes.c_ulong)
x11.XRaiseWindow.argtypes = (ctypes.c_void_p, ctypes.c_ulong)
x11.XWarpPointer.argtypes = (ctypes.c_void_p, ctypes.c_ulong, ctypes.c_ulong, ctypes.c_int, ctypes.c_int, ctypes.c_uint, ctypes.c_uint, ctypes.c_int,
ctypes.c_int)
x11.XQueryPointer.argtypes = (ctypes.c_void_p, ctypes.c_ulong, ctypes.POINTER(ctypes.c_ulong), ctypes.POINTER(ctypes.c_ulong),
ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int),
ctypes.POINTER(ctypes.c_uint))
x11.XResizeWindow.argtypes = (ctypes.c_void_p, ctypes.c_ulong, ctypes.c_uint, ctypes.c_uint)
x11.XPending.argtypes = (ctypes.c_void_p,)
x11.XNextEvent.argtypes = (ctypes.c_void_p, ctypes.POINTER(XEvent))
self.record: Optional[VisibilityRecord] = None
self.started = 0.0
#: Where ``warp_pointer_to_the_corner`` put the pointer, and the root geometry it was computed from.
self.warped: Optional[Dict[str, object]] = None
def query_pointer(self) -> Tuple[int, int]:
"""The pointer's position in root coordinates (``XQueryPointer`` of the root)."""
root, child = ctypes.c_ulong(), ctypes.c_ulong()
root_x, root_y, win_x, win_y, mask = ctypes.c_int(), ctypes.c_int(), ctypes.c_int(), ctypes.c_int(), ctypes.c_uint()
self.x11.XQueryPointer(self.connection, self.root, ctypes.byref(root), ctypes.byref(child), ctypes.byref(root_x), ctypes.byref(root_y),
ctypes.byref(win_x), ctypes.byref(win_y), ctypes.byref(mask))
return (int(root_x.value), int(root_y.value))
def warp_pointer_to_the_corner(self) -> Tuple[int, int]:
"""Before any session starts: ``XWarpPointer`` through this connection to the bottom-right pixel of the root (``corner_of`` its read-back geometry), then
``XSync``. No toplevel exists yet, so none gets a crossing from it; the pointer is read back and kept in ``warped``."""
screen = self.geometry(self.root)
assert screen, "arrangement: the geometry of the root could not be read"
x, y = corner_of(screen)
self.x11.XWarpPointer(self.connection, 0, self.root, 0, 0, 0, 0, x, y)
self.x11.XSync(self.connection, False)
self.warped = {"to": [x, y], "root": [screen["width"], screen["height"]], "read back": list(self.query_pointer())}
return (x, y)
def drain(self) -> Optional[VisibilityRecord]:
"""Reads every event that arrived (none blocks: ``XPending`` first) into the record of the watched window: visibility and focus events."""
"""Reads every event that arrived (none blocks: ``XPending`` first) into the record of the watched window: visibility, crossing and focus events."""
self.x11.XSync(self.connection, False)
event = XEvent()
while self.x11.XPending(self.connection) > 0:
self.x11.XNextEvent(self.connection, ctypes.byref(event))
seen, focus = visibility_of(event), focus_of(event)
seen, focus, crossing = visibility_of(event), focus_of(event), crossing_of(event)
if self.record is not None:
if crossing:
self.record.add_crossing(crossing[0], crossing[1], crossing[2], crossing[3], time.monotonic() - self.started, crossing[4], crossing[5])
if seen:
self.record.add(seen[0], seen[1], time.monotonic() - self.started)
if focus:
@@ -234,13 +346,13 @@ class XVisibility(XFocus):
return self.record
def watch(self, window: int) -> VisibilityRecord:
"""From now on, the ``VisibilityNotify`` and ``FocusIn``/``FocusOut`` events of ``window``; what was queued before (an earlier window's) is read and
dropped first."""
"""From now on, the ``VisibilityNotify``, ``EnterNotify``/``LeaveNotify`` and ``FocusIn``/``FocusOut`` events of ``window``; what was queued before (an
earlier window's) is read and dropped first."""
self.record = None
self.drain()
self.record = VisibilityRecord(window)
self.started = time.monotonic()
self.x11.XSelectInput(self.connection, window, VISIBILITY_CHANGE_MASK | FOCUS_CHANGE_MASK)
self.x11.XSelectInput(self.connection, window, WATCH_MASK)
self.x11.XSync(self.connection, False)
return self.record
@@ -264,11 +376,12 @@ class XVisibility(XFocus):
def cover_window(self, covered: int, margin: int = COVER_MARGIN) -> int:
"""The cover: an override-redirect ``InputOutput`` window of this connection, covering ``covered`` with ``margin`` pixels more on every side (inside the
screen where it fits, ``cover_rectangle``), mapped and raised, the requests flushed. An override-redirect window is not managed, and nothing here asks
for the input focus (no ``XSetInputFocus``): the focus stays where it was. No event is selected on it."""
screen where it fits, the pointer, read with ``XQueryPointer``, outside it: ``cover_rectangle``), mapped and raised, the requests flushed. An
override-redirect window is not managed, and nothing here asks for the input focus (no ``XSetInputFocus``). No event is selected on it. The pointer
inside the covered window is an AssertionError "arrangement: the pointer is inside the covered window, no free point on the screen"."""
inner, screen = self.geometry(covered), self.geometry(self.root)
assert inner and screen, "arrangement: the geometry of the covered toplevel or of the root could not be read: %r, %r" % (inner, screen)
x, y, width, height = cover_rectangle(inner, screen, margin)
x, y, width, height = cover_rectangle(inner, screen, margin, self.query_pointer())
window = int(self.x11.XCreateSimpleWindow(self.connection, self.root, x, y, width, height, 0, 0, COVER_BACKGROUND))
assert window, "arrangement: XCreateSimpleWindow gave no window"
attributes = XSetWindowAttributes()
@@ -280,6 +393,18 @@ class XVisibility(XFocus):
self.x11.XSync(self.connection, False)
return window
def read_pointer_back(self, covered: int, cover: int) -> Dict[str, object]:
"""ONE ``XQueryPointer`` right after the cover is up: where the pointer is and whether it lies outside the covered rectangle and the cover's. Kept in the
record of the watch (``pointer``) and returned."""
at = self.query_pointer()
rectangles = {name: outer(geometry) if geometry else None for name, geometry in (("covered", self.geometry(covered)), ("cover", self.geometry(cover)))}
seen = {"at": list(at), "covered rect": rectangles["covered"], "cover rect": rectangles["cover"],
"outside covered": rectangles["covered"] is not None and not point_in(at, rectangles["covered"]),
"outside cover": rectangles["cover"] is not None and not point_in(at, rectangles["cover"])}
if self.record is not None:
self.record.pointer = seen
return seen
def destroy_window(self, window: int) -> None:
"""``XDestroyWindow`` of a window this connection made (the cover); nothing else."""
self.x11.XDestroyWindow(self.connection, window)
+201 -43
View File
@@ -4,10 +4,14 @@ On Linux the occlusion test rests its verdict on what X says: the cover above th
``XRaiseWindow``), and a ``VisibilityNotify FullyObscured`` of the covered toplevel. A wrong reading here would make an "arrangement" red of a good run, or
let a run whose windows were never covered pass as a proof; so the parsing of the event, the judgement of the read-back and the record are fixed here.
The cover is a window of the test's own, an override-redirect one that never takes the focus (a second session's window did: the covered toplevel got
``FocusOut`` and GTK drew it again after ``FullyObscured``, hunt run 45603211231). So the focus events are fixed here too: how they are read, kept with their
time and shown in the line of the record, and the precondition "the covering moved no focus" judged on a record with a ``FocusOut`` (red) and without (green);
how the cover is made (override-redirect, rectangle, no ``XSetInputFocus``); and that the engine's log of a test names a file per process (``%PID``).
The cover is a window of the test's own, an override-redirect one that never takes the focus, and the pointer is kept out of its way: with no window manager
the focus follows the pointer, a window mapped over the pointer makes it leave the covered toplevel, and GDK turns that crossing into a focus-out that makes GTK
draw the window again after ``FullyObscured`` (hunt run 45603211231; the reading "a second session took the focus" was refuted by run 45620136865). So the
crossing and focus events are fixed here too: how they are read, kept with their time and shown in the line of the record; the precondition "the covering moved
neither the pointer nor the focus" judged on a record with a ``LeaveNotify`` (red), a ``FocusOut`` (red), a pointer read back inside a rectangle (red) and
otherwise (green); the cover that leaves the pointer outside, and the error when the pointer is inside the covered window; the warp of the pointer to the
corner computed from the root's geometry; how the cover is made (override-redirect, rectangle, no ``XSetInputFocus``); and that the engine's log of a test
names a file per process (``%PID``).
"""
from __future__ import annotations
@@ -19,9 +23,10 @@ import pathlib
import pytest
from _evidence_on_failure import MOZ_LOG_BASE, FailureEvidence
from _x_visibility import (COVER_MARGIN, CW_OVERRIDE_REDIRECT, FOCUS_CHANGE_MASK, FOCUS_IN, FOCUS_OUT, VISIBILITY_CHANGE_MASK, VISIBILITY_NOTIFY,
VisibilityRecord, XEvent, XVisibility, arrangement, control_sees_hidden, cover_rectangle, focus_moved, focus_of, outer,
product_stays_visible, visibility_of)
from _x_visibility import (COVER_MARGIN, CW_OVERRIDE_REDIRECT, ENTER_NOTIFY, ENTER_WINDOW_MASK, FOCUS_CHANGE_MASK, FOCUS_IN, FOCUS_OUT, LEAVE_NOTIFY,
LEAVE_WINDOW_MASK, VISIBILITY_CHANGE_MASK, VISIBILITY_NOTIFY, WATCH_MASK, VisibilityRecord, XCrossingEvent, XEvent,
XVisibility, arrangement, control_sees_hidden, corner_of, cover_rectangle, crossing_of, focus_of, outer,
pointer_or_focus_moved, product_stays_visible, visibility_of)
COVERED, COVER, OTHER = 0x400001, 0x600001, 0x200001
SAME = {"x": 0, "y": 0, "width": 1280, "height": 720, "border": 0}
@@ -210,24 +215,96 @@ def test_a_record_without_focus_events_says_so_and_its_line_is_the_one_of_the_vi
assert VisibilityRecord(COVERED).line() == "X sent window 0x400001 no VisibilityNotify"
def test_the_precondition_is_red_on_a_record_with_a_focus_out_and_green_without_one():
moved = VisibilityRecord(COVERED)
moved.add(COVERED, "PartiallyObscured", 0.25)
moved.add_focus(COVERED, "FocusOut", "NotifyNormal", "NotifyNonlinear", 0.2501)
moved.add(COVERED, "FullyObscured", 0.31)
message = focus_moved(moved)
assert message.startswith("arrangement: the covering moved the focus")
assert moved.line() in message and "FocusOut at +0.250 s" in message
def a_crossing_event(kind, window, mode=0, detail=3, x_root=0, y_root=0):
event = XEvent()
event.xcrossing.type = kind
event.xcrossing.window = window
event.xcrossing.mode = mode
event.xcrossing.detail = detail
event.xcrossing.x_root = x_root
event.xcrossing.y_root = y_root
return event
kept = VisibilityRecord(COVERED)
kept.add(COVERED, "PartiallyObscured", 0.25)
kept.add(COVERED, "FullyObscured", 0.31)
assert focus_moved(kept) == ""
# a FocusIn alone, a FocusOut of another window and no record at all do not say the covered toplevel lost the focus
kept.add_focus(COVERED, "FocusIn", "NotifyNormal", "NotifyAncestor", 0.1)
def test_a_crossing_event_is_read_with_its_window_kind_mode_detail_and_root_position():
assert ENTER_NOTIFY == 7 and LEAVE_NOTIFY == 8 and ENTER_WINDOW_MASK == 1 << 4 and LEAVE_WINDOW_MASK == 1 << 5
assert crossing_of(a_crossing_event(LEAVE_NOTIFY, COVERED, 0, 3, 960, 540)) == (COVERED, "LeaveNotify", "NotifyNormal", "NotifyNonlinear", 960, 540)
assert crossing_of(a_crossing_event(ENTER_NOTIFY, COVER, 1, 0)) == (COVER, "EnterNotify", "NotifyGrab", "NotifyAncestor", 0, 0)
assert crossing_of(a_focus_event(FOCUS_OUT, COVERED)) is None and focus_of(a_crossing_event(LEAVE_NOTIFY, COVERED)) is None
assert visibility_of(a_crossing_event(LEAVE_NOTIFY, COVERED)) is None
def test_the_crossing_member_has_xlibs_layout():
offsets = {name: getattr(XCrossingEvent, name).offset for name, _ in XCrossingEvent._fields_}
word = ctypes.sizeof(ctypes.c_long)
if word == 8: # LP64: the layout of Xlib's XCrossingEvent
assert offsets["window"] == 32 and offsets["root"] == 40 and offsets["subwindow"] == 48 and offsets["time"] == 56
assert offsets["x"] == 64 and offsets["x_root"] == 72 and offsets["mode"] == 80 and offsets["detail"] == 84 and offsets["state"] == 96
assert ctypes.sizeof(XEvent) == 24 * word
def test_the_record_keeps_the_crossings_of_the_watched_window_with_their_times_and_shows_them():
record = VisibilityRecord(COVERED)
record.add_crossing(OTHER, "LeaveNotify", "NotifyNormal", "NotifyNonlinear", 0.1, 1, 2)
assert record.crossings == []
record.add_crossing(COVERED, "LeaveNotify", "NotifyNormal", "NotifyNonlinear", 0.31234, 960, 540)
record.add_crossing(COVERED, "EnterNotify", "NotifyNormal", "NotifyAncestor", 0.4, 10, 11)
assert record.crossings[0] == {"event": "LeaveNotify", "mode": "NotifyNormal", "detail": "NotifyNonlinear", "t": 0.3123, "at": [960, 540]}
assert record.line() == ("X sent window 0x400001 no VisibilityNotify; pointer: LeaveNotify at +0.312 s (NotifyNormal, NotifyNonlinear), "
"EnterNotify at +0.400 s (NotifyNormal, NotifyAncestor)")
saved = record.as_dict()
assert len(saved["crossings"]) == 2 and saved["pointer read back"] is None
assert json.loads(json.dumps(saved)) == saved
def a_pointer(at, covered=True, cover=True):
return {"at": list(at), "outside covered": covered, "outside cover": cover}
def a_calm_record():
record = VisibilityRecord(COVERED)
record.add(COVERED, "PartiallyObscured", 0.25)
record.add(COVERED, "FullyObscured", 0.31)
record.pointer = a_pointer((1919, 1079))
return record
def test_the_precondition_is_green_on_a_calm_record():
kept = a_calm_record()
assert pointer_or_focus_moved(kept) == ""
# the events of another window and no record at all do not say the covered toplevel was crossed or lost the focus
kept.add_focus(OTHER, "FocusOut", "NotifyNormal", "NotifyNonlinear", 0.2)
assert focus_moved(kept) == ""
assert focus_moved(None) == ""
kept.add_crossing(OTHER, "LeaveNotify", "NotifyNormal", "NotifyNonlinear", 0.2)
assert pointer_or_focus_moved(kept) == ""
assert pointer_or_focus_moved(None) == ""
def test_the_precondition_is_red_on_a_leave_notify_of_the_covered_toplevel():
moved = a_calm_record()
moved.add_crossing(COVERED, "LeaveNotify", "NotifyNormal", "NotifyNonlinear", 0.2501, 960, 540)
message = pointer_or_focus_moved(moved)
assert message.startswith("arrangement: the covering moved the pointer or the focus")
assert moved.line() in message and "LeaveNotify at +0.250 s" in message
def test_the_precondition_is_red_on_an_enter_notify_and_on_a_focus_out_or_a_focus_in():
for add in (lambda r: r.add_crossing(COVERED, "EnterNotify", "NotifyNormal", "NotifyAncestor", 0.2),
lambda r: r.add_focus(COVERED, "FocusOut", "NotifyNormal", "NotifyNonlinear", 0.2501),
lambda r: r.add_focus(COVERED, "FocusIn", "NotifyNormal", "NotifyAncestor", 0.1)):
moved = a_calm_record()
add(moved)
message = pointer_or_focus_moved(moved)
assert message.startswith("arrangement: the covering moved the pointer or the focus"), message
assert moved.line() in message
def test_the_precondition_is_red_on_a_pointer_read_back_inside_the_covered_window_or_the_cover():
for pointer in (a_pointer((100, 100), covered=False, cover=False), a_pointer((10, 10), covered=True, cover=False)):
moved = a_calm_record()
moved.pointer = pointer
message = pointer_or_focus_moved(moved)
assert message.startswith("arrangement: the covering moved the pointer or the focus"), message
assert "the pointer read back at %r" % (pointer["at"],) in message
class _FullXlib(_Xlib):
@@ -236,6 +313,7 @@ class _FullXlib(_Xlib):
def __init__(self):
super().__init__()
self.calls, self.created, self.attributes, self.masks, self.queue = [], [], [], [], []
self.pointer, self.warps = (1919, 1079), []
def XSelectInput(self, connection, window, mask):
self.masks.append((window, mask))
@@ -263,6 +341,14 @@ class _FullXlib(_Xlib):
def XDestroyWindow(self, connection, window):
self.calls.append(("destroy", window))
def XWarpPointer(self, connection, source, destination, source_x, source_y, source_width, source_height, x, y):
self.warps.append({"source": source, "destination": destination, "from": (source_x, source_y, source_width, source_height), "to": (x, y)})
self.pointer = (x, y)
def XQueryPointer(self, connection, window, root, child, root_x, root_y, win_x, win_y, mask):
root_x._obj.value, root_y._obj.value = self.pointer
return 1
def an_x_connection(xlib=None):
x = object.__new__(XVisibility)
@@ -271,22 +357,25 @@ def an_x_connection(xlib=None):
return x
def test_drain_keeps_the_focus_events_of_the_watched_window_and_the_visibility_ones_in_order():
def test_drain_keeps_the_crossing_and_focus_events_of_the_watched_window_and_the_visibility_ones_in_order():
x = an_x_connection()
x.watch(COVERED)
x.x11.queue = [an_event(VISIBILITY_NOTIFY, COVERED, 1), a_focus_event(FOCUS_OUT, COVERED), an_event(VISIBILITY_NOTIFY, COVERED, 2),
a_focus_event(FOCUS_OUT, OTHER)]
x.x11.queue = [an_event(VISIBILITY_NOTIFY, COVERED, 1), a_crossing_event(LEAVE_NOTIFY, COVERED, 0, 3, 960, 540), a_focus_event(FOCUS_OUT, COVERED),
an_event(VISIBILITY_NOTIFY, COVERED, 2), a_focus_event(FOCUS_OUT, OTHER), a_crossing_event(ENTER_NOTIFY, OTHER)]
record = x.drain()
assert [event["state"] for event in record.events] == ["PartiallyObscured", "FullyObscured"]
assert [(event["event"], event["detail"]) for event in record.focus] == [("FocusOut", "NotifyNonlinear")]
assert focus_moved(record).startswith("arrangement: the covering moved the focus")
assert [(event["event"], event["at"]) for event in record.crossings] == [("LeaveNotify", [960, 540])]
assert pointer_or_focus_moved(record).startswith("arrangement: the covering moved the pointer or the focus")
def test_watch_selects_the_focus_events_together_with_the_visibility_ones():
def test_watch_selects_the_focus_and_crossing_events_together_with_the_visibility_ones():
x = an_x_connection()
x.watch(COVERED)
assert x.x11.masks == [(COVERED, VISIBILITY_CHANGE_MASK | FOCUS_CHANGE_MASK)]
assert x.x11.masks[0][1] & (1 << 16) and x.x11.masks[0][1] & (1 << 21)
assert WATCH_MASK == VISIBILITY_CHANGE_MASK | FOCUS_CHANGE_MASK | ENTER_WINDOW_MASK | LEAVE_WINDOW_MASK
assert x.x11.masks == [(COVERED, WATCH_MASK)]
mask = x.x11.masks[0][1]
assert mask & (1 << 16) and mask & (1 << 21) and mask & (1 << 4) and mask & (1 << 5)
SCREEN = {"width": 1920, "height": 1080}
@@ -311,6 +400,62 @@ def test_a_cover_that_the_screen_cuts_keeps_the_covered_windows_own_side_and_nev
assert cover_rectangle(outside, SCREEN) == (-20, -5, 2000, 1100)
def test_a_cover_leaves_the_pointer_outside_it_where_the_margin_would_include_it():
pointer = (1919, 1079) # the bottom-right pixel of a 1920x1080 root
near = {"x": 600, "y": 300, "width": 1300, "height": 760, "border": 0} # its right edge is 1900 and its bottom 1060: the margins reach the pointer
assert cover_rectangle(near, SCREEN) == (568, 268, 1352, 812)
left, top, width, height = cover_rectangle(near, SCREEN, pointer=pointer)
assert not (left <= pointer[0] < left + width and top <= pointer[1] < top + height)
assert (left, top) == (568, 268) and left + width == 1919 # the right margin shrank to the pointer, the others stay
assert left <= 600 and top <= 300 and left + width >= 1900 and top + height >= 1060 # the covered rectangle is still inside
# a pointer on the left or above the covered window is kept out on that side
at_the_top_left = {"x": 20, "y": 20, "width": 800, "height": 600, "border": 0}
x, y, width, height = cover_rectangle(at_the_top_left, SCREEN, pointer=(0, 0))
assert (x, y) == (1, 0) and x + width == 852 and y + height == 652
assert cover_rectangle(at_the_top_left, SCREEN, pointer=(20, 0))[:2] == (0, 1)
# a pointer already outside the margins changes nothing
assert cover_rectangle(near, SCREEN, pointer=(0, 0)) == cover_rectangle(near, SCREEN)
def test_the_pointer_inside_the_covered_window_is_an_arrangement_error_with_no_free_point():
covered = {"x": 0, "y": 0, "width": 1920, "height": 1080, "border": 0} # a covered window that fills the screen
with pytest.raises(AssertionError, match="^arrangement: the pointer is inside the covered window, no free point on the screen"):
cover_rectangle(covered, SCREEN, pointer=(1919, 1079))
xlib = _FullXlib()
x = an_x_connection(xlib)
geometries = {COVERED: dict(covered), 0x1: dict(SCREEN, x=0, y=0, border=0)}
x.geometry = lambda window: geometries[window]
with pytest.raises(AssertionError, match="^arrangement: the pointer is inside the covered window, no free point on the screen"):
x.cover_window(COVERED)
assert xlib.created == [] and xlib.calls == [] # nothing was made
def test_the_pointer_is_warped_to_the_bottom_right_pixel_of_the_roots_own_geometry():
for width, height in ((1920, 1080), (1280, 720), (800, 600)):
xlib = _FullXlib()
x = an_x_connection(xlib)
x.geometry = lambda window, w=width, h=height: dict(width=w, height=h, x=0, y=0, border=0)
assert corner_of({"width": width, "height": height}) == (width - 1, height - 1)
assert x.warp_pointer_to_the_corner() == (width - 1, height - 1)
assert xlib.warps == [{"source": 0, "destination": 0x1, "from": (0, 0, 0, 0), "to": (width - 1, height - 1)}]
assert x.warped == {"to": [width - 1, height - 1], "root": [width, height], "read back": [width - 1, height - 1]}
def test_the_pointer_is_read_back_once_after_the_cover_and_kept_in_the_record():
xlib = _FullXlib()
x = an_x_connection(xlib)
x.record = VisibilityRecord(COVERED)
geometries = {COVERED: {"x": 100, "y": 50, "width": 1280, "height": 720, "border": 0}, 0x800001: {"x": 68, "y": 18, "width": 1344, "height": 784, "border": 0}}
x.geometry = lambda window: geometries[window]
outside = x.read_pointer_back(COVERED, 0x800001)
assert outside["at"] == [1919, 1079] and outside["outside covered"] is True and outside["outside cover"] is True
assert x.record.pointer is outside and pointer_or_focus_moved(x.record) == ""
xlib.pointer = (500, 300) # inside both rectangles
inside = x.read_pointer_back(COVERED, 0x800001)
assert inside["outside covered"] is False and inside["outside cover"] is False
assert pointer_or_focus_moved(x.record).startswith("arrangement: the covering moved the pointer or the focus")
def test_the_cover_is_an_override_redirect_window_mapped_and_raised_and_nothing_asks_for_the_focus():
xlib = _FullXlib()
x = an_x_connection(xlib)
@@ -339,30 +484,43 @@ def the_covering_on_x(record):
import test_window_occlusion_e2e as e2e
class FakeX:
warped = {"to": [1919, 1079]}
def drain(self):
return record
covering = e2e.CoveringOnX(FakeX())
covering.visibility = record
covering.first = COVERED
covering.pointer = record.pointer
return covering
def test_the_test_is_red_with_the_arrangement_message_when_the_covered_toplevel_lost_the_focus():
record = VisibilityRecord(COVERED)
record.add(COVERED, "FullyObscured", 0.31)
record.add_focus(COVERED, "FocusOut", "NotifyNormal", "NotifyNonlinear", 0.2501)
with pytest.raises(AssertionError) as red:
the_covering_on_x(record).assert_the_focus_did_not_move()
assert str(red.value).startswith("arrangement: the covering moved the focus")
assert "FocusOut at +0.250 s" in str(red.value) and "focus out arrived" in str(red.value)
def test_the_test_is_red_with_the_arrangement_message_when_the_covered_toplevel_was_crossed_or_lost_the_focus():
for add in (lambda r: r.add_crossing(COVERED, "LeaveNotify", "NotifyNormal", "NotifyNonlinear", 0.2501, 960, 540),
lambda r: r.add_focus(COVERED, "FocusOut", "NotifyNormal", "NotifyNonlinear", 0.2501)):
record = a_calm_record()
add(record)
with pytest.raises(AssertionError) as red:
the_covering_on_x(record).assert_the_pointer_and_the_focus_did_not_move()
assert str(red.value).startswith("arrangement: the covering moved the pointer or the focus")
assert "at +0.250 s" in str(red.value) and "focus out arrived" in str(red.value)
def test_the_test_goes_on_when_the_covered_toplevel_kept_the_focus():
record = VisibilityRecord(COVERED)
record.add(COVERED, "PartiallyObscured", 0.25)
record.add(COVERED, "FullyObscured", 0.31)
the_covering_on_x(record).assert_the_focus_did_not_move()
def test_the_test_is_red_when_the_pointer_read_back_is_inside_or_was_never_read():
record = a_calm_record()
record.pointer = a_pointer((100, 100), covered=False, cover=False)
with pytest.raises(AssertionError, match="^arrangement: the covering moved the pointer or the focus: the pointer read back at \\[100, 100\\]"):
the_covering_on_x(record).assert_the_pointer_and_the_focus_did_not_move()
record = a_calm_record()
covering = the_covering_on_x(record)
covering.pointer = None
with pytest.raises(AssertionError, match="^arrangement: the covering moved the pointer or the focus: the pointer was never read back"):
covering.assert_the_pointer_and_the_focus_did_not_move()
def test_the_test_goes_on_when_nothing_crossed_or_focused_the_covered_toplevel_and_the_pointer_is_outside():
the_covering_on_x(a_calm_record()).assert_the_pointer_and_the_focus_did_not_move()
# --- the engine's log of a test names a file per process ----------------------------------------------------------------------------------------------
+35 -23
View File
@@ -16,24 +16,31 @@ green that means nothing.
The covering window. Linux: the display is a private Xvfb started for this test (``_os_focus.a_display_of_its_own``, ``DISPLAY`` set with ``monkeypatch`` before
the session starts), so no other worker's headed window can sit above or inside the pair. No window manager runs there. The cover is NOT a second Firefox
session: it is a window of the test's own (``_x_visibility.XVisibility.cover_window``), an override-redirect ``InputOutput`` window, larger than the covered
toplevel by 32 px on every side (inside the screen where it fits), mapped and raised, and never given the focus. Why not a second session: its window took the
X focus when it mapped, the covered toplevel got ``FocusOut``, and GTK draws a window that loses the focus (``nsWindow::OnExposeEvent``,
``NotifyOcclusionState(VISIBLE)``). When X delivered ``PartiallyObscured``, ``FocusOut`` and ``FullyObscured`` in one batch, that draw ran 0.4 to 15 ms after the
toplevel by 32 px on every side (inside the screen where it fits, and never over the pointer), mapped and raised, and never given the focus.
Why the pointer: with no window manager the focus is ``PointerRoot`` and GDK treats the toplevel under the pointer as the focused one, and the pointer sits at the
screen centre, inside the covered window. Any window mapped over it makes the pointer leave the covered toplevel; GDK turns that crossing into a GTK focus-out
(``OnContainerFocusOutEvent``, then a ``leave notify``) and GTK draws a window that loses the focus (``nsWindow::OnExposeEvent``,
``NotifyOcclusionState(VISIBLE)``). When X delivered ``PartiallyObscured`` and ``FullyObscured`` close to that, the draw ran 0.4 to 15 ms after the
``FullyObscured`` and turned the window ``VISIBLE`` again before the posted visibility update ran: the page never recorded ``hidden`` (hunt run 45603211231, 58
reds of 1294; shard 1 it-0014: ``VisibilityNotify state 1`` at 54.355670, ``OnContainerFocusOutEvent`` at 54.355752, ``state 2`` at 54.356290,
``OnExposeEvent`` with ``mIsFullyOccluded 0`` at 54.359166). Mozilla's own behaviour, in retail too; the engine is not changed, the arrangement must not move the
focus. Windows: the second session stays (the tracker needs its window, below).
``OnExposeEvent`` with ``mIsFullyOccluded 0`` at 54.359166). Mozilla's own behaviour, in retail too; the engine is not changed. The first reading, that the focus
moved to a second session's window (an X ``FocusOut``), was refuted by run 45620136865: 458 reds of 463 with an X cover over the pointer, FocusOut 0 in 40
iterations of the old arrangement. So on Linux, before any session starts, the test warps the pointer through its own connection to the bottom-right pixel of the
root (``XVisibility.warp_pointer_to_the_corner``, computed from the root's geometry), and the cover leaves the pointer outside it. Windows: the second session
stays (the tracker needs its window, below).
The engine turns a window ``OCCLUDED`` only on a ``VisibilityNotify`` with ``FullyObscured`` of its toplevel, so the test asks X itself, through a connection of
its own (``_x_visibility.XVisibility``, libX11 as the focus test): it selects ``VisibilityChangeMask`` together with ``FocusChangeMask`` on the covered toplevel
before the cover is created; it creates and raises the cover and reads back ONCE, asserted, the stacking (``XQueryTree``: the cover above the covered window) and
the geometries (the covered window inside the cover); then it waits for X's ``VisibilityNotify FullyObscured`` of the covered toplevel, in both halves. A red
there says "arrangement" (X never told the window it is covered, so the page proves nothing). The precondition, asserted in both halves before the page is
judged: no ``FocusOut`` reached the covered toplevel between the start of the watch and the verdict ("arrangement: the covering moved the focus", with the X
record; red on the second-session arrangement, which always produced one, green runs included). With tracking enabled, X's ``FullyObscured`` arrived and a page
that never turns ``hidden`` is red with a message that starts with "ENGINE". Without tracking, the same ``FullyObscured`` arrived and the page must stay
``visible``: the product half's meaning is unchanged. The X record (the two window ids, the stacking and geometries read back, every visibility and focus event
with its time since the watch began, and whether ``FullyObscured`` arrived) is saved on every run, green or red, with the Windows record below.
its own (``_x_visibility.XVisibility``, libX11 as the focus test): it selects ``VisibilityChangeMask``, ``FocusChangeMask``, ``EnterWindowMask`` and
``LeaveWindowMask`` on the covered toplevel before the cover is created; it creates and raises the cover and reads back ONCE, asserted, the stacking
(``XQueryTree``: the cover above the covered window), the geometries (the covered window inside the cover) and the pointer (``XQueryPointer``: outside both
rectangles); then it waits for X's ``VisibilityNotify FullyObscured`` of the covered toplevel, in both halves. A red there says "arrangement" (X never told the
window it is covered, so the page proves nothing). The precondition, asserted in both halves before the page is judged: no ``EnterNotify``, ``LeaveNotify``,
``FocusIn`` or ``FocusOut`` reached the covered toplevel between the start of the watch and the verdict, and the pointer read back is outside both rectangles
("arrangement: the covering moved the pointer or the focus", with the X record). With tracking enabled, X's ``FullyObscured`` arrived and a page that never turns
``hidden`` is red with a message that starts with "ENGINE". Without tracking, the same ``FullyObscured`` arrived and the page must stay ``visible``: the product
half's meaning is unchanged. The X record (the two window ids, the stacking and geometries read back, the pointer, every visibility, crossing and focus event with
its time since the watch began, and whether ``FullyObscured`` arrived) is saved on every run, green or red, with the Windows record below.
Windows: opening the second window is not enough, and neither is putting it above the first one. ``WinWindowOcclusionTracker`` marks a root window
``OCCLUDED`` only when the windows ABOVE it in the Z-order already cover its rectangle (``widget/windows/WinWindowOcclusionTracker.cpp``,
``ProcessComputeNativeWindowOcclusionStatusCallback``: ``it->second = (mUnoccludedDesktopRegion == currUnoccludedDestkop) ? OCCLUDED : VISIBLE``), and it
@@ -88,7 +95,7 @@ from _evidence_on_failure import FailureEvidence
from _os_focus import a_display_of_its_own
from _waits import watch
from _window_sessions import DEADLINE_S, in_a_thread_of_its_own, launch, wait_for_condition
from _x_visibility import XVisibility, control_sees_hidden, focus_moved, product_stays_visible
from _x_visibility import XVisibility, control_sees_hidden, pointer_or_focus_moved, product_stays_visible
pytestmark = pytest.mark.e2e
@@ -450,6 +457,7 @@ class CoveringOnX:
self.first = self.cover = None
self.visibility = None
self.after_raise = None
self.pointer = None
#: The length of the page's list of changes at the last look made before X's ``FullyObscured`` showed up (1: the start).
self.not_before = 1
self.drawn = None
@@ -461,10 +469,11 @@ class CoveringOnX:
self.visibility = self.x.watch(self.first)
def cover_the_window_and_read_back(self):
"""Creates the cover (an override-redirect window of the test's own, no focus asked), raises it, reads the stacking and the geometries back once, and
asserts them."""
"""Creates the cover (an override-redirect window of the test's own, the pointer outside it, no focus asked), raises it, reads the stacking, the
geometries and the pointer back once, and asserts them."""
self.cover = self.x.cover_window(self.first)
self.after_raise = self.x.raise_and_read(self.first, self.cover)
self.pointer = self.x.read_pointer_back(self.first, self.cover)
assert self.after_raise["ok"], "arrangement: after XRaiseWindow the cover is not above the covered toplevel with the covered one inside it: %r" % (
self.evidence(),)
@@ -482,10 +491,12 @@ class CoveringOnX:
assert seen.ok, "arrangement: X never sent the covered toplevel VisibilityNotify FullyObscured (%s), so the page proves nothing: %r" % (
self.line(), self.evidence())
def assert_the_focus_did_not_move(self):
"""The precondition, before the page is judged: no ``FocusOut`` reached the covered toplevel since the watch began (``focus_moved``)."""
def assert_the_pointer_and_the_focus_did_not_move(self):
"""The precondition, before the page is judged: no crossing and no focus event reached the covered toplevel since the watch began, and the pointer read
back after the cover was up is outside both rectangles (``pointer_or_focus_moved``)."""
self.x.drain()
problem = focus_moved(self.visibility)
problem = pointer_or_focus_moved(self.visibility) or ("" if self.pointer is not None else "arrangement: the covering moved the pointer or the focus: "
"the pointer was never read back after the cover was up")
assert not problem, "%s; X: %r" % (problem, self.evidence())
def remove_the_cover(self):
@@ -522,7 +533,7 @@ class CoveringOnX:
def evidence(self):
"""The window ids, the read-back after the raise, and every visibility event of the covered toplevel with its time."""
line = self.line()
return {"line": line, "covered": None if self.first is None else "0x%x" % self.first, "cover": None if self.cover is None else "0x%x" % self.cover,
return {"line": line, "covered": None if self.first is None else "0x%x" % self.first, "cover": None if self.cover is None else "0x%x" % self.cover, "pointer warped": self.x.warped, "pointer read back": self.pointer,
"after the raise": self.after_raise, "forced draw": self.drawn, "not before": self.not_before, "visibility": self.visibility.as_dict() if self.visibility else None}
@@ -574,7 +585,7 @@ def second_window_over_the_first(firefox_binary, tracking, record, x):
if tracking:
seen = covering.wait_for_hidden(covered) if covering else watch_hidden_change(covered, not_before)
if on_x:
on_x.assert_the_focus_did_not_move()
on_x.assert_the_pointer_and_the_focus_did_not_move()
verdict_changes = covered.evaluate(CHANGES)
assert seen.ok and control_sees_hidden(verdict_changes, not_before), on_x.engine_message(seen, verdict_changes) if on_x else (
"a window that another one covers never turned hidden with occlusion tracking enabled; the changes the page recorded: %r; seen: %s; "
@@ -584,7 +595,7 @@ def second_window_over_the_first(firefox_binary, tracking, record, x):
else:
covered.evaluate(TWO_FRAMES)
if on_x:
on_x.assert_the_focus_did_not_move()
on_x.assert_the_pointer_and_the_focus_did_not_move()
windows = covering.evidence() if covering else on_x.evidence() if on_x else None
return {"state": covered.evaluate(STATE), "changes": covered.evaluate(CHANGES), "verdict_changes": verdict_changes, "not_before": not_before,
"windows": windows, "drawn": drawn}
@@ -618,6 +629,7 @@ def the_display(monkeypatch):
with a_display_of_its_own(monkeypatch) as display:
x = XVisibility(display)
try:
x.warp_pointer_to_the_corner() # before any session starts: no toplevel is under the pointer, none gets a crossing from it
yield x
finally:
x.close()