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

Delta Between Two Patch Sets: tests/test_packagerWebExt.py

Issue 29825555: Issue 6291 - add ManifoldJS packaging for Edge (Closed) Base URL: https://hg.adblockplus.org/buildtools/file/9a56d76cd951
Left Patch Set: Created July 12, 2018, 9:24 a.m.
Right Patch Set: Final patch set Created Aug. 9, 2018, 7:08 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « tests/test_packagerEdge.py ('k') | tox.ini » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 # This Source Code Form is subject to the terms of the Mozilla Public 1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this 2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. 3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
4 4
5 import difflib 5 import difflib
6 import json 6 import json
7 import os 7 import os
8 import re 8 import re
9 import shutil 9 import shutil
10 import zipfile 10 import zipfile
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 @pytest.fixture 180 @pytest.fixture
181 def locale_modules(tmpdir): 181 def locale_modules(tmpdir):
182 mod_dir = tmpdir.mkdir('_modules') 182 mod_dir = tmpdir.mkdir('_modules')
183 lang_dir = mod_dir.mkdir('en_US') 183 lang_dir = mod_dir.mkdir('en_US')
184 lang_dir.join('module.json').write(json.dumps(LOCALES_MODULE)) 184 lang_dir.join('module.json').write(json.dumps(LOCALES_MODULE))
185 185
186 186
187 @pytest.fixture 187 @pytest.fixture
188 def icons(srcdir): 188 def icons(srcdir):
189 icons_dir = srcdir.mkdir('icons') 189 icons_dir = srcdir.mkdir('icons')
190 for filename in ['abp-16.png', 'abp-19.png', 'abp-53.png']: 190 for name in ['abp-{}.png'.format(x) for x in [16, 19, 44, 50, 53, 150]]:
191 shutil.copy( 191 shutil.copy(
192 os.path.join(os.path.dirname(__file__), filename), 192 os.path.join(os.path.dirname(__file__), name),
193 os.path.join(str(icons_dir), filename), 193 os.path.join(str(icons_dir), name),
194 ) 194 )
195 195
196 196
197 @pytest.fixture 197 @pytest.fixture
198 def all_lang_locales(tmpdir): 198 def all_lang_locales(tmpdir):
199 return locale_files(ALL_LANGUAGES, '_locales', tmpdir) 199 return locale_files(ALL_LANGUAGES, '_locales', tmpdir)
200 200
201 201
202 @pytest.fixture 202 @pytest.fixture
203 def chrome_metadata(tmpdir): 203 def chrome_metadata(tmpdir):
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 347
348 def assert_base_files(package, platform, prefix, devenv): 348 def assert_base_files(package, platform, prefix, devenv):
349 filenames = set(package.namelist()) 349 filenames = set(package.namelist())
350 350
351 if platform == 'edge': 351 if platform == 'edge':
352 assert ('AppxManifest.xml' in filenames) is not devenv 352 assert ('AppxManifest.xml' in filenames) is not devenv
353 assert ('AppxBlockMap.xml' in filenames) is not devenv 353 assert ('AppxBlockMap.xml' in filenames) is not devenv
354 assert ('[Content_Types].xml' in filenames) is not devenv 354 assert ('[Content_Types].xml' in filenames) is not devenv
355 355
356 if not devenv: 356 if not devenv:
357 assert package.read('Assets/logo_44.png') == '44'
358 assert package.read('Extension/icons/abp-44.png') == '44' 357 assert package.read('Extension/icons/abp-44.png') == '44'
359 358
360 assert os.path.join(prefix, 'bar.json') in filenames 359 assert os.path.join(prefix, 'bar.json') in filenames
361 assert os.path.join(prefix, 'manifest.json') in filenames 360 assert os.path.join(prefix, 'manifest.json') in filenames
362 assert os.path.join(prefix, 'lib/foo.js') in filenames 361 assert os.path.join(prefix, 'lib/foo.js') in filenames
363 assert os.path.join(prefix, 'foo/logo_50.png') in filenames 362 assert os.path.join(prefix, 'foo/logo_50.png') in filenames
364 assert os.path.join(prefix, 'icons/logo_150.png') in filenames 363 assert os.path.join(prefix, 'icons/logo_150.png') in filenames
365 364
366 365
367 def assert_chrome_signature(filename, keyfile): 366 def assert_chrome_signature(filename, keyfile):
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 key = None 427 key = None
429 428
430 manifests = { 429 manifests = {
431 'gecko': [('', 'manifest', 'json')], 430 'gecko': [('', 'manifest', 'json')],
432 'chrome': [('', 'manifest', 'json')], 431 'chrome': [('', 'manifest', 'json')],
433 } 432 }
434 433
435 if not devenv: 434 if not devenv:
436 manifests['edge'] = [ 435 manifests['edge'] = [
437 ('', 'AppxManifest', 'xml'), 436 ('', 'AppxManifest', 'xml'),
438 ('Extension', 'manifest', 'json')] 437 ('Extension', 'manifest', 'json'),
438 ]
439 else: 439 else:
440 manifests['edge'] = [('', 'manifest', 'json')] 440 manifests['edge'] = [('', 'manifest', 'json')]
441 441
442 filenames = { 442 filenames = {
443 'gecko': 'adblockplusfirefox-1.2.3{}.xpi', 443 'gecko': 'adblockplusfirefox-1.2.3{}.xpi',
444 'chrome': 'adblockpluschrome-1.2.3{{}}.{}'.format( 444 'chrome': 'adblockpluschrome-1.2.3{{}}.{}'.format(
445 {True: 'crx', False: 'zip'}[release], 445 {True: 'crx', False: 'zip'}[release],
446 ), 446 ),
447 'edge': 'adblockplusedge-1.2.3{}.appx', 447 'edge': 'adblockplusedge-1.2.3{}.appx',
448 } 448 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 expected = os.path.join( 495 expected = os.path.join(
496 os.path.dirname(__file__), 496 os.path.dirname(__file__),
497 'expecteddata', 497 'expecteddata',
498 filename.format(name, ext), 498 filename.format(name, ext),
499 ) 499 )
500 500
501 assert_manifest_content( 501 assert_manifest_content(
502 package.read(os.path.join(folder, '{}.{}'.format(name, ext))), 502 package.read(os.path.join(folder, '{}.{}'.format(name, ext))),
503 expected, 503 expected,
504 ) 504 )
LEFTRIGHT

Powered by Google App Engine
This is Rietveld