forked from SeleniumHQ/selenium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SimonStewart: Start moving all timeout configuration to use a single …
…end-point rather than a range. r15880
- Loading branch information
Showing
10 changed files
with
146 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,20 @@ | ||
/* | ||
Copyright 2012 WebDriver committers | ||
Copyright 2012 Software Freedom Conservancy | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package org.openqa.selenium; | ||
|
||
import static org.openqa.selenium.testing.Ignore.Driver.ANDROID; | ||
|
@@ -15,9 +32,6 @@ | |
|
||
import java.util.List; | ||
|
||
/** | ||
* @author [email protected] (Jason Leyba) | ||
*/ | ||
@NeedsLocalEnvironment(reason = | ||
"Executing these tests over the wire doesn't work, because they relies on 100ms-specific timing") | ||
public class ImplicitWaitTest extends AbstractDriverTestCase { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
java/server/src/org/openqa/selenium/remote/server/handler/ConfigureTimeout.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
Copyright 2012 WebDriver committers | ||
Copyright 2012 Software Freedom Conservancy | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package org.openqa.selenium.remote.server.handler; | ||
|
||
import org.openqa.selenium.WebDriverException; | ||
import org.openqa.selenium.remote.server.JsonParametersAware; | ||
import org.openqa.selenium.remote.server.Session; | ||
import org.openqa.selenium.remote.server.rest.ResultType; | ||
|
||
import java.util.Map; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
public class ConfigureTimeout extends WebDriverHandler implements JsonParametersAware { | ||
|
||
private volatile String type; | ||
private volatile long millis; | ||
|
||
public ConfigureTimeout(Session session) { | ||
super(session); | ||
} | ||
|
||
public void setJsonParameters(Map<String, Object> allParameters) throws Exception { | ||
type = (String) allParameters.get("type"); | ||
millis = ((Number) allParameters.get("ms")).longValue(); | ||
} | ||
|
||
public ResultType call() throws Exception { | ||
if ("implicit".equals(type)) { | ||
getDriver().manage().timeouts().implicitlyWait(millis, TimeUnit.MILLISECONDS); | ||
} else if ("script".equals(type)) { | ||
getDriver().manage().timeouts().setScriptTimeout(millis, TimeUnit.MILLISECONDS); | ||
} else { | ||
throw new WebDriverException("Unknown wait type: " + type); | ||
} | ||
return ResultType.SUCCESS; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return String.format("[implicitly wait: %s]", millis); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters