diff options
author | Fraser Adams <fraser.adams@blueyonder.co.uk> | 2014-01-06 14:49:50 +0000 |
---|---|---|
committer | Fraser Adams <fraser.adams@blueyonder.co.uk> | 2014-01-06 14:49:50 +0000 |
commit | 3bdbd008f9f95e6a1d8da42e61a751289db17b60 (patch) | |
tree | 2dab07ecaf099c22750bc9b954e17b9944411723 /tests | |
parent | 385a660a1868dc1777b251dfcf83371ccd388b02 (diff) |
changed != to !== in a couple of places. Added fix to prevent closure minifying crypto randomBytes etc. this fix makes use of closure externs so I've added a closure-externs.js to hold the definitions and modified tools/shared.py closure_compiler method to point to closure-externs.js. I've added externs to fix minification of the ws library used in library_sockfs.js too
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_browser.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/test_browser.py b/tests/test_browser.py index 3d344c14..d46797ac 100644 --- a/tests/test_browser.py +++ b/tests/test_browser.py @@ -1723,8 +1723,15 @@ keydown(100);keyup(100); // trigger the end # We run this test in Node/SPIDERMONKEY and browser environments because we try to make use of # high quality crypto random number generators such as crypto.getRandomValues or randomBytes (if available). - # First run tests in Node and/or SPIDERMONKEY using run_js - Popen([PYTHON, EMCC, path_from_root('tests', 'uuid', 'test.c'), '-o', path_from_root('tests', 'uuid', 'test.js')], stdout=PIPE, stderr=PIPE).communicate() + # First run tests in Node and/or SPIDERMONKEY using run_js. Use closure compiler so we can check that + # require('crypto').randomBytes and window.crypto.getRandomValues doesn't get minified out. + Popen([PYTHON, EMCC, '-O2', '--closure', '1', path_from_root('tests', 'uuid', 'test.c'), '-o', path_from_root('tests', 'uuid', 'test.js')], stdout=PIPE, stderr=PIPE).communicate() + + test_js_closure = open(path_from_root('tests', 'uuid', 'test.js')).read() + + # Check that test.js compiled with --closure 1 contains ").randomBytes" and "window.crypto.getRandomValues" + assert ").randomBytes" in test_js_closure + assert "window.crypto.getRandomValues" in test_js_closure out = run_js(path_from_root('tests', 'uuid', 'test.js'), full_output=True) print out |