summaryrefslogtreecommitdiffstats
path: root/testing/raptor/test/test_playback.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/raptor/test/test_playback.py
parentInitial commit. (diff)
downloadfirefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz
firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/raptor/test/test_playback.py')
-rw-r--r--testing/raptor/test/test_playback.py65
1 files changed, 65 insertions, 0 deletions
diff --git a/testing/raptor/test/test_playback.py b/testing/raptor/test/test_playback.py
new file mode 100644
index 0000000000..c01065ea83
--- /dev/null
+++ b/testing/raptor/test/test_playback.py
@@ -0,0 +1,65 @@
+import os
+import time
+
+import mozinfo
+import mozunit
+from mozlog.structuredlog import StructuredLogger, set_default_logger
+
+# need this so raptor imports work both from /raptor and via mach
+here = os.path.abspath(os.path.dirname(__file__))
+
+set_default_logger(StructuredLogger("test_playback"))
+
+from mozproxy import get_playback
+from mozproxy.backends.mitm.desktop import MitmproxyDesktop
+
+config = {}
+
+run_local = True
+if os.environ.get("TOOLTOOLCACHE") is None:
+ run_local = False
+
+
+def test_get_playback(get_binary):
+ config["platform"] = mozinfo.os
+ if "win" in config["platform"]:
+ # this test is not yet supported on windows
+ assert True
+ return
+ config["obj_path"] = os.path.dirname(get_binary("firefox"))
+ config["playback_tool"] = "mitmproxy"
+ config["playback_version"] = "7.0.4"
+ config["playback_files"] = [
+ os.path.join(
+ os.path.dirname(os.path.abspath(os.path.dirname(__file__))),
+ "raptor",
+ "tooltool-manifests",
+ "playback",
+ "mitm7-linux-firefox-amazon.manifest",
+ )
+ ]
+ config["binary"] = get_binary("firefox")
+ config["run_local"] = run_local
+ config["app"] = "firefox"
+ config["host"] = "127.0.0.1"
+
+ playback = get_playback(config)
+ assert isinstance(playback, MitmproxyDesktop)
+ playback.start()
+ time.sleep(1)
+ playback.stop()
+
+
+def test_get_unsupported_playback():
+ config["playback_tool"] = "unsupported"
+ playback = get_playback(config)
+ assert playback is None
+
+
+def test_get_playback_missing_tool_name():
+ playback = get_playback(config)
+ assert playback is None
+
+
+if __name__ == "__main__":
+ mozunit.main()