aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJukka Jylänki <jujjyl@gmail.com>2013-11-18 13:59:03 +0200
committerJukka Jylänki <jujjyl@gmail.com>2013-11-18 21:00:54 +0200
commit0d952fa095e6b048f031e6f5fd52a9d805911442 (patch)
tree01df92ff2eb291d80cbc772debb338f028005081
parentee1537cfadab1312522120cb726a5d38ee0ed66c (diff)
Add support for specifying a custom web browser to run in the browser test harness via EMSCRIPTEN_BROWSER environment variable.
-rw-r--r--tests/test_browser.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/tests/test_browser.py b/tests/test_browser.py
index f2bcaa93..128820b3 100644
--- a/tests/test_browser.py
+++ b/tests/test_browser.py
@@ -1,12 +1,15 @@
-import BaseHTTPServer, multiprocessing, os, shutil, subprocess, unittest, zlib
+import BaseHTTPServer, multiprocessing, os, shutil, subprocess, unittest, zlib, webbrowser, time, shlex
from runner import BrowserCore, path_from_root
from tools.shared import *
-''' Enable this code to run in another browser than webbrowser detects as default
-def run_in_other_browser(url):
- execute(['yourbrowser', url])
-webbrowser.open_new = run_in_other_browser
-'''
+# User can specify an environment variable EMSCRIPTEN_BROWSER to force the browser test suite to
+# run using another browser command line than the default system browser.
+emscripten_browser = os.environ.get('EMSCRIPTEN_BROWSER')
+if emscripten_browser:
+ cmd = shlex.split(emscripten_browser)
+ def run_in_other_browser(url):
+ Popen(cmd + [url])
+ webbrowser.open_new = run_in_other_browser
def test_chunked_synchronous_xhr_server(support_byte_ranges, chunkSize, data, checksum):
class ChunkedServerHandler(BaseHTTPServer.BaseHTTPRequestHandler):
@@ -108,7 +111,6 @@ class browser(BrowserCore):
cwd=self.get_dir()).communicate()
assert os.path.exists(html_file)
assert os.path.exists(html_file + '.map')
- import webbrowser, time
webbrowser.open_new('file://' + html_file)
time.sleep(1)
print '''