forked from mirrors/gecko-dev
Differential Revision: https://phabricator.services.mozilla.com/D41540 --HG-- rename : testing/mozbase/mozproxy/mozproxy/backends/mitm.py => testing/mozbase/mozproxy/mozproxy/backends/mitm/mitm.py rename : testing/mozbase/mozproxy/mozproxy/backends/mitmproxy-rel-bin-4.0.4-linux64.manifest => testing/mozbase/mozproxy/mozproxy/backends/mitm/mitmproxy-rel-bin-4.0.4-linux64.manifest rename : testing/mozbase/mozproxy/mozproxy/backends/mitmproxy-rel-bin-4.0.4-osx.manifest => testing/mozbase/mozproxy/mozproxy/backends/mitm/mitmproxy-rel-bin-4.0.4-osx.manifest rename : testing/mozbase/mozproxy/mozproxy/backends/mitmproxy-rel-bin-4.0.4-win.manifest => testing/mozbase/mozproxy/mozproxy/backends/mitm/mitmproxy-rel-bin-4.0.4-win.manifest rename : testing/mozbase/mozproxy/mozproxy/backends/mitmproxy-rel-bin-linux64.manifest => testing/mozbase/mozproxy/mozproxy/backends/mitm/mitmproxy-rel-bin-linux64.manifest rename : testing/mozbase/mozproxy/mozproxy/backends/mitmproxy-rel-bin-osx.manifest => testing/mozbase/mozproxy/mozproxy/backends/mitm/mitmproxy-rel-bin-osx.manifest rename : testing/mozbase/mozproxy/mozproxy/backends/mitmproxy-rel-bin-win.manifest => testing/mozbase/mozproxy/mozproxy/backends/mitm/mitmproxy-rel-bin-win.manifest rename : testing/mozbase/mozproxy/mozproxy/backends/mitmproxy_requirements.txt => testing/mozbase/mozproxy/mozproxy/backends/mitm/mitmproxy_requirements.txt rename : testing/raptor/raptor/playback/alternate-server-replay-2.0.2.py => testing/mozbase/mozproxy/mozproxy/backends/mitm/scripts/alternate-server-replay-2.0.2.py rename : testing/raptor/raptor/playback/alternate-server-replay-4.0.4.py => testing/mozbase/mozproxy/mozproxy/backends/mitm/scripts/alternate-server-replay-4.0.4.py rename : testing/raptor/raptor/playback/scripts/catapult/LICENSE => testing/mozbase/mozproxy/mozproxy/backends/mitm/scripts/catapult/LICENSE rename : testing/raptor/raptor/playback/scripts/catapult/deterministic.js => testing/mozbase/mozproxy/mozproxy/backends/mitm/scripts/catapult/deterministic.js rename : testing/raptor/raptor/playback/scripts/inject-deterministic.py => testing/mozbase/mozproxy/mozproxy/backends/mitm/scripts/inject-deterministic.py extra : moz-landing-system : lando
64 lines
1.9 KiB
Python
64 lines
1.9 KiB
Python
from __future__ import absolute_import, unicode_literals
|
|
|
|
import os
|
|
import time
|
|
|
|
import mozinfo
|
|
import mozunit
|
|
|
|
from mozlog.structuredlog import set_default_logger, StructuredLogger
|
|
|
|
set_default_logger(StructuredLogger('test_playback'))
|
|
|
|
from mozproxy import get_playback
|
|
from mozproxy.backends.mitm 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'] = '4.0.4'
|
|
config['playback_upstream_cert'] = 'false'
|
|
config['playback_binary_manifest'] = 'mitmproxy-rel-bin-4.0.4-{platform}.manifest'
|
|
config['playback_pageset_manifest'] = os.path.join(
|
|
os.path.dirname(os.path.abspath(os.path.dirname(__file__))), "raptor", "playback",
|
|
'mitm4-linux-firefox-amazon.manifest')
|
|
config['playback_recordings'] = 'amazon.mp'
|
|
config['binary'] = get_binary('firefox')
|
|
config['run_local'] = run_local
|
|
config['app'] = 'firefox'
|
|
config['host'] = 'https://www.amazon.com/s?k=laptop&ref=nb_sb_noss_1'
|
|
|
|
playback = get_playback(config)
|
|
playback.config['playback_files'] = [os.path.join(playback.mozproxy_dir,
|
|
config['playback_recordings'])]
|
|
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()
|