Sha256: bd90d32f27a7fd40b784715de0dc8e0912f7900cd28b3dcd03f72944e0dc2010

Contents?: true

Size: 906 Bytes

Versions: 2

Compression:

Stored size: 906 Bytes

Contents

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
      @socket = @socket_class.open(remote_host, remote_port)
      rescue Errno::ECONNREFUSED
    end
  end 
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
capybara-webkit-remote-0.0.3 lib/capybara/driver/webkit/remote_browser.rb
capybara-webkit-remote-0.0.2 lib/capybara/driver/webkit/remote_browser.rb