tests: negative controls with the engine off or another declared screen, second sync client in a thread of its own
This commit is contained in:
1 parent
8c926d9551
commit
0a0a2f4efd
3 files changed
+12
-9
No files matched your search
@@ -8,7 +8,7 @@ asks the audio device. The core declares both for every persona, because the hos
|
||||
A page reads both on a new `AudioContext()` with no permission. The values declared here (37 ms and 6 channels) are ones no runner
|
||||
produces: a runner with no audio device answers 0 or 2.
|
||||
|
||||
Negative control, in the same test: with both prefs -1 (the default of the engine, "ask the host") the same page reads the host's values,
|
||||
Negative control, in the same test: with the engine off (`hw_seed` 0, stock Firefox: an active engine refuses a declaration pref cleared) the same page reads the host's values,
|
||||
and they differ from the declared ones. The control reads what the host answers without asserting what it is: a runner with no audio
|
||||
device may refuse the context, and that refusal is also not the declared value.
|
||||
|
||||
@@ -22,6 +22,7 @@ pytestmark = pytest.mark.e2e
|
||||
|
||||
OUTPUT_LATENCY = "zoom.stealth.audio.output_latency_ms"
|
||||
MAX_CHANNELS = "zoom.stealth.audio.max_channel_count"
|
||||
HW_SEED = "zoom.stealth.fpp.hw_seed"
|
||||
|
||||
READ = """() => {
|
||||
try {
|
||||
@@ -47,7 +48,7 @@ def test_the_audio_context_answers_the_declared_latency_and_channel_count(firefo
|
||||
declared = read(firefox_binary, {OUTPUT_LATENCY: 37, MAX_CHANNELS: 6})
|
||||
assert declared == {"outputLatency": 0.037, "maxChannelCount": 6}, declared
|
||||
|
||||
host = read(firefox_binary, {OUTPUT_LATENCY: -1, MAX_CHANNELS: -1})
|
||||
host = read(firefox_binary, {HW_SEED: 0})
|
||||
assert host != declared, (host, declared)
|
||||
assert host.get("outputLatency") != 0.037, host
|
||||
assert host.get("maxChannelCount") != 6, host
|
||||
@@ -7,7 +7,7 @@ host's rate is the machine's sound card (44100, 48000, 96000...).
|
||||
|
||||
A page reads it on a new `AudioContext()` with no permission. The rate declared here, 22050, is one no sound card reports.
|
||||
|
||||
Negative control, in the same test: with the pref -1 (the default of the engine, "ask the host") the same page reads the host's rate,
|
||||
Negative control, in the same test: with the engine off (`hw_seed` 0, stock Firefox: an active engine refuses a declaration pref cleared) the same page reads the host's rate,
|
||||
which is not 22050. The control does not assert what the host answers: a runner with no audio device answers its fallback, and a
|
||||
refused context is also not the declared rate.
|
||||
|
||||
@@ -20,6 +20,7 @@ import pytest
|
||||
pytestmark = pytest.mark.e2e
|
||||
|
||||
SAMPLE_RATE = "zoom.stealth.audio.sample_rate"
|
||||
HW_SEED = "zoom.stealth.fpp.hw_seed"
|
||||
|
||||
READ = """() => {
|
||||
try {
|
||||
@@ -44,6 +45,6 @@ def test_the_audio_context_answers_the_declared_sample_rate(firefox_binary):
|
||||
declared = read(firefox_binary, {SAMPLE_RATE: 22050})
|
||||
assert declared == {"sampleRate": 22050}, declared
|
||||
|
||||
host = read(firefox_binary, {SAMPLE_RATE: -1})
|
||||
host = read(firefox_binary, {HW_SEED: 0})
|
||||
assert host != declared, (host, declared)
|
||||
assert host.get("sampleRate") != 22050, host
|
||||
@@ -15,7 +15,8 @@ A page reads all three with no permission (the storage estimate needs a secure c
|
||||
The values declared here (5 touch points, 7 cores, 123 MiB) are ones no runner has.
|
||||
|
||||
Negative controls, in each test: touch points with no pin (the persona's own value, 0) and with the engine off (`hw_seed` 0, the host's
|
||||
answer, which is not 5); cores and quota with the pref -1 (the default of the engine, "ask the host"), which are not 7 and not 123 MiB.
|
||||
answer, which is not 5); cores and quota with the engine off (`hw_seed` 0, stock Firefox: the engine refuses a launch that is active with a declaration pref cleared),
|
||||
which are not 7 and not 123 MiB.
|
||||
The prefs are set through `extra_prefs` (the overlay the core applies last), the touch points through the pin the wrapper exposes.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
@@ -89,8 +90,8 @@ def test_hardware_concurrency_is_the_declared_count_in_the_page_the_worker_and_t
|
||||
declared = read(firefox_binary, url, CORE_COUNTS, extra_prefs={CORES: 7})
|
||||
assert declared == {"main": 7, "worker": 7, "iframe": 7}, declared
|
||||
|
||||
# Control: pref -1, the three read the host's count (the same one, and not 7).
|
||||
host = read(firefox_binary, url, CORE_COUNTS, extra_prefs={CORES: -1})
|
||||
# Control: the engine off (hw_seed 0), the three read the host's count (the same one, and not 7).
|
||||
host = read(firefox_binary, url, CORE_COUNTS, extra_prefs={HW_SEED: 0})
|
||||
assert host["main"] != 7, host
|
||||
assert host["worker"] == host["main"], host
|
||||
assert host["iframe"] == host["main"], host
|
||||
@@ -101,7 +102,7 @@ def test_the_storage_quota_is_the_declared_megabytes(firefox_binary, fixture_ser
|
||||
declared = read(firefox_binary, url, QUOTA, extra_prefs={QUOTA_MB: 123})
|
||||
assert declared == {"secure": True, "quota": 123 * 1024 * 1024}, declared
|
||||
|
||||
# Control: pref -1, the quota Mozilla computed from the host's disk.
|
||||
host = read(firefox_binary, url, QUOTA, extra_prefs={QUOTA_MB: -1})
|
||||
# Control: the engine off (hw_seed 0), the quota Mozilla computed from the host's disk.
|
||||
host = read(firefox_binary, url, QUOTA, extra_prefs={HW_SEED: 0})
|
||||
assert host.get("secure") is True, host
|
||||
assert host.get("quota") != 123 * 1024 * 1024, host
|
||||
Reference in new issue
Block a user