Skip to content

Commit

Permalink
Cleanup test_modularize_init_error. NFC (#23105)
Browse files Browse the repository at this point in the history
- Use browser_reporting.js directly.
- Delete redundant unhandledrejection handler. browser_reporting handles
this already.
  • Loading branch information
sbc100 authored Dec 9, 2024
1 parent 1604c82 commit 03c29b2
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions test/test_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3342,9 +3342,10 @@ def test_modularize(self, opts):
self.run_browser('a.html', '/report_result?0')

def test_modularize_network_error(self):
browser_reporting_js_path = test_file('browser_reporting.js')
self.compile_btest('browser_test_hello_world.c', ['-sMODULARIZE', '-sEXPORT_NAME="createModule"', '--extern-pre-js', browser_reporting_js_path], reporting=Reporting.NONE)
self.compile_btest('browser_test_hello_world.c', ['-sMODULARIZE', '-sEXPORT_NAME=createModule'], reporting=Reporting.NONE)
shutil.copy(test_file('browser_reporting.js'), '.')
create_file('a.html', '''
<script src="browser_reporting.js"></script>
<script src="a.out.js"></script>
<script>
createModule()
Expand All @@ -3361,16 +3362,12 @@ def test_modularize_network_error(self):
self.run_browser('a.html', '/report_result?Aborted(both async and sync fetching of the wasm failed)')

def test_modularize_init_error(self):
browser_reporting_js_path = test_file('browser_reporting.js')
self.compile_btest('browser/test_modularize_init_error.cpp', ['-sMODULARIZE', '-sEXPORT_NAME="createModule"', '--extern-pre-js', browser_reporting_js_path], reporting=Reporting.NONE)
self.compile_btest('browser/test_modularize_init_error.cpp', ['-sMODULARIZE', '-sEXPORT_NAME=createModule'], reporting=Reporting.NONE)
shutil.copy(test_file('browser_reporting.js'), '.')
create_file('a.html', '''
<script src="browser_reporting.js"></script>
<script src="a.out.js"></script>
<script>
if (typeof window === 'object') {
window.addEventListener('unhandledrejection', function(event) {
reportResultToServer("Unhandled promise rejection: " + event.reason.message);
});
}
createModule()
.then(() => {
reportResultToServer("Module creation succeeded when it should have failed");
Expand Down

0 comments on commit 03c29b2

Please sign in to comment.