diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-12-07 10:37:25 -0500 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-12-07 10:37:25 -0500 |
commit | 1a007b1631509b9d72499a8f4402294017ee04dc (patch) | |
tree | 92f8b0341497c7bd4e53aa82c690346536a244c3 /tests/test_browser.py | |
parent | df11c6f1fd1636a355b83a1c48b3a890596e6a32 (diff) | |
parent | eb083723747a90cb6ab9853fec8d6e8ef54748bc (diff) |
Merge branch 'incoming'
Diffstat (limited to 'tests/test_browser.py')
-rw-r--r-- | tests/test_browser.py | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/tests/test_browser.py b/tests/test_browser.py index 128820b3..d0618af8 100644 --- a/tests/test_browser.py +++ b/tests/test_browser.py @@ -183,7 +183,7 @@ If manually bisecting: //text = text.replace(/>/g, ">"); //text = text.replace('\\n', '<br>', 'g'); element.value += text + "\\n"; - element.scrollTop = 99999; // focus on bottom + element.scrollTop = element.scrollHeight; // focus on bottom }; })(), printErr: function(text) { @@ -274,7 +274,7 @@ If manually bisecting: //text = text.replace(/>/g, ">"); //text = text.replace('\\n', '<br>', 'g'); element.value += text + "\\n"; - element.scrollTop = 99999; // focus on bottom + element.scrollTop = element.scrollHeight; // focus on bottom }; })(), printErr: function(text) { @@ -898,7 +898,7 @@ keydown(100);keyup(100); // trigger the end return function(text) { text = Array.prototype.slice.call(arguments).join(' '); element.value += text + "\\n"; - element.scrollTop = 99999; // focus on bottom + element.scrollTop = element.scrollHeight; // focus on bottom }; })() }; @@ -1218,10 +1218,7 @@ keydown(100);keyup(100); // trigger the end def test_worker(self): # Test running in a web worker - output = Popen([PYTHON, EMCC, path_from_root('tests', 'hello_world_worker.cpp'), '-o', 'worker.js'], stdout=PIPE, stderr=PIPE).communicate() - assert len(output[0]) == 0, output[0] - assert os.path.exists('worker.js'), output - self.assertContained('you should not see this text when in a worker!', run_js('worker.js')) # code should run standalone + open('file.dat', 'w').write('data for worker') html_file = open('main.html', 'w') html_file.write(''' <html> @@ -1240,7 +1237,15 @@ keydown(100);keyup(100); // trigger the end </html> ''') html_file.close() - self.run_browser('main.html', 'You should see that the worker was called, and said "hello from worker!"', '/report_result?hello%20from%20worker!') + + # no file data + for file_data in [0, 1]: + print 'file data', file_data + output = Popen([PYTHON, EMCC, path_from_root('tests', 'hello_world_worker.cpp'), '-o', 'worker.js'] + (['--preload-file', 'file.dat'] if file_data else []) , stdout=PIPE, stderr=PIPE).communicate() + assert len(output[0]) == 0, output[0] + assert os.path.exists('worker.js'), output + if not file_data: self.assertContained('you should not see this text when in a worker!', run_js('worker.js')) # code should run standalone + self.run_browser('main.html', '', '/report_result?hello%20from%20worker,%20and%20|' + ('data%20for%20w' if file_data else '') + '|') def test_chunked_synchronous_xhr(self): main = 'chunked_sync_xhr.html' |