summaryrefslogtreecommitdiff
path: root/tests/test_browser.py
diff options
context:
space:
mode:
authorFraser Adams <fraser.adams@blueyonder.co.uk>2014-01-02 16:40:09 +0000
committerFraser Adams <fraser.adams@blueyonder.co.uk>2014-01-02 16:40:09 +0000
commit385a660a1868dc1777b251dfcf83371ccd388b02 (patch)
treec254e924656076501441b607364e2a67232e419d /tests/test_browser.py
parent32e1d73d605a7c4c3dc162b7c0d626b3dcce27ce (diff)
Added crypto quality random number generators for Node.js and browser environment if available
Diffstat (limited to 'tests/test_browser.py')
-rw-r--r--tests/test_browser.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_browser.py b/tests/test_browser.py
index 920c6f8c..3d344c14 100644
--- a/tests/test_browser.py
+++ b/tests/test_browser.py
@@ -1717,3 +1717,23 @@ keydown(100);keyup(100); // trigger the end
assert 'argv[3]: 3' in stdout
assert 'hello, world!' in stdout
assert 'hello, error stream!' in stderr
+
+ def test_uuid(self):
+ # Run with ./runner.py browser.test_uuid
+ # 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()
+
+ out = run_js(path_from_root('tests', 'uuid', 'test.js'), full_output=True)
+ print out
+
+ # Tidy up files that might have been created by this test.
+ try_delete(path_from_root('tests', 'uuid', 'test.js'))
+ try_delete(path_from_root('tests', 'uuid', 'test.js.map'))
+
+ # Now run test in browser
+ self.btest(path_from_root('tests', 'uuid', 'test.c'), '1')
+
+