Skip to content

Commit

Permalink
Strictly NO-OP code cleanups
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Tolfsen <ato@mozilla.com>
  • Loading branch information
sevaseva authored and andreastt committed Apr 12, 2014
1 parent 25b8322 commit 78e4e90
Show file tree
Hide file tree
Showing 17 changed files with 32 additions and 26 deletions.
4 changes: 2 additions & 2 deletions java/client/src/com/thoughtworks/selenium/Wait.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ public Wait(String messageToShowIfTimeout) {
public abstract boolean until();

/** The amount of time to wait before giving up; the default is 30 seconds */
public static final long DEFAULT_TIMEOUT = 30000l;
public static final long DEFAULT_TIMEOUT = 30000L;

/** The interval to pause between checking; the default is 500 milliseconds */
public static final long DEFAULT_INTERVAL = 500l;
public static final long DEFAULT_INTERVAL = 500L;

/**
* Wait until the "until" condition returns true or time runs out.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void selectPopUp(WebDriver driver, String windowID) {
if ("null".equals(windowID) || "".equals(windowID)) {
Set<String> windowHandles = driver.getWindowHandles();
windowHandles.remove(originalWindowHandle);
if (windowHandles.size() > 0) {
if (!windowHandles.isEmpty()) {
driver.switchTo().window(windowHandles.iterator().next());
} else {
throw new SeleniumException("Unable to find a popup window");
Expand Down
4 changes: 2 additions & 2 deletions java/client/src/org/openqa/selenium/ContextAware.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public interface ContextAware {
Set<String> getContextHandles();

/**
* Return an opaque handle to this context that uniquely identifies it within this driver instance.
* This can be used to switch to this context at a later date
* Return an opaque handle to this context that uniquely identifies it within this driver
* instance. This can be used to switch to this context at a later date
*/
String getContext();
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
package org.openqa.selenium;

/**
* Thrown by {@link org.openqa.selenium.WebDriver.TargetLocator#context(String) WebDriver.switchTo().context(String
* name)}.
* Thrown by {@link org.openqa.selenium.WebDriver.TargetLocator#context(String)
* WebDriver.switchTo().context(String name)}.
*/
public class NoSuchContextException extends NotFoundException {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public static File makeProxyPAC(File parentDir, int port, String configuredProxy
}

/**
* @Deprecated Use Proxy.extractFrom(Capabilities)
* @deprecated Use Proxy.extractFrom(Capabilities)
*/
@Deprecated
@SuppressWarnings({"unchecked"})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ public InternetExplorerDriver(InternetExplorerDriverService service, Capabilitie
this(service, capabilities, DEFAULT_PORT);
}

public InternetExplorerDriver(InternetExplorerDriverService service, Capabilities capabilities, int port) {
public InternetExplorerDriver(InternetExplorerDriverService service, Capabilities capabilities,
int port) {
if (capabilities == null) {
capabilities = DesiredCapabilities.internetExplorer();
}
Expand Down
6 changes: 3 additions & 3 deletions java/client/src/org/openqa/selenium/remote/Augmenter.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ protected <X> X create(RemoteWebDriver driver,

@Override
protected RemoteWebDriver extractRemoteWebDriver(WebDriver driver) {
if (driver.getClass().isAnnotationPresent(Augmentable.class)
|| driver.getClass().getName().startsWith("org.openqa.selenium.remote.RemoteWebDriver$$EnhancerByCGLIB"))
{
if (driver.getClass().isAnnotationPresent(Augmentable.class) ||
driver.getClass().getName().startsWith(
"org.openqa.selenium.remote.RemoteWebDriver$$EnhancerByCGLIB")) {
return (RemoteWebDriver) driver;

} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,8 @@ public Response execute(Command command) throws IOException {
}
if (!GET_ALL_SESSIONS.equals(command.getName())
&& !NEW_SESSION.equals(command.getName())) {
throw new SessionNotFoundException("Session ID is null. Using WebDriver after calling quit()?");
throw new SessionNotFoundException(
"Session ID is null. Using WebDriver after calling quit()?");
}
}

Expand Down
1 change: 1 addition & 0 deletions java/client/src/org/openqa/selenium/remote/build.desc
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ java_library(name = "augmenter",
"html5/AddWebStorage.java",
],
deps = [
":api",
":remote",
"//third_party/java/cglib",
"//third_party/java/guava-libraries",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ public void testShouldNotBeAbleToDoAnythingTheFrameIsDeletedFromUnderUs() {

WebElement killIframe = driver.findElement(By.id("killIframe"));
killIframe.click();

try {
driver.findElement(By.id("killIframe")).click();
fail("NoSuchFrameException should be thrown");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ protected BrowserSessionInfo createNewRemoteSession(String browserString, String
perSessionLogHandler.attachToCurrentThread(new SessionId(sessionId));
try {
launcher.launchRemoteSession(startURL);
queueSet.waitForLoad(configuration.getTimeoutInSeconds() * 1000l);
queueSet.waitForLoad(configuration.getTimeoutInSeconds() * 1000L);

// TODO DGF log4j only
// NDC.push("sessionId="+sessionId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public boolean isDirectory() {
*/
@Override
public long lastModified() {
return System.currentTimeMillis() + 1000l * 3600l * 24l * 365l;
return System.currentTimeMillis() + 1000L * 3600L * 24L * 365L;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ public String doCommand(String command, String arg, String value) throws RemoteC
// an exception then we should simply return the
// command result
uniqueId =
waitForLoad(waitingForThisWindowName, "top", (int) (timeoutInMilliseconds / 1000l));
waitForLoad(waitingForThisWindowName, "top", (int) (timeoutInMilliseconds / 1000L));

// if (!result.equals("OK")) {
// return result;
Expand All @@ -371,7 +371,7 @@ public String doCommand(String command, String arg, String value) throws RemoteC
try {
result =
waitForLoad(currentWindowName, waitingForThisFrameName,
(int) (timeoutInMilliseconds / 1000l));
(int) (timeoutInMilliseconds / 1000L));
} catch (RemoteCommandException e) {
return e.getMessage();
}
Expand Down Expand Up @@ -530,7 +530,7 @@ private String getRemoteString(CommandQueue queue, String command, String arg1,
public String waitForLoad(long timeoutInMilliseconds) throws RemoteCommandException {
final String uniqueId;

int timeoutInSeconds = (int) (timeoutInMilliseconds / 1000l);
int timeoutInSeconds = (int) (timeoutInMilliseconds / 1000L);
if (timeoutInSeconds == 0) {
timeoutInSeconds = 1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public boolean exists() {
*/
@Override
public long lastModified() {
return System.currentTimeMillis() + (1000l * 3600l * 24l * 365l * 12l);
return System.currentTimeMillis() + (1000L * 3600L * 24L * 365L * 12L);
}

/* -------------------------------------------------------- */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private String runHTMLSuite(String browser, String browserURL, String suiteURL,
if (!outputFile.canWrite()) {
throw new IOException("Can't write to outputFile: " + outputFile.getAbsolutePath());
}
long timeoutInMs = 1000l * timeoutInSeconds;
long timeoutInMs = 1000L * timeoutInSeconds;
if (timeoutInMs < 0) {
log.warning("Looks like the timeout overflowed, so resetting it to the maximum.");
timeoutInMs = Long.MAX_VALUE;
Expand Down
11 changes: 7 additions & 4 deletions javascript/firefox-driver/js/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ fxdriver.files.createTempFile = function(opt_prefix, opt_suffix) {
file.append(path);
exists = file.exists();
}
file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0666);
file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE,
parseInt('666', 8));
return new fxdriver.files.File(file);
};

Expand Down Expand Up @@ -77,7 +78,8 @@ fxdriver.files.getLocalFile_ = function(path) {
get('ProfD', Components.interfaces.nsILocalFile);
file.initWithPath(path);
if (!file.exists()) {
file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0666);
file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE,
parseInt('666', 8));
}
return file;
};
Expand Down Expand Up @@ -122,7 +124,8 @@ fxdriver.files.READ_MODE_ = 0x01;
fxdriver.files.File.prototype.append = function(toAppend) {
var ostream = Components.classes['@mozilla.org/network/file-output-stream;1']
.createInstance(Components.interfaces['nsIFileOutputStream']);
ostream.init(this.nsIFile_, fxdriver.files.APPEND_MODE_, 0666, 0);
ostream.init(this.nsIFile_, fxdriver.files.APPEND_MODE_,
parseInt('666', 8), 0);

var converter =
Components.classes['@mozilla.org/intl/converter-output-stream;1']
Expand All @@ -143,7 +146,7 @@ fxdriver.files.File.prototype.append = function(toAppend) {
fxdriver.files.File.prototype.read = function() {
var istream = Components.classes['@mozilla.org/network/file-input-stream;1']
.createInstance(Components.interfaces['nsIFileInputStream']);
istream.init(this.nsIFile_, fxdriver.files.READ_MODE_, 0666, 0);
istream.init(this.nsIFile_, fxdriver.files.READ_MODE_, parseInt('666', 8), 0);

var converter =
Components.classes['@mozilla.org/intl/converter-input-stream;1']
Expand Down
2 changes: 1 addition & 1 deletion javascript/firefox-driver/js/wdsession.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ wdSession.prototype.getWindow = function() {
};


/** @return @return {?nsIDOMWindow} This session's top window. */
/** @return {?nsIDOMWindow} This session's top window. */
wdSession.prototype.getTopWindow = function() {
return this.getWindow().top;
};
Expand Down

0 comments on commit 78e4e90

Please sign in to comment.