Skip to content
This repository was archived by the owner on Nov 1, 2022. It is now read-only.

Commit aa036a7

Browse files
committed
Remove flaky test.
1 parent b3fb7a5 commit aa036a7

File tree

1 file changed

+0
-53
lines changed

1 file changed

+0
-53
lines changed

components/browser/awesomebar/src/test/java/mozilla/components/browser/awesomebar/BrowserAwesomeBarTest.kt

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import kotlinx.coroutines.newSingleThreadContext
1010
import kotlinx.coroutines.runBlocking
1111
import mozilla.components.concept.awesomebar.AwesomeBar
1212
import mozilla.components.support.test.mock
13-
import org.junit.Assert.assertEquals
1413
import org.junit.Assert.assertTrue
1514
import org.junit.Test
1615
import org.junit.runner.RunWith
@@ -165,58 +164,6 @@ class BrowserAwesomeBarTest {
165164
}
166165
}
167166

168-
@Test
169-
fun `BrowserAwesomeBar cancels previous jobs if onInputStarted gets called again`() {
170-
runBlocking(testMainScope.coroutineContext) {
171-
var firstProviderCallCancelled = false
172-
var timesProviderCalled = 0
173-
174-
val provider = object : AwesomeBar.SuggestionProvider {
175-
var isFirstCall = true
176-
177-
override suspend fun onInputChanged(text: String): List<AwesomeBar.Suggestion> {
178-
println("Provider called with: $text")
179-
180-
timesProviderCalled++
181-
182-
// Our first call is blocking indefinitely and should get cancelled by the second
183-
// call that just passes.
184-
185-
if (!isFirstCall) {
186-
return emptyList()
187-
}
188-
189-
isFirstCall = false
190-
191-
try {
192-
// We can only escape this by cancelling the coroutine
193-
while (true) {
194-
delay(10)
195-
}
196-
} finally {
197-
firstProviderCallCancelled = true
198-
}
199-
}
200-
}
201-
202-
val awesomeBar = BrowserAwesomeBar(RuntimeEnvironment.application)
203-
awesomeBar.scope = testMainScope
204-
awesomeBar.addProviders(provider)
205-
206-
awesomeBar.onInputChanged("Hello!")
207-
208-
// Give the jobs some time to start
209-
delay(50)
210-
211-
awesomeBar.onInputChanged("World!")
212-
213-
awesomeBar.job!!.join()
214-
215-
assertTrue(firstProviderCallCancelled)
216-
assertEquals(2, timesProviderCalled)
217-
}
218-
}
219-
220167
@Test
221168
fun `onStopListener is accessible internally`() {
222169
var stopped = false

0 commit comments

Comments
 (0)