lib/capybara/driver/webkit/remote_browser.rb in capybara-webkit-remote-0.0.1 vs lib/capybara/driver/webkit/remote_browser.rb in capybara-webkit-remote-0.0.2

- old
+ new

@@ -1,11 +1,29 @@ class Capybara::Driver::Webkit class RemoteBrowser < Capybara::Driver::Webkit::Browser attr :remote_host, :remote_port + + def self.open_sockets; @@_sockets ||= [ ]; end + + at_exit do + socks = Capybara::Driver::Webkit::RemoteBrowser.open_sockets() + while(socks.length > 0) + s = socks.shift() + s.close() rescue nil + end + end + def initialize(hostname, port, options = { }) @remote_host = hostname @remote_port = port super(options) + Capybara::Driver::Webkit::RemoteBrowser.open_sockets << @socket + end + + def disconnect! + @socket.close rescue nil + Capybara::Driver::Webkit::RemoteBrowser.open_sockets.delete(@socket) + true end def start_server ; end def attempt_connect \ No newline at end of file