зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1457863 - 2. Use kotlin array literals; r=nalexander
Use the new array literal syntax from kotlin 1.2. MozReview-Commit-ID: CaiG9aSD2T6 --HG-- extra : rebase_source : 4930c565b5758845e0928c1596069b0f68883fc0
This commit is contained in:
Родитель
652208262f
Коммит
15c3ab5751
|
@ -318,7 +318,7 @@ class GeckoSessionTestRuleTest : BaseSessionTest(noErrorCollector = true) {
|
|||
var counter = 0
|
||||
|
||||
sessionRule.waitUntilCalled(object : Callbacks.ProgressDelegate {
|
||||
@AssertCalled(count = 2, order = intArrayOf(1, 2))
|
||||
@AssertCalled(count = 2, order = [1, 2])
|
||||
override fun onPageStop(session: GeckoSession, success: Boolean) {
|
||||
val info = sessionRule.currentCall
|
||||
assertThat("Method info should be valid", info, notNullValue())
|
||||
|
@ -463,11 +463,11 @@ class GeckoSessionTestRuleTest : BaseSessionTest(noErrorCollector = true) {
|
|||
sessionRule.waitForPageStop()
|
||||
|
||||
sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate {
|
||||
@AssertCalled(order = intArrayOf(1))
|
||||
@AssertCalled(order = [1])
|
||||
override fun onPageStart(session: GeckoSession, url: String) {
|
||||
}
|
||||
|
||||
@AssertCalled(order = intArrayOf(2))
|
||||
@AssertCalled(order = [2])
|
||||
override fun onPageStop(session: GeckoSession, success: Boolean) {
|
||||
}
|
||||
})
|
||||
|
@ -479,11 +479,11 @@ class GeckoSessionTestRuleTest : BaseSessionTest(noErrorCollector = true) {
|
|||
sessionRule.waitForPageStop()
|
||||
|
||||
sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate {
|
||||
@AssertCalled(order = intArrayOf(2))
|
||||
@AssertCalled(order = [2])
|
||||
override fun onPageStart(session: GeckoSession, url: String) {
|
||||
}
|
||||
|
||||
@AssertCalled(order = intArrayOf(1))
|
||||
@AssertCalled(order = [1])
|
||||
override fun onPageStop(session: GeckoSession, success: Boolean) {
|
||||
}
|
||||
})
|
||||
|
@ -495,11 +495,11 @@ class GeckoSessionTestRuleTest : BaseSessionTest(noErrorCollector = true) {
|
|||
sessionRule.waitForPageStops(2)
|
||||
|
||||
sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate {
|
||||
@AssertCalled(order = intArrayOf(1, 3, 1))
|
||||
@AssertCalled(order = [1, 3, 1])
|
||||
override fun onPageStart(session: GeckoSession, url: String) {
|
||||
}
|
||||
|
||||
@AssertCalled(order = intArrayOf(2, 4, 1))
|
||||
@AssertCalled(order = [2, 4, 1])
|
||||
override fun onPageStop(session: GeckoSession, success: Boolean) {
|
||||
}
|
||||
})
|
||||
|
@ -512,11 +512,11 @@ class GeckoSessionTestRuleTest : BaseSessionTest(noErrorCollector = true) {
|
|||
sessionRule.waitForPageStops(2)
|
||||
|
||||
sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate {
|
||||
@AssertCalled(order = intArrayOf(1, 2, 1))
|
||||
@AssertCalled(order = [1, 2, 1])
|
||||
override fun onPageStart(session: GeckoSession, url: String) {
|
||||
}
|
||||
|
||||
@AssertCalled(order = intArrayOf(3, 4, 1))
|
||||
@AssertCalled(order = [3, 4, 1])
|
||||
override fun onPageStop(session: GeckoSession, success: Boolean) {
|
||||
}
|
||||
})
|
||||
|
@ -665,12 +665,12 @@ class GeckoSessionTestRuleTest : BaseSessionTest(noErrorCollector = true) {
|
|||
var counter = 0
|
||||
|
||||
sessionRule.delegateUntilTestEnd(object : Callbacks.ProgressDelegate {
|
||||
@AssertCalled(count = 1, order = intArrayOf(1))
|
||||
@AssertCalled(count = 1, order = [1])
|
||||
override fun onPageStart(session: GeckoSession, url: String) {
|
||||
counter++
|
||||
}
|
||||
|
||||
@AssertCalled(count = 1, order = intArrayOf(2))
|
||||
@AssertCalled(count = 1, order = [2])
|
||||
override fun onPageStop(session: GeckoSession, success: Boolean) {
|
||||
counter++
|
||||
}
|
||||
|
@ -709,11 +709,11 @@ class GeckoSessionTestRuleTest : BaseSessionTest(noErrorCollector = true) {
|
|||
@Test(expected = AssertionError::class)
|
||||
fun delegateUntilTestEnd_throwOnWrongOrder() {
|
||||
sessionRule.delegateUntilTestEnd(object : Callbacks.ProgressDelegate {
|
||||
@AssertCalled(count = 1, order = intArrayOf(2))
|
||||
@AssertCalled(count = 1, order = [2])
|
||||
override fun onPageStart(session: GeckoSession, url: String) {
|
||||
}
|
||||
|
||||
@AssertCalled(count = 1, order = intArrayOf(1))
|
||||
@AssertCalled(count = 1, order = [1])
|
||||
override fun onPageStop(session: GeckoSession, success: Boolean) {
|
||||
}
|
||||
})
|
||||
|
@ -743,12 +743,12 @@ class GeckoSessionTestRuleTest : BaseSessionTest(noErrorCollector = true) {
|
|||
var counter = 0
|
||||
|
||||
sessionRule.delegateDuringNextWait(object : Callbacks.ProgressDelegate {
|
||||
@AssertCalled(count = 1, order = intArrayOf(1))
|
||||
@AssertCalled(count = 1, order = [1])
|
||||
override fun onPageStart(session: GeckoSession, url: String) {
|
||||
counter++
|
||||
}
|
||||
|
||||
@AssertCalled(count = 1, order = intArrayOf(2))
|
||||
@AssertCalled(count = 1, order = [2])
|
||||
override fun onPageStop(session: GeckoSession, success: Boolean) {
|
||||
counter++
|
||||
}
|
||||
|
@ -786,34 +786,34 @@ class GeckoSessionTestRuleTest : BaseSessionTest(noErrorCollector = true) {
|
|||
|
||||
sessionRule.delegateUntilTestEnd(object : Callbacks.ProgressDelegate,
|
||||
Callbacks.NavigationDelegate {
|
||||
@AssertCalled(count = 1, order = intArrayOf(2))
|
||||
@AssertCalled(count = 1, order = [2])
|
||||
override fun onPageStart(session: GeckoSession, url: String) {
|
||||
testCounter++
|
||||
}
|
||||
|
||||
@AssertCalled(count = 1, order = intArrayOf(4))
|
||||
@AssertCalled(count = 1, order = [4])
|
||||
override fun onPageStop(session: GeckoSession, success: Boolean) {
|
||||
testCounter++
|
||||
}
|
||||
|
||||
@AssertCalled(count = 2, order = intArrayOf(1, 3))
|
||||
@AssertCalled(count = 2, order = [1, 3])
|
||||
override fun onCanGoBack(session: GeckoSession, canGoBack: Boolean) {
|
||||
testCounter++
|
||||
}
|
||||
|
||||
@AssertCalled(count = 2, order = intArrayOf(1, 3))
|
||||
@AssertCalled(count = 2, order = [1, 3])
|
||||
override fun onCanGoForward(session: GeckoSession, canGoForward: Boolean) {
|
||||
testCounter++
|
||||
}
|
||||
})
|
||||
|
||||
sessionRule.delegateDuringNextWait(object : Callbacks.ProgressDelegate {
|
||||
@AssertCalled(count = 1, order = intArrayOf(1))
|
||||
@AssertCalled(count = 1, order = [1])
|
||||
override fun onPageStart(session: GeckoSession, url: String) {
|
||||
waitCounter++
|
||||
}
|
||||
|
||||
@AssertCalled(count = 1, order = intArrayOf(2))
|
||||
@AssertCalled(count = 1, order = [2])
|
||||
override fun onPageStop(session: GeckoSession, success: Boolean) {
|
||||
waitCounter++
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ class NavigationDelegateTest : BaseSessionTest() {
|
|||
sessionRule.waitForPageStop()
|
||||
|
||||
sessionRule.forCallbacksDuringWait(object : Callbacks.NavigationDelegate {
|
||||
@AssertCalled(count = 1, order = intArrayOf(1))
|
||||
@AssertCalled(count = 1, order = [1])
|
||||
override fun onLoadRequest(session: GeckoSession, uri: String,
|
||||
where: Int,
|
||||
flags: Int,
|
||||
|
@ -41,20 +41,20 @@ class NavigationDelegateTest : BaseSessionTest() {
|
|||
response.respond(false)
|
||||
}
|
||||
|
||||
@AssertCalled(count = 1, order = intArrayOf(2))
|
||||
@AssertCalled(count = 1, order = [2])
|
||||
override fun onLocationChange(session: GeckoSession, url: String) {
|
||||
assertThat("Session should not be null", session, notNullValue())
|
||||
assertThat("URL should not be null", url, notNullValue())
|
||||
assertThat("URL should match", url, endsWith(HELLO_HTML_PATH))
|
||||
}
|
||||
|
||||
@AssertCalled(count = 1, order = intArrayOf(2))
|
||||
@AssertCalled(count = 1, order = [2])
|
||||
override fun onCanGoBack(session: GeckoSession, canGoBack: Boolean) {
|
||||
assertThat("Session should not be null", session, notNullValue())
|
||||
assertThat("Cannot go back", canGoBack, equalTo(false))
|
||||
}
|
||||
|
||||
@AssertCalled(count = 1, order = intArrayOf(2))
|
||||
@AssertCalled(count = 1, order = [2])
|
||||
override fun onCanGoForward(session: GeckoSession, canGoForward: Boolean) {
|
||||
assertThat("Session should not be null", session, notNullValue())
|
||||
assertThat("Cannot go forward", canGoForward, equalTo(false))
|
||||
|
@ -199,7 +199,7 @@ class NavigationDelegateTest : BaseSessionTest() {
|
|||
sessionRule.waitForPageStop()
|
||||
|
||||
sessionRule.forCallbacksDuringWait(object : Callbacks.NavigationDelegate {
|
||||
@AssertCalled(count = 1, order = intArrayOf(1))
|
||||
@AssertCalled(count = 1, order = [1])
|
||||
override fun onLoadRequest(session: GeckoSession, uri: String,
|
||||
where: Int,
|
||||
flags: Int,
|
||||
|
@ -210,17 +210,17 @@ class NavigationDelegateTest : BaseSessionTest() {
|
|||
response.respond(false)
|
||||
}
|
||||
|
||||
@AssertCalled(count = 1, order = intArrayOf(2))
|
||||
@AssertCalled(count = 1, order = [2])
|
||||
override fun onLocationChange(session: GeckoSession, url: String) {
|
||||
assertThat("URL should match", url, endsWith(HELLO_HTML_PATH))
|
||||
}
|
||||
|
||||
@AssertCalled(count = 1, order = intArrayOf(2))
|
||||
@AssertCalled(count = 1, order = [2])
|
||||
override fun onCanGoBack(session: GeckoSession, canGoBack: Boolean) {
|
||||
assertThat("Cannot go back", canGoBack, equalTo(false))
|
||||
}
|
||||
|
||||
@AssertCalled(count = 1, order = intArrayOf(2))
|
||||
@AssertCalled(count = 1, order = [2])
|
||||
override fun onCanGoForward(session: GeckoSession, canGoForward: Boolean) {
|
||||
assertThat("Cannot go forward", canGoForward, equalTo(false))
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ class NavigationDelegateTest : BaseSessionTest() {
|
|||
sessionRule.waitForPageStop()
|
||||
|
||||
sessionRule.forCallbacksDuringWait(object : Callbacks.NavigationDelegate {
|
||||
@AssertCalled(count = 1, order = intArrayOf(1))
|
||||
@AssertCalled(count = 1, order = [1])
|
||||
override fun onLoadRequest(session: GeckoSession, uri: String,
|
||||
where: Int,
|
||||
flags: Int,
|
||||
|
@ -261,17 +261,17 @@ class NavigationDelegateTest : BaseSessionTest() {
|
|||
response.respond(false)
|
||||
}
|
||||
|
||||
@AssertCalled(count = 1, order = intArrayOf(2))
|
||||
@AssertCalled(count = 1, order = [2])
|
||||
override fun onLocationChange(session: GeckoSession, url: String) {
|
||||
assertThat("URL should match", url, endsWith(HELLO_HTML_PATH))
|
||||
}
|
||||
|
||||
@AssertCalled(count = 1, order = intArrayOf(2))
|
||||
@AssertCalled(count = 1, order = [2])
|
||||
override fun onCanGoBack(session: GeckoSession, canGoBack: Boolean) {
|
||||
assertThat("Cannot go back", canGoBack, equalTo(false))
|
||||
}
|
||||
|
||||
@AssertCalled(count = 1, order = intArrayOf(2))
|
||||
@AssertCalled(count = 1, order = [2])
|
||||
override fun onCanGoForward(session: GeckoSession, canGoForward: Boolean) {
|
||||
assertThat("Can go forward", canGoForward, equalTo(true))
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ class NavigationDelegateTest : BaseSessionTest() {
|
|||
sessionRule.waitForPageStop()
|
||||
|
||||
sessionRule.forCallbacksDuringWait(object : Callbacks.NavigationDelegate {
|
||||
@AssertCalled(count = 1, order = intArrayOf(1))
|
||||
@AssertCalled(count = 1, order = [1])
|
||||
override fun onLoadRequest(session: GeckoSession, uri: String,
|
||||
where: Int,
|
||||
flags: Int,
|
||||
|
@ -297,17 +297,17 @@ class NavigationDelegateTest : BaseSessionTest() {
|
|||
response.respond(false)
|
||||
}
|
||||
|
||||
@AssertCalled(count = 1, order = intArrayOf(2))
|
||||
@AssertCalled(count = 1, order = [2])
|
||||
override fun onLocationChange(session: GeckoSession, url: String) {
|
||||
assertThat("URL should match", url, endsWith(HELLO2_HTML_PATH))
|
||||
}
|
||||
|
||||
@AssertCalled(count = 1, order = intArrayOf(2))
|
||||
@AssertCalled(count = 1, order = [2])
|
||||
override fun onCanGoBack(session: GeckoSession, canGoBack: Boolean) {
|
||||
assertThat("Can go back", canGoBack, equalTo(true))
|
||||
}
|
||||
|
||||
@AssertCalled(count = 1, order = intArrayOf(2))
|
||||
@AssertCalled(count = 1, order = [2])
|
||||
override fun onCanGoForward(session: GeckoSession, canGoForward: Boolean) {
|
||||
assertThat("Cannot go forward", canGoForward, equalTo(false))
|
||||
}
|
||||
|
@ -335,12 +335,12 @@ class NavigationDelegateTest : BaseSessionTest() {
|
|||
sessionRule.waitForPageStop()
|
||||
|
||||
sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate {
|
||||
@AssertCalled(count = 1, order = intArrayOf(1))
|
||||
@AssertCalled(count = 1, order = [1])
|
||||
override fun onPageStart(session: GeckoSession, url: String) {
|
||||
assertThat("URL should match", url, endsWith(HELLO2_HTML_PATH))
|
||||
}
|
||||
|
||||
@AssertCalled(count = 1, order = intArrayOf(2))
|
||||
@AssertCalled(count = 1, order = [2])
|
||||
override fun onPageStop(session: GeckoSession, success: Boolean) {
|
||||
assertThat("Load should succeed", success, equalTo(true))
|
||||
}
|
||||
|
|
|
@ -28,14 +28,14 @@ class ProgressDelegateTest : BaseSessionTest() {
|
|||
sessionRule.waitForPageStop()
|
||||
|
||||
sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate {
|
||||
@AssertCalled(count = 1, order = intArrayOf(1))
|
||||
@AssertCalled(count = 1, order = [1])
|
||||
override fun onPageStart(session: GeckoSession, url: String) {
|
||||
assertThat("Session should not be null", session, notNullValue())
|
||||
assertThat("URL should not be null", url, notNullValue())
|
||||
assertThat("URL should match", url, endsWith(HELLO_HTML_PATH))
|
||||
}
|
||||
|
||||
@AssertCalled(count = 1, order = intArrayOf(2))
|
||||
@AssertCalled(count = 1, order = [2])
|
||||
override fun onSecurityChange(session: GeckoSession,
|
||||
securityInfo: GeckoSession.ProgressDelegate.SecurityInformation) {
|
||||
assertThat("Session should not be null", session, notNullValue())
|
||||
|
@ -47,7 +47,7 @@ class ProgressDelegateTest : BaseSessionTest() {
|
|||
equalTo(GeckoSession.ProgressDelegate.SecurityInformation.CONTENT_UNKNOWN))
|
||||
}
|
||||
|
||||
@AssertCalled(count = 1, order = intArrayOf(3))
|
||||
@AssertCalled(count = 1, order = [3])
|
||||
override fun onPageStop(session: GeckoSession, success: Boolean) {
|
||||
assertThat("Session should not be null", session, notNullValue())
|
||||
assertThat("Load should succeed", success, equalTo(true))
|
||||
|
@ -95,13 +95,13 @@ class ProgressDelegateTest : BaseSessionTest() {
|
|||
sessionRule.waitForPageStops(2)
|
||||
|
||||
sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate {
|
||||
@AssertCalled(count = 2, order = intArrayOf(1, 3))
|
||||
@AssertCalled(count = 2, order = [1, 3])
|
||||
override fun onPageStart(session: GeckoSession, url: String) {
|
||||
assertThat("URL should match", url,
|
||||
endsWith(forEachCall(INVALID_URI, HELLO_HTML_PATH)))
|
||||
}
|
||||
|
||||
@AssertCalled(count = 2, order = intArrayOf(2, 4))
|
||||
@AssertCalled(count = 2, order = [2, 4])
|
||||
override fun onPageStop(session: GeckoSession, success: Boolean) {
|
||||
// The first load is certain to fail because of interruption by the second load
|
||||
// or by invalid domain name, whereas the second load is certain to succeed.
|
||||
|
@ -119,17 +119,17 @@ class ProgressDelegateTest : BaseSessionTest() {
|
|||
sessionRule.waitForPageStop()
|
||||
|
||||
sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate {
|
||||
@AssertCalled(count = 1, order = intArrayOf(1))
|
||||
@AssertCalled(count = 1, order = [1])
|
||||
override fun onPageStart(session: GeckoSession, url: String) {
|
||||
assertThat("URL should match", url, endsWith(HELLO_HTML_PATH))
|
||||
}
|
||||
|
||||
@AssertCalled(count = 1, order = intArrayOf(2))
|
||||
@AssertCalled(count = 1, order = [2])
|
||||
override fun onSecurityChange(session: GeckoSession,
|
||||
securityInfo: GeckoSession.ProgressDelegate.SecurityInformation) {
|
||||
}
|
||||
|
||||
@AssertCalled(count = 1, order = intArrayOf(3))
|
||||
@AssertCalled(count = 1, order = [3])
|
||||
override fun onPageStop(session: GeckoSession, success: Boolean) {
|
||||
assertThat("Load should succeed", success, equalTo(true))
|
||||
}
|
||||
|
@ -146,17 +146,17 @@ class ProgressDelegateTest : BaseSessionTest() {
|
|||
sessionRule.waitForPageStop()
|
||||
|
||||
sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate {
|
||||
@AssertCalled(count = 1, order = intArrayOf(1))
|
||||
@AssertCalled(count = 1, order = [1])
|
||||
override fun onPageStart(session: GeckoSession, url: String) {
|
||||
assertThat("URL should match", url, endsWith(HELLO_HTML_PATH))
|
||||
}
|
||||
|
||||
@AssertCalled(count = 1, order = intArrayOf(2))
|
||||
@AssertCalled(count = 1, order = [2])
|
||||
override fun onSecurityChange(session: GeckoSession,
|
||||
securityInfo: GeckoSession.ProgressDelegate.SecurityInformation) {
|
||||
}
|
||||
|
||||
@AssertCalled(count = 1, order = intArrayOf(3))
|
||||
@AssertCalled(count = 1, order = [3])
|
||||
override fun onPageStop(session: GeckoSession, success: Boolean) {
|
||||
assertThat("Load should succeed", success, equalTo(true))
|
||||
}
|
||||
|
@ -166,17 +166,17 @@ class ProgressDelegateTest : BaseSessionTest() {
|
|||
sessionRule.waitForPageStop()
|
||||
|
||||
sessionRule.forCallbacksDuringWait(object : Callbacks.ProgressDelegate {
|
||||
@AssertCalled(count = 1, order = intArrayOf(1))
|
||||
@AssertCalled(count = 1, order = [1])
|
||||
override fun onPageStart(session: GeckoSession, url: String) {
|
||||
assertThat("URL should match", url, endsWith(HELLO2_HTML_PATH))
|
||||
}
|
||||
|
||||
@AssertCalled(count = 1, order = intArrayOf(2))
|
||||
@AssertCalled(count = 1, order = [2])
|
||||
override fun onSecurityChange(session: GeckoSession,
|
||||
securityInfo: GeckoSession.ProgressDelegate.SecurityInformation) {
|
||||
}
|
||||
|
||||
@AssertCalled(count = 1, order = intArrayOf(3))
|
||||
@AssertCalled(count = 1, order = [3])
|
||||
override fun onPageStop(session: GeckoSession, success: Boolean) {
|
||||
assertThat("Load should succeed", success, equalTo(true))
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче