Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: tests/test_packagerWebExt.py

Issue 29825555: Issue 6291 - add ManifoldJS packaging for Edge (Closed) Base URL: https://hg.adblockplus.org/buildtools/file/9a56d76cd951
Patch Set: Created July 12, 2018, 9:24 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« packagerEdge.py ('K') | « tests/test_packagerEdge.py ('k') | tox.ini » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/test_packagerWebExt.py
diff --git a/tests/test_packagerWebExt.py b/tests/test_packagerWebExt.py
index f2fd855fd16a57abb39883f289e5cce14885bfd0..994697d71fa958577a3217fa914bfcb5583c5e29 100644
--- a/tests/test_packagerWebExt.py
+++ b/tests/test_packagerWebExt.py
@@ -293,7 +293,7 @@ def assert_manifest_content(manifest, expected_path):
assert len(diff) == 0, '\n'.join(diff)
-def assert_webpack_bundle(package, prefix, is_devbuild, excluded=False):
+def assert_webpack_bundle(package, prefix, is_devbuild, platform):
libfoo = package.read(os.path.join(prefix, 'lib/foo.js'))
libfoomap = package.read(os.path.join(prefix, 'lib/foo.js.map'))
@@ -308,15 +308,15 @@ def assert_webpack_bundle(package, prefix, is_devbuild, excluded=False):
assert 'var this_is_c;' in libfoo
assert 'webpack:///./ext/c.js' in libfoomap
- if prefix: # webpack 'resolve.alias' exposure
+ if platform is 'edge': # webpack 'resolve.alias' exposure
assert 'var this_is_edge;' in libfoo
assert 'webpack:///./lib/edge.js' in libfoomap
else:
assert 'var this_is_mogo;' in libfoo
assert 'webpack:///./lib/mogo.js' in libfoomap
- assert ('var foo;' in libfoo) != excluded
- assert ('webpack:///./lib/b.js' in libfoomap) != excluded
+ assert ('var foo;' in libfoo) != (platform is 'gecko')
+ assert ('webpack:///./lib/b.js' in libfoomap) != (platform is 'gecko')
def assert_devenv_scripts(package, prefix, devenv):
@@ -345,16 +345,17 @@ def assert_devenv_scripts(package, prefix, devenv):
assert set(manifest['background']['scripts']) == set(scripts)
-def assert_base_files(package, platform, prefix):
+def assert_base_files(package, platform, prefix, devenv):
filenames = set(package.namelist())
if platform == 'edge':
- assert 'AppxManifest.xml' in filenames
- assert 'AppxBlockMap.xml' in filenames
- assert '[Content_Types].xml' in filenames
+ assert ('AppxManifest.xml' in filenames) is not devenv
+ assert ('AppxBlockMap.xml' in filenames) is not devenv
+ assert ('[Content_Types].xml' in filenames) is not devenv
- assert package.read('Assets/logo_44.png') == '44'
- assert package.read('Extension/icons/abp-44.png') == '44'
+ if not devenv:
+ assert package.read('Assets/logo_44.png') == '44'
+ assert package.read('Extension/icons/abp-44.png') == '44'
assert os.path.join(prefix, 'bar.json') in filenames
assert os.path.join(prefix, 'manifest.json') in filenames
@@ -429,10 +430,15 @@ def test_build_webext(platform, command, keyfile, tmpdir, srcdir, capsys):
manifests = {
'gecko': [('', 'manifest', 'json')],
'chrome': [('', 'manifest', 'json')],
- 'edge': [('', 'AppxManifest', 'xml'),
- ('Extension', 'manifest', 'json')],
}
+ if not devenv:
+ manifests['edge'] = [
+ ('', 'AppxManifest', 'xml'),
+ ('Extension', 'manifest', 'json')]
+ else:
+ manifests['edge'] = [('', 'manifest', 'json')]
+
filenames = {
'gecko': 'adblockplusfirefox-1.2.3{}.xpi',
'chrome': 'adblockpluschrome-1.2.3{{}}.{}'.format(
@@ -441,7 +447,7 @@ def test_build_webext(platform, command, keyfile, tmpdir, srcdir, capsys):
'edge': 'adblockplusedge-1.2.3{}.appx',
}
- if platform == 'edge':
+ if platform == 'edge' and not devenv:
prefix = 'Extension'
else:
prefix = ''
@@ -474,10 +480,10 @@ def test_build_webext(platform, command, keyfile, tmpdir, srcdir, capsys):
assert_chrome_signature(out_file_path, keyfile)
with content_class(out_file_path) as package:
- assert_base_files(package, platform, prefix)
+ assert_base_files(package, platform, prefix, devenv)
assert_all_locales_present(package, prefix)
assert_webpack_bundle(package, prefix, not release and not devenv,
- platform == 'gecko')
+ platform)
if platform == 'chrome':
assert_locale_upfix(package)
« packagerEdge.py ('K') | « tests/test_packagerEdge.py ('k') | tox.ini » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld