diff options
author | Florian Bruhin <me@the-compiler.org> | 2024-07-12 15:28:38 +0200 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2024-07-12 15:28:38 +0200 |
commit | bcf792a0dca48035623439ef951a5e7d8b0981e0 (patch) | |
tree | 7378c1acae0c64f01602700b5f4243e32844e5cc | |
parent | d9b93496568e669802594b01c54da5ad2aac990b (diff) | |
download | qutebrowser-bcf792a0dca48035623439ef951a5e7d8b0981e0.tar.gz qutebrowser-bcf792a0dca48035623439ef951a5e7d8b0981e0.zip |
Add more hardcoded IDs and tests
-rw-r--r-- | qutebrowser/misc/pakjoy.py | 8 | ||||
-rw-r--r-- | tests/unit/misc/test_pakjoy.py | 25 |
2 files changed, 19 insertions, 14 deletions
diff --git a/qutebrowser/misc/pakjoy.py b/qutebrowser/misc/pakjoy.py index f914a372a..7ae0526e7 100644 --- a/qutebrowser/misc/pakjoy.py +++ b/qutebrowser/misc/pakjoy.py @@ -38,8 +38,12 @@ from qutebrowser.utils import qtutils, standarddir, version, utils, log HANGOUTS_MARKER = b"// Extension ID: nkeimhogjdpnpccoofpliimaahmaaome" HANGOUTS_IDS = [ - 36197, # QtWebEngine 6.5, as found by toofar - 34897, # QtWebEngine 6.4 + 41262, # QtWebEngine 6.7 + 36197, # QtWebEngine 6.6 + 34897, # QtWebEngine 6.5 + 32707, # QtWebEngine 6.4 + 27537, # QtWebEngine 6.3 + 23607, # QtWebEngine 6.2 ] PAK_VERSION = 5 RESOURCES_ENV_VAR = "QTWEBENGINE_RESOURCES_PATH" diff --git a/tests/unit/misc/test_pakjoy.py b/tests/unit/misc/test_pakjoy.py index 59185a380..9dae21ccb 100644 --- a/tests/unit/misc/test_pakjoy.py +++ b/tests/unit/misc/test_pakjoy.py @@ -25,17 +25,6 @@ pytestmark = pytest.mark.usefixtures("cache_tmpdir") versions = version.qtwebengine_versions(avoid_init=True) -# Used to skip happy path tests with the real resources file. -# -# Since we don't know how reliably the Google Meet hangouts extensions is -# reliably in the resource files, and this quirk is only targeting 6.6 -# anyway. -skip_if_unsupported = pytest.mark.skipif( - versions.webengine != utils.VersionNumber(6, 6), - reason="Code under test only runs on 6.6", -) - - @pytest.fixture(autouse=True) def prepare_env(qapp, monkeypatch): monkeypatch.setattr(pakjoy.objects, "qapp", qapp) @@ -206,7 +195,6 @@ def read_patched_manifest(): class TestWithRealResourcesFile: """Tests that use the real pak file form the Qt installation.""" - @skip_if_unsupported def test_happy_path(self): # Go through the full patching processes with the real resources file from # the current installation. Make sure our replacement string is in it @@ -266,6 +254,19 @@ class TestWithRealResourcesFile: "Not applying quirks. Expected location: " ) + def test_hardcoded_ids(self): + """Make sure we hardcoded the currently valid ID. + + This avoids users having to iterate through the whole resource file on + every start. It will probably break on every QtWebEngine upgrade and can + be fixed by adding the respective ID to HANGOUTS_IDS. + """ + resources_dir = pakjoy._find_webengine_resources() + file_to_patch = resources_dir / pakjoy.PAK_FILENAME + with open(file_to_patch, "rb") as f: + parser = pakjoy.PakParser(f) + assert parser.manifest_entry.resource_id in pakjoy.HANGOUTS_IDS + def json_manifest_factory(extension_id=pakjoy.HANGOUTS_MARKER, url=pakjoy.TARGET_URL): assert isinstance(extension_id, bytes) |