Clean up proxy interface
This commit is contained in:
parent
229a20e897
commit
93bfcf6e46
|
@ -99,16 +99,13 @@ class Capybara::Driver::Webkit
|
|||
command("GetCookies").lines.map{ |line| line.strip }.select{ |line| !line.empty? }
|
||||
end
|
||||
|
||||
def set_proxy(opts = {})
|
||||
# remove proxy?
|
||||
return command("SetProxy") if opts.empty?
|
||||
def set_proxy(options = {})
|
||||
options = default_proxy_options.merge(options)
|
||||
command("SetProxy", options[:host], options[:port], options[:user], options[:pass])
|
||||
end
|
||||
|
||||
# set a HTTP proxy
|
||||
command("SetProxy",
|
||||
opts[:host] || "localhost",
|
||||
opts[:port] || "0",
|
||||
opts[:user] || "",
|
||||
opts[:pass] || "")
|
||||
def clear_proxy
|
||||
command("SetProxy")
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -206,5 +203,14 @@ class Capybara::Driver::Webkit
|
|||
response.force_encoding("UTF-8") if response.respond_to?(:force_encoding)
|
||||
response
|
||||
end
|
||||
|
||||
def default_proxy_options
|
||||
{
|
||||
:host => "localhost",
|
||||
:port => "0",
|
||||
:user => "",
|
||||
:pass => ""
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -170,7 +170,7 @@ describe Capybara::Driver::Webkit::Browser do
|
|||
|
||||
it 'is possible to disable proxy again' do
|
||||
@proxy_requests.clear
|
||||
browser.set_proxy
|
||||
browser.clear_proxy
|
||||
browser.visit "http://#{@host}:#{@port}/"
|
||||
@proxy_requests.size.should == 0
|
||||
end
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "SetCookie.h"
|
||||
#include "ClearCookies.h"
|
||||
#include "GetCookies.h"
|
||||
#include "SetProxy.h"
|
||||
|
||||
CommandFactory::CommandFactory(WebPage *page, QObject *parent) : QObject(parent) {
|
||||
m_page = page;
|
||||
|
|
Loading…
Reference in New Issue