示例#1
0
    if os.environ.get("OBJDIR"):
        g_xpcshell_path = os.path.join(os.environ["OBJDIR"], "dist", "bin",
                                       g_xpcshell_path)

    path_to_extension_root = os.path.join(g_mydir, EXT_SUBDIR)

    cmd = args[0]

    if cmd == "try":
        import systemtests
        import jsbridge
        print(
            "Starting Firefox with a new profile and "
            "the extension installed...")
        moz = jsbridge.start_from_settings(systemtests.settings)
        print "Firefox started, quit it or press CTRL-C to exit."
        try:
            moz.wait()
        except KeyboardInterrupt:
            moz.stop()
        print "Farewell."
        sys.exit(0)
    if cmd == "test":
        this_script = sys.argv[0]
        this_dir = os.path.dirname(this_script)
        print "Running unit tests."
        run_python_script([this_script, "unittest"])
        print "Running system tests."
        run_python_script([os.path.join(this_dir, "systemtests.py")])
        print "All tests successful."
示例#2
0
settings = jsbridge.get_settings()
settings['JSBRIDGE_START_FIREFOX'] = True
settings['MOZILLA_PLUGINS'].append(extension_path)

if __name__ == '__main__':
    result = {'is_successful' : False}
    is_done = threading.Event()

    def listener(event_name, obj):
        if event_name == 'ubiquity:success':
            result['is_successful'] = obj
            is_done.set()

    jsbridge.events.add_global_listener(listener)

    moz = jsbridge.start_from_settings(settings)

    uri = 'resource://ubiquity/tests/systemtests.js';
    tests = jsbridge.JSObject(
        jsbridge.network.bridge,
        "Components.utils.import('%s')" % uri
        )
    tests.start()

    is_done.wait(MAX_TIMEOUT)
    moz.stop()

    if result['is_successful']:
        print "Success!"
    else:
        print "Failure."
示例#3
0
settings = jsbridge.get_settings()
settings['JSBRIDGE_START_FIREFOX'] = True
settings['MOZILLA_PLUGINS'].append(extension_path)

if __name__ == '__main__':
    result = {'is_successful': False}
    is_done = threading.Event()

    def listener(event_name, obj):
        if event_name == 'ubiquity:success':
            result['is_successful'] = obj
            is_done.set()

    jsbridge.events.add_global_listener(listener)

    moz = jsbridge.start_from_settings(settings)

    uri = 'resource://ubiquity/tests/systemtests.js'
    tests = jsbridge.JSObject(jsbridge.network.bridge,
                              "Components.utils.import('%s')" % uri)
    tests.start()

    is_done.wait(MAX_TIMEOUT)
    moz.stop()

    if result['is_successful']:
        print "Success!"
    else:
        print "Failure."
        if not is_done.isSet():
            print "Timeout occurred."
示例#4
0
        sys.exit(1)

    if os.environ.get("OBJDIR"):
        g_xpcshell_path = os.path.join(os.environ["OBJDIR"],
                                       "dist", "bin", g_xpcshell_path)

    path_to_extension_root = os.path.join(g_mydir, EXT_SUBDIR)

    cmd = args[0]

    if cmd == "try":
        import systemtests
        import jsbridge
        print ("Starting Firefox with a new profile and "
               "the extension installed...")
        moz = jsbridge.start_from_settings(systemtests.settings)
        print "Firefox started, quit it or press CTRL-C to exit."
        try:
            moz.wait()
        except KeyboardInterrupt:
            moz.stop()
        print "Farewell."
        sys.exit(0)
    if cmd == "test":
        this_script = sys.argv[0]
        this_dir = os.path.dirname(this_script)
        print "Running unit tests."
        run_python_script([this_script, "unittest"])
        print "Running system tests."
        run_python_script([os.path.join(this_dir, "systemtests.py")])
        print "All tests successful."