зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1458276 - Use correct timeout for RDP connection; r=me
This commit is contained in:
Родитель
740147d7bf
Коммит
324b8d50de
|
@ -21,7 +21,6 @@ import android.support.test.runner.AndroidJUnit4
|
|||
|
||||
import org.hamcrest.Matchers.*
|
||||
import org.junit.Assume.assumeThat
|
||||
import org.junit.Ignore
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
|
@ -1179,7 +1178,6 @@ class GeckoSessionTestRuleTest : BaseSessionTest(noErrorCollector = true) {
|
|||
}
|
||||
|
||||
@WithDevToolsAPI
|
||||
@Ignore
|
||||
@Test fun evaluateJS() {
|
||||
assertThat("JS string result should be correct",
|
||||
sessionRule.session.evaluateJS("'foo'") as String, equalTo("foo"))
|
||||
|
@ -1208,7 +1206,6 @@ class GeckoSessionTestRuleTest : BaseSessionTest(noErrorCollector = true) {
|
|||
}
|
||||
|
||||
@WithDevToolsAPI
|
||||
@Ignore
|
||||
@Test fun evaluateJS_windowObject() {
|
||||
sessionRule.session.loadTestPath(HELLO_HTML_PATH)
|
||||
sessionRule.session.waitForPageStop()
|
||||
|
@ -1223,7 +1220,6 @@ class GeckoSessionTestRuleTest : BaseSessionTest(noErrorCollector = true) {
|
|||
}
|
||||
|
||||
@WithDevToolsAPI
|
||||
@Ignore
|
||||
@Test fun evaluateJS_multipleSessions() {
|
||||
val newSession = sessionRule.createOpenSession()
|
||||
|
||||
|
@ -1236,7 +1232,6 @@ class GeckoSessionTestRuleTest : BaseSessionTest(noErrorCollector = true) {
|
|||
}
|
||||
|
||||
@WithDevToolsAPI
|
||||
@Ignore
|
||||
@Test fun evaluateJS_jsToString() {
|
||||
val obj = sessionRule.session.evaluateJS("({foo:'bar'})")
|
||||
assertThat("JS object toString should follow lazy evaluation",
|
||||
|
@ -1263,14 +1258,12 @@ class GeckoSessionTestRuleTest : BaseSessionTest(noErrorCollector = true) {
|
|||
}
|
||||
|
||||
@WithDevToolsAPI
|
||||
@Ignore
|
||||
@Test(expected = RuntimeException::class)
|
||||
fun evaluateJS_throwOnJSException() {
|
||||
sessionRule.session.evaluateJS("throw Error()")
|
||||
}
|
||||
|
||||
@WithDevToolsAPI
|
||||
@Ignore
|
||||
@Test(expected = RuntimeException::class)
|
||||
fun evaluateJS_throwOnSyntaxError() {
|
||||
sessionRule.session.evaluateJS("<{[")
|
||||
|
|
|
@ -725,7 +725,7 @@ public class GeckoSessionTestRule extends UiThreadTestRule {
|
|||
if (TimeoutMillis.class.equals(annotation.annotationType())) {
|
||||
// Scale timeout based on the default timeout to account for the device under test.
|
||||
final long value = ((TimeoutMillis) annotation).value();
|
||||
final long timeout = value * getDefaultTimeoutMillis() / DEFAULT_TIMEOUT_MILLIS;
|
||||
final long timeout = value * getScaledTimeoutMillis() / DEFAULT_TIMEOUT_MILLIS;
|
||||
mTimeoutMillis = Math.max(timeout, 1000);
|
||||
} else if (Setting.class.equals(annotation.annotationType())) {
|
||||
((Setting) annotation).key().set(settings, ((Setting) annotation).value());
|
||||
|
@ -761,7 +761,7 @@ public class GeckoSessionTestRule extends UiThreadTestRule {
|
|||
return new RuntimeException(cause != null ? cause : e);
|
||||
}
|
||||
|
||||
private long getDefaultTimeoutMillis() {
|
||||
private long getScaledTimeoutMillis() {
|
||||
if ("x86".equals(env.getCPUArch())) {
|
||||
return env.isEmulator() ? DEFAULT_X86_EMULATOR_TIMEOUT_MILLIS
|
||||
: DEFAULT_X86_DEVICE_TIMEOUT_MILLIS;
|
||||
|
@ -770,10 +770,14 @@ public class GeckoSessionTestRule extends UiThreadTestRule {
|
|||
: DEFAULT_ARM_DEVICE_TIMEOUT_MILLIS;
|
||||
}
|
||||
|
||||
private long getDefaultTimeoutMillis() {
|
||||
return env.isDebugging() ? DEFAULT_IDE_DEBUG_TIMEOUT_MILLIS
|
||||
: getScaledTimeoutMillis();
|
||||
}
|
||||
|
||||
protected void prepareStatement(final Description description) throws Throwable {
|
||||
final GeckoSessionSettings settings = new GeckoSessionSettings(mDefaultSettings);
|
||||
mTimeoutMillis = env.isDebugging() ? DEFAULT_IDE_DEBUG_TIMEOUT_MILLIS
|
||||
: getDefaultTimeoutMillis();
|
||||
mTimeoutMillis = getDefaultTimeoutMillis();
|
||||
mNullDelegates = new HashSet<>();
|
||||
mClosedSession = false;
|
||||
mWithDevTools = false;
|
||||
|
@ -895,8 +899,7 @@ public class GeckoSessionTestRule extends UiThreadTestRule {
|
|||
dataDir + "/firefox-debugger-socket",
|
||||
LocalSocketAddress.Namespace.FILESYSTEM);
|
||||
sRDPConnection = new RDPConnection(address);
|
||||
sRDPConnection.setTimeout((int) Math.min(DEFAULT_TIMEOUT_MILLIS,
|
||||
Integer.MAX_VALUE));
|
||||
sRDPConnection.setTimeout(mTimeoutMillis);
|
||||
}
|
||||
final Tab tab = sRDPConnection.getMostRecentTab();
|
||||
tab.attach();
|
||||
|
|
Загрузка…
Ссылка в новой задаче