| 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.
|
| +#
|
| +# 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-0.5.6'))
|
| +sys.path.append(os.path.join(THIRD_PARTY_DIR, 'mozinfo-0.4'))
|
| +sys.path.append(os.path.join(THIRD_PARTY_DIR, 'mozprocess-0.8'))
|
| +sys.path.append(os.path.join(THIRD_PARTY_DIR, 'mozprofile-0.4'))
|
| +sys.path.append(os.path.join(THIRD_PARTY_DIR, 'mozrunner-5.14'))
|
| +
|
| +from mozprofile import profile
|
| +from mozrunner import runner
|
| +
|
| +WEBRTC_PREFERENCES = {
|
| + # Enables calls to mozGetUserMedia().
|
| + 'media.navigator.enabled': True,
|
| + # 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)
|
| + return 0
|
| +
|
| +if __name__ == '__main__':
|
| + sys.exit(main())
|
|
|
| Property changes on: run_firefox_webrtc.py
|
| ___________________________________________________________________
|
| Added: svn:executable
|
| + *
|
| Added: svn:eol-style
|
| + LF
|
|
|
|
|