Skip to content

Commit 9f57bf8

Browse files
WPT importer should create serviceworker template for templated test that have worker as global
https://bugs.webkit.org/show_bug.cgi?id=230943 Reviewed by Jonathan Bedard. Tests with a worker global should run in all worker global scope (dedicated worker, shared worker and service worker). Let's add service worker by default for now. * Scripts/webkitpy/w3c/test_importer.py: * Scripts/webkitpy/w3c/test_importer_unittest.py: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@283230 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 2e87117 commit 9f57bf8

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

Tools/ChangeLog

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
2021-09-29 Youenn Fablet <[email protected]>
2+
3+
WPT importer should create serviceworker template for templated test that have worker as global
4+
https://bugs.webkit.org/show_bug.cgi?id=230943
5+
6+
Reviewed by Jonathan Bedard.
7+
8+
Tests with a worker global should run in all worker global scope (dedicated worker, shared worker and service worker).
9+
Let's add service worker by default for now.
10+
11+
* Scripts/webkitpy/w3c/test_importer.py:
12+
* Scripts/webkitpy/w3c/test_importer_unittest.py:
13+
114
2021-09-28 BJ Burg <[email protected]>
215

316
[Cocoa] Add SPI to select a tab created by _WKInspectorExtension

Tools/Scripts/webkitpy/w3c/test_importer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,9 @@ def readEnvironmentsForTemplateTest(self, filepath):
421421
items = line.split('META: global=', 1)[1].split(',')
422422
suffixes = [self.globalToSuffix.get(item.strip(), '') for item in items]
423423
environments = list(filter(None, set(suffixes)))
424-
return set(environments) if len(environments) else ['html', 'worker.html']
424+
if 'worker.html' in environments:
425+
environments.append('serviceworker.html')
426+
return set(environments) if len(environments) else ['html', 'worker.html', 'serviceworker.html']
425427

426428
def write_html_files_for_templated_js_tests(self, orig_filepath, new_filepath):
427429
if (orig_filepath.endswith('.window.js')):

Tools/Scripts/webkitpy/w3c/test_importer_unittest.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,10 +367,12 @@ def test_webkit_test_runner_options(self):
367367
self.assertTrue(fs.exists('/mock-checkout/LayoutTests/w3c/web-platform-tests/t/test.html'))
368368
self.assertTrue(fs.exists('/mock-checkout/LayoutTests/w3c/web-platform-tests/t/test.any.html'))
369369
self.assertTrue(fs.exists('/mock-checkout/LayoutTests/w3c/web-platform-tests/t/test.any.worker.html'))
370+
self.assertTrue(fs.exists('/mock-checkout/LayoutTests/w3c/web-platform-tests/t/test.any.serviceworker.html'))
370371
self.assertTrue('<!-- webkit-test-runner [ dummy ] -->' in fs.read_text_file('/mock-checkout/LayoutTests/w3c/web-platform-tests/css/test.html').split('\n')[0])
371372
self.assertTrue('<!-- webkit-test-runner [ dummy ] -->' in fs.read_text_file('/mock-checkout/LayoutTests/w3c/web-platform-tests/t/test.html').split('\n')[0])
372373
self.assertTrue('<!-- webkit-test-runner [ dummy ] -->' in fs.read_text_file('/mock-checkout/LayoutTests/w3c/web-platform-tests/t/test.any.html').split('\n')[0])
373374
self.assertFalse('<!-- webkit-test-runner [ dummy ] -->' in fs.read_text_file('/mock-checkout/LayoutTests/w3c/web-platform-tests/t/test.any.worker.html').split('\n')[0])
375+
self.assertFalse('<!-- webkit-test-runner [ dummy ] -->' in fs.read_text_file('/mock-checkout/LayoutTests/w3c/web-platform-tests/t/test.any.serviceworker.html').split('\n')[0])
374376

375377
def test_webkit_test_runner_import_reftests_with_absolute_paths_download(self):
376378
FAKE_FILES = {
@@ -440,6 +442,7 @@ def test_template_test(self):
440442
FAKE_FILES = {
441443
'/mock-checkout/WebKitBuild/w3c-tests/web-platform-tests/t/test.any.js': '// META: global=window,dedicatedworker,sharedworker,serviceworker\n',
442444
'/mock-checkout/WebKitBuild/w3c-tests/web-platform-tests/t/test2.any.js': '\n// META: global=dedicatedworker,serviceworker\n',
445+
'/mock-checkout/WebKitBuild/w3c-tests/web-platform-tests/t/test3.any.js': '\n// META: global=worker\n',
443446
}
444447
FAKE_FILES.update(FAKE_REPOSITORY)
445448

@@ -452,3 +455,6 @@ def test_template_test(self):
452455
self.assertFalse(fs.exists('/mock-checkout/LayoutTests/w3c/web-platform-tests/t/test2.any.html'))
453456
self.assertTrue(fs.exists('/mock-checkout/LayoutTests/w3c/web-platform-tests/t/test2.any.worker.html'))
454457
self.assertTrue(fs.exists('/mock-checkout/LayoutTests/w3c/web-platform-tests/t/test2.any.serviceworker.html'))
458+
459+
self.assertTrue(fs.exists('/mock-checkout/LayoutTests/w3c/web-platform-tests/t/test3.any.worker.html'))
460+
self.assertTrue(fs.exists('/mock-checkout/LayoutTests/w3c/web-platform-tests/t/test3.any.serviceworker.html'))

0 commit comments

Comments
 (0)