Skip to content

Commit

Permalink
Adds tests for Proxy, fixes some guards for Socks credentials methods…
Browse files Browse the repository at this point in the history
…, fix guard for setProxyType method
  • Loading branch information
alex-savchuk committed Sep 7, 2013
1 parent 495bcba commit a3c63e8
Show file tree
Hide file tree
Showing 2 changed files with 289 additions and 38 deletions.
39 changes: 28 additions & 11 deletions java/client/src/org/openqa/selenium/Proxy.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public ProxyType getProxyType() {
* @return reference to self
*/
public Proxy setProxyType(ProxyType proxyType) {
verifyProxyTypeCompatibility(ProxyType.AUTODETECT);
verifyProxyTypeCompatibility(proxyType);
this.proxyType = proxyType;
return this;
}
Expand Down Expand Up @@ -214,10 +214,21 @@ public Proxy setHttpsProxy(String httpsProxy) {
return this;
}

/**
* Gets proxy bypass (noproxy) addresses.
*
* @return The proxy bypass (noproxy) addresses
*/
public String getNoProxy() {
return noProxy;
}

/**
* Sets proxy bypass (noproxy) addresses
*
* @param noProxy The proxy bypass (noproxy) addresses
* @return reference to self
*/
public Proxy setNoProxy(String noProxy) {
verifyProxyTypeCompatibility(ProxyType.MANUAL);
this.proxyType = ProxyType.MANUAL;
Expand Down Expand Up @@ -257,13 +268,11 @@ public String getSocksProxy() {
}

/**
* Specifies which proxy to use for SOCKS. Currently only supported in {@link
* com.opera.core.systems.OperaDriver}.
* Specifies which proxy to use for SOCKS.
*
* @param socksProxy the proxy host, expected format is <code>hostname.com:1234</code>
* @return reference to self
*/
// TODO(andreastt): Implement this for Firefox
public Proxy setSocksProxy(String socksProxy) {
verifyProxyTypeCompatibility(ProxyType.MANUAL);
this.proxyType = ProxyType.MANUAL;
Expand All @@ -281,16 +290,20 @@ public String getSocksUsername() {
}

/**
* Specifies a username for the SOCKS proxy. Supported by SOCKS v5 and above.
* Specifies a username for the SOCKS proxy. Supported by SOCKS v5 and above.
*
* @param username username for the SOCKS proxy
* @return reference to self
*/
public void setSocksUsername(String username) {
socksUsername = username;
public Proxy setSocksUsername(String username) {
verifyProxyTypeCompatibility(ProxyType.MANUAL);
this.proxyType = ProxyType.MANUAL;
this.socksUsername = username;
return this;
}

/**
* Gets the SOCKS proxy's password. Supported by SOCKS v5 and above.
* Gets the SOCKS proxy's password. Supported by SOCKS v5 and above.
*
* @return the SOCKS proxy's password
*/
Expand All @@ -299,12 +312,16 @@ public String getSocksPassword() {
}

/**
* Specifies a password for the SOCKS proxy. Supported by SOCKS v5 and above.
* Specifies a password for the SOCKS proxy. Supported by SOCKS v5 and above.
*
* @param password password for the SOCKS proxy
* @return reference to self
*/
public void setSocksPassword(String password) {
socksPassword = password;
public Proxy setSocksPassword(String password) {
verifyProxyTypeCompatibility(ProxyType.MANUAL);
this.proxyType = ProxyType.MANUAL;
this.socksPassword = password;
return this;
}

/**
Expand Down
Loading

0 comments on commit a3c63e8

Please sign in to comment.