rebase
This commit is contained in:
@@ -11,6 +11,7 @@ import kotlinx.coroutines.flow.*
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import record_cache.RecordPanelOuterClass
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
import java.util.concurrent.TimeUnit
|
||||
@@ -20,14 +21,15 @@ import kotlin.random.Random
|
||||
@LargeTest
|
||||
class AutoPilotBadCaseTest {
|
||||
|
||||
lateinit var launch: ActivityScenario<MainLauncherActivity>
|
||||
private lateinit var launch: ActivityScenario<MainLauncherActivity>
|
||||
|
||||
@Before
|
||||
fun launch() {
|
||||
launch = ActivityScenario.launch(MainLauncherActivity::class.java)
|
||||
}
|
||||
|
||||
@ExperimentalCoroutinesApi @Test
|
||||
@ExperimentalCoroutinesApi
|
||||
@Test
|
||||
fun showBadCaseEntrance1(): Unit = runBlocking(Dispatchers.Main) {
|
||||
delay(5000)
|
||||
var index = 0
|
||||
@@ -36,17 +38,19 @@ class AutoPilotBadCaseTest {
|
||||
.asFlow()
|
||||
.onEach {
|
||||
delay(TimeUnit.SECONDS.toMillis(5))
|
||||
CallerDevaToolsManager.onReceiveBadCaseRecord(AutoPilotRecordResult().also {
|
||||
val builder = RecordPanelOuterClass.RecordPanel.newBuilder()
|
||||
builder.also {
|
||||
it.diskFree = (100 + index).toLong()
|
||||
it.duration = 60.0
|
||||
it.fileName = "/user/general/record_$index.log"
|
||||
it.duration = 60.0.toFloat()
|
||||
it.filename = "/user/general/record_$index.log"
|
||||
it.id = 10 + index
|
||||
it.key = "yyy_$index"
|
||||
it.key = index.toLong()
|
||||
it.stat = 100
|
||||
it.type = 1
|
||||
it.timestamp = SimpleDateFormat("yyyyMMddHHmmss").format(Date())
|
||||
index++
|
||||
})
|
||||
}
|
||||
CallerDevaToolsManager.onReceiveBadCaseRecord(builder.build())
|
||||
}
|
||||
.flowOn(Dispatchers.Default)
|
||||
.collect()
|
||||
@@ -54,8 +58,9 @@ class AutoPilotBadCaseTest {
|
||||
}
|
||||
|
||||
|
||||
@ExperimentalCoroutinesApi @Test
|
||||
fun showBadCaseEntrance2():Unit = runBlocking(Dispatchers.Main) {
|
||||
@ExperimentalCoroutinesApi
|
||||
@Test
|
||||
fun showBadCaseEntrance2(): Unit = runBlocking(Dispatchers.Main) {
|
||||
delay(5000)
|
||||
var index = 0
|
||||
(1 until 50)
|
||||
@@ -67,24 +72,27 @@ class AutoPilotBadCaseTest {
|
||||
} else {
|
||||
delay(Random(20).nextLong())
|
||||
}
|
||||
CallerDevaToolsManager.onReceiveBadCaseRecord(AutoPilotRecordResult().also {
|
||||
val builder = RecordPanelOuterClass.RecordPanel.newBuilder()
|
||||
builder.also {
|
||||
it.diskFree = (100 + index).toLong()
|
||||
it.duration = 60.0
|
||||
it.fileName = "/user/general/record_$index.log"
|
||||
it.duration = 60.0.toFloat()
|
||||
it.filename = "/user/general/record_$index.log"
|
||||
it.id = 10 + index
|
||||
it.key = "yyy_$index"
|
||||
it.key = index.toLong()
|
||||
it.stat = 100
|
||||
it.type = 1
|
||||
it.timestamp = SimpleDateFormat("yyyyMMddHHmmss").format(Date())
|
||||
index++
|
||||
})
|
||||
}
|
||||
CallerDevaToolsManager.onReceiveBadCaseRecord(builder.build())
|
||||
}
|
||||
.flowOn(Dispatchers.Default)
|
||||
.collect()
|
||||
delay(TimeUnit.HOURS.toMillis(2))
|
||||
}
|
||||
|
||||
@ExperimentalCoroutinesApi @Test
|
||||
@ExperimentalCoroutinesApi
|
||||
@Test
|
||||
fun showBadCaseEntrance3(): Unit = runBlocking(Dispatchers.Main) {
|
||||
var index = 0
|
||||
(1 until 50)
|
||||
@@ -92,17 +100,19 @@ class AutoPilotBadCaseTest {
|
||||
.asFlow()
|
||||
.onEach {
|
||||
delay(TimeUnit.SECONDS.toMillis(20))
|
||||
CallerDevaToolsManager.onReceiveBadCaseRecord(AutoPilotRecordResult().also {
|
||||
val builder = RecordPanelOuterClass.RecordPanel.newBuilder()
|
||||
builder.also {
|
||||
it.diskFree = (100 + index).toLong()
|
||||
it.duration = 60.0
|
||||
it.fileName = "/user/general/record_$index.log"
|
||||
it.duration = 60.0.toFloat()
|
||||
it.filename = "/user/general/record_$index.log"
|
||||
it.id = 10 + index
|
||||
it.key = "yyy_$index"
|
||||
it.key = index.toLong()
|
||||
it.stat = 100
|
||||
it.type = 1
|
||||
it.timestamp = SimpleDateFormat("yyyyMMddHHmmss").format(Date())
|
||||
index++
|
||||
})
|
||||
}
|
||||
CallerDevaToolsManager.onReceiveBadCaseRecord(builder.build())
|
||||
}
|
||||
.flowOn(Dispatchers.Default)
|
||||
.collect()
|
||||
|
||||
Reference in New Issue
Block a user