Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: test/mm-connect

Issue 6731056: Update to test scripts to work with both ModemManager and Cromo (Closed) Base URL: ssh://gitrw.chromium.org:9222/flimflam.git@master
Patch Set: Fix review comments Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/mm-activate ('k') | test/mm-disable » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2
3 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
2 # 7 #
3 # Call the Simple.Connect API. 8 # Call the Simple.Connect API.
4 # 9 #
5 10
6 import gobject 11 import gobject
7 import dbus 12 import dbus
8 import dbus.mainloop.glib 13 import dbus.mainloop.glib
9 import mm 14 import mm
10 import sys 15 import sys
11 from optparse import OptionParser 16 from optparse import OptionParser
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 props['apn'] = options.apn 81 props['apn'] = options.apn
77 if options.username: 82 if options.username:
78 props['username'] = options.username 83 props['username'] = options.username
79 if options.password: 84 if options.password:
80 props['password'] = options.password 85 props['password'] = options.password
81 if options.number: 86 if options.number:
82 props['number'] = options.number 87 props['number'] = options.number
83 88
84 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) 89 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
85 90
86 manager = mm.ModemManager() 91 manager, path = mm.PickOneModem(modem_pattern)
92 modem = manager.CdmaModem(path)
87 93
88 target = mm.PickOneModem(manager, modem_pattern) 94 print "Connecting", path
89
90 print "Connecting", target
91 95
92 if options.wait: 96 if options.wait:
93 bus = dbus.SystemBus() 97 bus = dbus.SystemBus()
94 bus.add_signal_receiver(state_changed, 98 bus.add_signal_receiver(state_changed,
95 » » » bus_name="org.chromium.ModemManager", 99 » » » bus_name=manager.provider,
96 signal_name="StateChanged", 100 signal_name="StateChanged",
97 path_keyword="path") 101 path_keyword="path")
98 102
99 modem = manager.SimpleModem(target) 103 modem = manager.SimpleModem(path)
100 try: 104 try:
101 modem.Connect(props) 105 modem.Connect(props)
102 options.wait = False 106 options.wait = False
103 except dbus.exceptions.DBusException, e: 107 except dbus.exceptions.DBusException, e:
104 if e._dbus_error_name != "org.chromium.ModemManager.Error.OperationIniti ated": 108 if e._dbus_error_name != "org.chromium.ModemManager.Error.OperationIniti ated":
105 raise e 109 raise e
106 110
107 if options.wait: 111 if options.wait:
108 mainloop = gobject.MainLoop() 112 mainloop = gobject.MainLoop()
109 mainloop.run() 113 mainloop.run()
OLDNEW
« no previous file with comments | « test/mm-activate ('k') | test/mm-disable » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698