Class: Selenium::WebDriver::Firefox::SocketLock

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/webdriver/firefox/socket_lock.rb

Constant Summary collapse

HOST =

Need to be really specific about what host to use

On os x, “localhost” will resolve to 3 different addresses (see /etc/hosts). Ruby will loop over these and happily bind to the same port on each one, making it completely unusable for our purposes.

"127.0.0.1"

Instance Method Summary collapse

Constructor Details

#initialize(port, timeout) ⇒ SocketLock

Returns a new instance of SocketLock.



23
24
25
26
# File 'lib/selenium/webdriver/firefox/socket_lock.rb', line 23

def initialize(port, timeout)
  @port    = port
  @timeout = timeout
end

Instance Method Details

#locked(&blk) ⇒ Object



28
29
30
31
32
33
34
35
36
# File 'lib/selenium/webdriver/firefox/socket_lock.rb', line 28

def locked(&blk)
  lock

  begin
    yield
  ensure
    release
  end
end