Skip to content

Commit 298bb62

Browse files
jujkripken
authored andcommitted
Add new test test_fetch_sync_xhr_in_proxy_to_worker to check that sync Fetches work with --proxy-to-worker. (emscripten-core#6306)
1 parent deabf16 commit 298bb62

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/test_browser.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3722,11 +3722,16 @@ def test_fetch_stream_file(self):
37223722
f.close()
37233723
self.btest('fetch/stream_file.cpp', expected='1', args=['--std=c++11', '-s', 'FETCH_DEBUG=1', '-s', 'FETCH=1', '-s', 'TOTAL_MEMORY=536870912'])
37243724

3725-
# Tests emscripten_fetch() usage in synchronous mode.
3725+
# Tests emscripten_fetch() usage in synchronous mode when used from the main thread proxied to a Worker with -s PROXY_TO_PTHREAD=1 option.
37263726
def test_fetch_sync_xhr(self):
37273727
shutil.copyfile(path_from_root('tests', 'gears.png'), os.path.join(self.get_dir(), 'gears.png'))
37283728
self.btest('fetch/sync_xhr.cpp', expected='1', args=['--std=c++11', '-s', 'FETCH_DEBUG=1', '-s', 'FETCH=1', '-s', 'USE_PTHREADS=1', '-s', 'PROXY_TO_PTHREAD=1'])
37293729

3730+
# Tests that the Fetch API works for synchronous XHRs when used with --proxy-to-worker.
3731+
def test_fetch_sync_xhr_in_proxy_to_worker(self):
3732+
shutil.copyfile(path_from_root('tests', 'gears.png'), os.path.join(self.get_dir(), 'gears.png'))
3733+
self.btest('fetch/sync_xhr.cpp', expected='1', args=['--std=c++11', '-s', 'FETCH_DEBUG=1', '-s', 'FETCH=1', '--proxy-to-worker'])
3734+
37303735
def test_fetch_idb_store(self):
37313736
self.btest('fetch/idb_store.cpp', expected='0', args=['-s', 'USE_PTHREADS=1', '-s', 'FETCH_DEBUG=1', '-s', 'FETCH=1', '-s', 'PROXY_TO_PTHREAD=1'])
37323737

0 commit comments

Comments
 (0)