lib/selenium/webdriver/chrome/launcher.rb in selenium-webdriver-0.0.28 vs lib/selenium/webdriver/chrome/launcher.rb in selenium-webdriver-0.0.29

- old
+ new

@@ -33,35 +33,40 @@ path = possible_paths.find { |f| File.exist?(f) } path || raise(Error::WebDriverError, "Could not find Chrome binary. Make sure Chrome is installed (OS: #{Platform.os})") ) end + # + # @private + # + # @see Chrome.path= + # + + def self.binary_path=(path) + Platform.assert_executable(path) + @binary_path = path + end + def launch(server_url) create_extension create_profile launch_chrome server_url pid end def quit - @process.ensure_death + @process.stop end private def create_extension # TODO: find a better way to do this rm_rf tmp_extension_dir mkdir_p File.dirname(tmp_extension_dir), :mode => 0700 cp_r ext_path, tmp_extension_dir - - if Platform.win? - mv "#{tmp_extension_dir}/manifest-win.json", "#{tmp_extension_dir}/manifest.json" - else - mv "#{tmp_extension_dir}/manifest-nonwin.json", "#{tmp_extension_dir}/manifest.json" - end end def create_profile touch "#{tmp_profile_dir}/First Run" touch "#{tmp_profile_dir}/First Run Dev" @@ -85,15 +90,15 @@ args << "--ignore-certificate-errors" end args << server_url - @process = ChildProcess.new(*args).start + @process = ChildProcess.build(*args).start end def ext_path - @ext_path ||= ZipHelper.unzip("#{WebDriver.root}/selenium/webdriver/chrome/extension.zip") + @ext_path ||= Zipper.unzip("#{WebDriver.root}/selenium/webdriver/chrome/extension.zip") end def tmp_extension_dir @tmp_extension_dir ||= ( dir = Dir.mktmpdir("webdriver-chrome-extension") @@ -134,20 +139,14 @@ # older JRuby and IronRuby does not have win32/registry nil rescue Win32::Registry::Error nil end - - def quit - # looks like we need a kill right away on Windows + MRI - @process.kill if Platform.engine == :ruby - super - end end class UnixLauncher < Launcher def self.possible_paths - [Platform.find_binary("google-chrome"), "/usr/bin/google-chrome"].compact + [Platform.find_binary("google-chrome"), Platform.find_binary("chromium"), "/usr/bin/google-chrome"].compact end end class MacOSXLauncher < UnixLauncher