mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test_win32ole_event.rb: skip 80041008
* test/win32ole/test_win32ole_event.rb (exec_notification_query_async): skip error with OLE error code:80041008, which seems to occur when logging in as a non admistrator user. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9507c92d37
commit
e7d578bf58
1 changed files with 11 additions and 3 deletions
|
@ -91,7 +91,7 @@ if defined?(WIN32OLE_EVENT)
|
|||
end
|
||||
|
||||
def test_s_new_loop
|
||||
@wmi.ExecNotificationQueryAsync(@sws, @sql)
|
||||
exec_notification_query_async
|
||||
ev = WIN32OLE_EVENT.new(@sws)
|
||||
ev.on_event {|*args| default_handler(*args)}
|
||||
message_loop
|
||||
|
@ -104,7 +104,7 @@ if defined?(WIN32OLE_EVENT)
|
|||
end
|
||||
|
||||
def test_on_event
|
||||
@wmi.ExecNotificationQueryAsync(@sws, @sql)
|
||||
exec_notification_query_async
|
||||
ev = WIN32OLE_EVENT.new(@sws, 'ISWbemSinkEvents')
|
||||
ev.on_event {|*args| default_handler(*args)}
|
||||
message_loop
|
||||
|
@ -112,7 +112,7 @@ if defined?(WIN32OLE_EVENT)
|
|||
end
|
||||
|
||||
def test_on_event_symbol
|
||||
@wmi.ExecNotificationQueryAsync(@sws, @sql)
|
||||
exec_notification_query_async
|
||||
ev = WIN32OLE_EVENT.new(@sws)
|
||||
ev.on_event(:OnObjectReady) {|*args|
|
||||
handler1
|
||||
|
@ -121,6 +121,14 @@ if defined?(WIN32OLE_EVENT)
|
|||
assert_equal("handler1", @event1)
|
||||
end
|
||||
|
||||
private
|
||||
def exec_notification_query_async
|
||||
@wmi.ExecNotificationQueryAsync(@sws, @sql)
|
||||
rescue => e
|
||||
# No administrator privilege?
|
||||
skip if /OLE error code:80041008 in SWbemServicesEx/ =~ e.message
|
||||
raise
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue