Chromium Code Reviews| Index: run_firefox_webrtc.py |
| =================================================================== |
| --- run_firefox_webrtc.py (revision 0) |
| +++ run_firefox_webrtc.py (revision 0) |
| @@ -0,0 +1,67 @@ |
| +#!/usr/bin/env python |
| +# Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
|
kjellander_chromium
2013/12/16 12:59:04
Please change to Chromium's license.
phoglund_chromium
2013/12/16 14:38:46
Done.
|
| +# |
| +# Use of this source code is governed by a BSD-style license |
| +# that can be found in the LICENSE file in the root of the source |
| +# tree. An additional intellectual property rights grant can be found |
| +# in the file PATENTS. All contributing project authors may |
| +# be found in the AUTHORS file in the root of the source tree. |
| + |
| +"""Launches Firefox and browses to an URL.""" |
| + |
| +import os |
| +import signal |
| +import sys |
| + |
| +from optparse import OptionParser |
| + |
| +BASE_DIR = os.path.dirname(os.path.abspath(__file__)) |
| +THIRD_PARTY_DIR = os.path.abspath(os.path.join(BASE_DIR, 'third_party')) |
| + |
| +sys.path.append(os.path.join(THIRD_PARTY_DIR, 'manifestdestiny')) |
| +sys.path.append(os.path.join(THIRD_PARTY_DIR, 'mozinfo')) |
| +sys.path.append(os.path.join(THIRD_PARTY_DIR, 'mozprocess')) |
| +sys.path.append(os.path.join(THIRD_PARTY_DIR, 'mozprofile')) |
| +sys.path.append(os.path.join(THIRD_PARTY_DIR, 'mozrunner')) |
| + |
| +from mozprofile import profile |
| +from mozrunner import runner |
| + |
| +WEBRTC_PREFERENCES = { |
| + # Enables calls to mozGetUserMedia(). |
| + 'media.navigator.enabled': True, |
|
kjellander_chromium
2013/12/16 12:59:04
You might want to try without enabling 'media.navi
phoglund_chromium
2013/12/16 14:38:46
Done.
|
| + # Automatically gives permission to access the camera/microphone and |
| + # bypasses the permission/selection dialog. |
| + 'media.navigator.permission.disabled': True, |
| + # Enables use of mozRTCPeerConnection(). |
| + 'media.peerconnection.enabled': True, |
| +} |
| + |
| +def main(): |
| + usage = 'usage: %prog --binary <firefox_executable> --webpage <url>' |
| + parser = OptionParser(usage) |
| + parser.add_option('-b', '--binary', |
| + help=('Firefox executable to run.')) |
| + parser.add_option('-w', '--webpage', |
| + help=('Web page to browse to.')) |
| + options, _args = parser.parse_args() |
| + if not options.binary: |
| + parser.error('You must specify the Firefox browser executable.') |
| + if not options.webpage: |
| + parser.error('You must specify the web page to browse to.') |
| + |
| + firefox_profile = profile.FirefoxProfile(preferences=WEBRTC_PREFERENCES) |
| + firefox_runner = runner.FirefoxRunner(profile=firefox_profile, |
| + binary=options.binary, |
| + cmdargs=[options.webpage]) |
| + def KillFirefox(signum, frame): |
| + firefox_runner.stop() |
| + signal.signal(signal.SIGTERM, KillFirefox) |
| + |
| + firefox_runner.start() |
| + |
| + firefox_runner.process_handler.wait(timeout=60) |
|
kjellander_chromium
2013/12/16 12:59:04
How do we motivate 60 seconds here? I assume we mi
phoglund_chromium
2013/12/16 14:38:46
I'm going to have to redesign this thing for Windo
|
| + return 0 |
| + |
| +if __name__ == '__main__': |
| + sys.exit(main()) |
| Property changes on: run_firefox_webrtc.py |
| ___________________________________________________________________ |
| Added: svn:eol-style |
| + LF |
| Added: svn:executable |
| + * |