[selenium] r10615 committed - JariBakken: Cygwin fixes.

21 views
Skip to first unread message

codesite...@google.com

unread,
Dec 10, 2010, 1:04:58 PM12/10/10
to selenium-deve...@googlegroups.com
Revision: 10615
Author: jari.bakken
Date: Fri Dec 10 10:03:19 2010
Log: JariBakken: Cygwin fixes.
http://code.google.com/p/selenium/source/detail?r=10615

Modified:
/trunk/rb/lib/selenium/webdriver/chrome/launcher.rb
/trunk/rb/lib/selenium/webdriver/common/platform.rb
/trunk/rb/lib/selenium/webdriver/common/socket_poller.rb
/trunk/rb/lib/selenium/webdriver/firefox/binary.rb

=======================================
--- /trunk/rb/lib/selenium/webdriver/chrome/launcher.rb Tue Dec 7 15:38:42
2010
+++ /trunk/rb/lib/selenium/webdriver/chrome/launcher.rb Fri Dec 10 10:03:19
2010
@@ -58,8 +58,11 @@
end

def launch_chrome(server_url)
+ path = self.class.binary_path
+ path = Platform.cygwin_path(path) if Platform.cygwin?
+
args = [
- Platform.wrap_in_quotes_if_necessary(self.class.binary_path),
+ Platform.wrap_in_quotes_if_necessary(path),
"--load-extension=#{Platform.wrap_in_quotes_if_necessary(tmp_extension_dir)}",
"--activate-on-launch",
"--disable-hang-monitor",
=======================================
--- /trunk/rb/lib/selenium/webdriver/common/platform.rb Fri Dec 10 09:07:27
2010
+++ /trunk/rb/lib/selenium/webdriver/common/platform.rb Fri Dec 10 10:03:19
2010
@@ -83,10 +83,18 @@
os == :linux
end

+ def cygwin?
+ RUBY_PLATFORM =~ /cygwin/
+ end
+
def wrap_in_quotes_if_necessary(str)
win? ? %{"#{str}"} : str
end

+ def cygwin_path(path)
+ `cygpath "#{path}"`.strip
+ end
+
def make_writable(file)
File.chmod 0766, file
end
=======================================
--- /trunk/rb/lib/selenium/webdriver/common/socket_poller.rb Sun Oct 17
18:42:34 2010
+++ /trunk/rb/lib/selenium/webdriver/common/socket_poller.rb Fri Dec 10
10:03:19 2010
@@ -35,12 +35,15 @@

private

+ SOCKET_ERRORS = [Errno::ECONNREFUSED, Errno::ENOTCONN, SocketError]
+ SOCKET_ERRORS << Errno::EPERM if Platform.cygwin?
+
def listening?
# There's a bug in 1.9.1 on Windows where this will succeed even
if no
# one is listening. Users who hit that should upgrade their Ruby.
TCPSocket.new(@host, @port).close
true
- rescue Errno::ECONNREFUSED, Errno::ENOTCONN, SocketError => e
+ rescue *SOCKET_ERRORS => e
$stderr.puts [@host, @port].inspect if $DEBUG
false
end
=======================================
--- /trunk/rb/lib/selenium/webdriver/firefox/binary.rb Tue Dec 7 15:38:42
2010
+++ /trunk/rb/lib/selenium/webdriver/firefox/binary.rb Fri Dec 10 10:03:19
2010
@@ -109,6 +109,8 @@
raise Error::WebDriverError, "unknown platform:
#{Platform.os}"
end

+ @path = Platform.cygwin_path(@path) if Platform.cygwin?
+
unless File.file?(@path.to_s)
raise Error::WebDriverError, "Could not find Firefox binary
(os=#{Platform.os}). Make sure Firefox is installed or set the path
manually with #{self}.path="
end

Reply all
Reply to author
Forward
0 new messages