Chromium Code Reviews
|
| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/env python | |
| 2 # 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.
| |
| 3 # | |
| 4 # Use of this source code is governed by a BSD-style license | |
| 5 # that can be found in the LICENSE file in the root of the source | |
| 6 # tree. An additional intellectual property rights grant can be found | |
| 7 # in the file PATENTS. All contributing project authors may | |
| 8 # be found in the AUTHORS file in the root of the source tree. | |
| 9 | |
| 10 """Launches Firefox and browses to an URL.""" | |
| 11 | |
| 12 import os | |
| 13 import signal | |
| 14 import sys | |
| 15 | |
| 16 from optparse import OptionParser | |
| 17 | |
| 18 BASE_DIR = os.path.dirname(os.path.abspath(__file__)) | |
| 19 THIRD_PARTY_DIR = os.path.abspath(os.path.join(BASE_DIR, 'third_party')) | |
| 20 | |
| 21 sys.path.append(os.path.join(THIRD_PARTY_DIR, 'manifestdestiny')) | |
| 22 sys.path.append(os.path.join(THIRD_PARTY_DIR, 'mozinfo')) | |
| 23 sys.path.append(os.path.join(THIRD_PARTY_DIR, 'mozprocess')) | |
| 24 sys.path.append(os.path.join(THIRD_PARTY_DIR, 'mozprofile')) | |
| 25 sys.path.append(os.path.join(THIRD_PARTY_DIR, 'mozrunner')) | |
| 26 | |
| 27 from mozprofile import profile | |
| 28 from mozrunner import runner | |
| 29 | |
| 30 WEBRTC_PREFERENCES = { | |
| 31 # Enables calls to mozGetUserMedia(). | |
| 32 '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.
| |
| 33 # Automatically gives permission to access the camera/microphone and | |
| 34 # bypasses the permission/selection dialog. | |
| 35 'media.navigator.permission.disabled': True, | |
| 36 # Enables use of mozRTCPeerConnection(). | |
| 37 'media.peerconnection.enabled': True, | |
| 38 } | |
| 39 | |
| 40 def main(): | |
| 41 usage = 'usage: %prog --binary <firefox_executable> --webpage <url>' | |
| 42 parser = OptionParser(usage) | |
| 43 parser.add_option('-b', '--binary', | |
| 44 help=('Firefox executable to run.')) | |
| 45 parser.add_option('-w', '--webpage', | |
| 46 help=('Web page to browse to.')) | |
| 47 options, _args = parser.parse_args() | |
| 48 if not options.binary: | |
| 49 parser.error('You must specify the Firefox browser executable.') | |
| 50 if not options.webpage: | |
| 51 parser.error('You must specify the web page to browse to.') | |
| 52 | |
| 53 firefox_profile = profile.FirefoxProfile(preferences=WEBRTC_PREFERENCES) | |
| 54 firefox_runner = runner.FirefoxRunner(profile=firefox_profile, | |
| 55 binary=options.binary, | |
| 56 cmdargs=[options.webpage]) | |
| 57 def KillFirefox(signum, frame): | |
| 58 firefox_runner.stop() | |
| 59 signal.signal(signal.SIGTERM, KillFirefox) | |
| 60 | |
| 61 firefox_runner.start() | |
| 62 | |
| 63 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
| |
| 64 return 0 | |
| 65 | |
| 66 if __name__ == '__main__': | |
| 67 sys.exit(main()) | |
| OLD | NEW |