Make d-bus available to orca if someone decides they want to implement it.
This commit is contained in:
1 parent
c3e981b4c2
commit
0f59809e9a
11 files changed
+374
-39
No files matched your search
@@ -12,13 +12,17 @@ parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--build-dir', default='build')
|
||||
parser.add_argument('--32-bit', dest='is32', action='store_true')
|
||||
parser.add_argument('--session', action='store_true')
|
||||
parser.add_argument('--reader', choices=('cthulhu', 'orca'))
|
||||
args = parser.parse_args()
|
||||
build = Path(args.build_dir).resolve()
|
||||
if not args.session:
|
||||
sys.exit(subprocess.call(['dbus-run-session', '--', sys.executable, __file__,
|
||||
'--session', '--build-dir', str(build), *(['--32-bit'] if args.is32 else [])]))
|
||||
iface = 'org.stormux.Cthulhu1.Service'
|
||||
path = '/org/stormux/Cthulhu1/Service'
|
||||
'--session', '--build-dir', str(build),
|
||||
*(['--reader', args.reader] if args.reader else []),
|
||||
*(['--32-bit'] if args.is32 else [])]))
|
||||
iface = 'org.gnome.Orca1.Service' if args.reader == 'orca' else 'org.stormux.Cthulhu1.Service'
|
||||
path = '/' + iface.replace('.', '/')
|
||||
readerArguments = ['--reader', args.reader] if args.reader else []
|
||||
capture_iface = 'org.stormux.Cthulhu1.WineReview'
|
||||
capture_path = '/org/stormux/Cthulhu1/WineReview'
|
||||
|
||||
@@ -85,7 +89,7 @@ with tempfile.TemporaryDirectory(prefix='wine-review-wire-') as temporary:
|
||||
return result[0]
|
||||
try:
|
||||
subprocess.run(['wineboot','-u'],env=env,check=True,timeout=45)
|
||||
helper = subprocess.Popen([str(build/'cthulhu-wine-access.exe'),'--no-controller'],env=env)
|
||||
helper = subprocess.Popen([str(build/'cthulhu-wine-access.exe'),'--no-controller',*readerArguments],env=env)
|
||||
app = subprocess.Popen(['wine',str(fixture)],env=env)
|
||||
pump_until(lambda: any(f[4]=='Wine review fixture' for f in focuses.values()),8)
|
||||
reply, elapsed = capture()
|
||||
@@ -110,11 +114,37 @@ with tempfile.TemporaryDirectory(prefix='wine-review-wire-') as temporary:
|
||||
print('PASS: test_capture_wire_contract')
|
||||
other = Gio.DBusConnection.new_for_address_sync(os.environ['DBUS_SESSION_BUS_ADDRESS'],
|
||||
Gio.DBusConnectionFlags.AUTHENTICATION_CLIENT|Gio.DBusConnectionFlags.MESSAGE_BUS_CONNECTION,None,None)
|
||||
# Owning the unselected reader name must not authorize capture.
|
||||
otherIface = 'org.stormux.Cthulhu1.Service' if args.reader == 'orca' else 'org.gnome.Orca1.Service'
|
||||
other.call_sync('org.freedesktop.DBus','/org/freedesktop/DBus','org.freedesktop.DBus','RequestName',
|
||||
GLib.Variant('(su)',(otherIface,0)),None,Gio.DBusCallFlags.NONE,1000,None)
|
||||
sender,focus = next((s,f) for s,f in focuses.items() if f[4]=='Wine review fixture')
|
||||
wrong = request(other,sender,focus); pump_until(lambda:bool(wrong),2)
|
||||
assert isinstance(wrong[0],GLib.Error) and 'AccessDenied' in str(wrong[0])
|
||||
other.close_sync(None)
|
||||
print('PASS: test_wrong_caller')
|
||||
# Move the selected name to a new connection. The helper must register
|
||||
# again, authorize the new owner, and immediately reject the old owner.
|
||||
other.register_object(path, Gio.DBusNodeInfo.new_for_xml(interface_xml()).interfaces[0],record,None,None)
|
||||
providers.clear(); focuses.clear()
|
||||
connection.call_sync('org.freedesktop.DBus','/org/freedesktop/DBus','org.freedesktop.DBus','ReleaseName',
|
||||
GLib.Variant('(s)',(iface,)),None,Gio.DBusCallFlags.NONE,1000,None)
|
||||
other.call_sync('org.freedesktop.DBus','/org/freedesktop/DBus','org.freedesktop.DBus','RequestName',
|
||||
GLib.Variant('(su)',(iface,0)),None,Gio.DBusCallFlags.NONE,1000,None)
|
||||
pump_until(lambda:sender in providers and sender in focuses)
|
||||
focus=focuses[sender]
|
||||
wrong=request(connection,sender,focus); pump_until(lambda:bool(wrong),2)
|
||||
assert isinstance(wrong[0],GLib.Error) and 'AccessDenied' in str(wrong[0])
|
||||
accepted=request(other,sender,focus); pump_until(lambda:bool(accepted),2)
|
||||
assert not isinstance(accepted[0],GLib.Error), accepted[0]
|
||||
assert accepted[0][0].unpack()[0]['status']=='ok'
|
||||
providers.clear(); focuses.clear()
|
||||
other.call_sync('org.freedesktop.DBus','/org/freedesktop/DBus','org.freedesktop.DBus','ReleaseName',
|
||||
GLib.Variant('(s)',(iface,)),None,Gio.DBusCallFlags.NONE,1000,None)
|
||||
connection.call_sync('org.freedesktop.DBus','/org/freedesktop/DBus','org.freedesktop.DBus','RequestName',
|
||||
GLib.Variant('(su)',(iface,0)),None,Gio.DBusCallFlags.NONE,1000,None)
|
||||
pump_until(lambda:sender in providers and sender in focuses)
|
||||
other.close_sync(None)
|
||||
print('PASS: test_reader_owner_replacement')
|
||||
configure(33)
|
||||
reply,_ = capture(); data=reply.unpack()[0]
|
||||
assert data['status']=='ok', data['status']
|
||||
@@ -152,7 +182,7 @@ with tempfile.TemporaryDirectory(prefix='wine-review-wire-') as temporary:
|
||||
helper.terminate(); helper.wait(timeout=3)
|
||||
subprocess.run(['wine',str(fixture),'--check-remote'],env=env,check=True,timeout=5)
|
||||
print('PASS: test_native_buffer_lifetime_after_helper_stop')
|
||||
helper=subprocess.Popen([str(build/'cthulhu-wine-access.exe'),'--no-controller'],env=env)
|
||||
helper=subprocess.Popen([str(build/'cthulhu-wine-access.exe'),'--no-controller',*readerArguments],env=env)
|
||||
pump_until(lambda:any(s != sender and f[4]=='Wine review fixture' for s,f in focuses.items()),5)
|
||||
focuses.pop(sender,None)
|
||||
configure(7)
|
||||
@@ -180,7 +210,7 @@ with tempfile.TemporaryDirectory(prefix='wine-review-wire-') as temporary:
|
||||
connection.unregister_object(registration)
|
||||
registration = connection.register_object(path,Gio.DBusNodeInfo.new_for_xml(interface_xml(False)).interfaces[0],record,None,None)
|
||||
events.clear()
|
||||
helper = subprocess.Popen([str(build/'cthulhu-wine-access.exe'),'--no-controller'],env=env)
|
||||
helper = subprocess.Popen([str(build/'cthulhu-wine-access.exe'),'--no-controller',*readerArguments],env=env)
|
||||
end=time.monotonic()+1
|
||||
while time.monotonic()<end:
|
||||
while GLib.MainContext.default().iteration(False): pass
|
||||
|
||||
Reference in new issue
Block a user