class Opal::CliRunners::Chrome

def chrome_executable

def chrome_executable
  ENV['GOOGLE_CHROME_BINARY'] ||
    if OS.windows?
      [
        'C:/Program Files/Google/Chrome Dev/Application/chrome.exe',
        'C:/Program Files/Google/Chrome/Application/chrome.exe'
      ].each do |path|
        next unless File.exist? path
        return path
      end
    elsif OS.macos?
      '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
    else
      %w[
        google-chrome-stable
        chromium
        chromium-freeworld
        chromium-browser
      ].each do |name|
        next unless system('sh', '-c', "command -v #{name.shellescape}", out: '/dev/null')
        return name
      end
      raise 'Cannot find chrome executable'
    end
end