This commit is contained in:
zhongchao
2022-03-15 12:22:34 +08:00
1568 changed files with 13876 additions and 72455 deletions

View File

@@ -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()

View File

@@ -13,6 +13,7 @@
android:label="@string/app_shell_name"
android:largeHeap="true"
android:resizeableActivity="false"
android:usesCleartextTraffic="true"
android:supportsRtl="true"
android:theme="@style/AppTheme.App"
tools:replace="android:label">

View File

@@ -40,7 +40,7 @@ public class MogoApplication extends MainMoGoApplication {
@Override
protected void initCloudClientConfig() {
// todo 使用旧Socket链路 true = 旧链路false = 新链路
// 使用旧Socket链路 true = 旧链路false = 新链路
if (DebugConfig.getProductFlavor().equals("fPadLenovoOchTaxi")
|| DebugConfig.getProductFlavor().equals("fPadLenovoOchBus")
|| DebugConfig.getProductFlavor().equals("fPadLenovoOchTaxiPassenger")