54 lines
1.8 KiB
Kotlin
54 lines
1.8 KiB
Kotlin
//package com.mogo.functions.test
|
|
//
|
|
//import android.os.Debug
|
|
//import androidx.test.core.app.ActivityScenario
|
|
//import androidx.test.ext.junit.runners.AndroidJUnit4
|
|
//import androidx.test.filters.LargeTest
|
|
//import com.mogo.eagle.core.function.main.MainLauncherActivity
|
|
//import io.reactivex.Flowable
|
|
//import io.reactivex.plugins.RxJavaPlugins
|
|
//import io.reactivex.schedulers.Schedulers
|
|
//import kotlinx.coroutines.Dispatchers
|
|
//import kotlinx.coroutines.delay
|
|
//import kotlinx.coroutines.runBlocking
|
|
//import org.junit.Before
|
|
//import org.junit.Test
|
|
//import org.junit.runner.RunWith
|
|
//import java.text.SimpleDateFormat
|
|
//import java.util.*
|
|
//import java.util.concurrent.TimeUnit
|
|
//import java.util.concurrent.TimeUnit.MILLISECONDS
|
|
//
|
|
//@RunWith(AndroidJUnit4::class)
|
|
//@LargeTest
|
|
//class RxJavaBackPressureTest {
|
|
//
|
|
// lateinit var launch: ActivityScenario<MainLauncherActivity>
|
|
//
|
|
// @Before
|
|
// fun before() {
|
|
// launch = ActivityScenario.launch(MainLauncherActivity::class.java)
|
|
// RxJavaPlugins.setErrorHandler {
|
|
// }
|
|
// }
|
|
//
|
|
// @Test
|
|
// fun testIntervalBackPressure() = runBlocking(Dispatchers.Default) {
|
|
// val subscription = Flowable.interval(50, MILLISECONDS).doOnNext {
|
|
// }.subscribeOn(Schedulers.computation()).observeOn(Schedulers.io()).subscribe {
|
|
// Thread.sleep(2000)
|
|
// }
|
|
// repeat(10) {
|
|
// delay(TimeUnit.SECONDS.toMillis(5))
|
|
// try {
|
|
// Debug.dumpHprofData(Date().toFileName())
|
|
// } catch (t: Throwable) {
|
|
// t.printStackTrace()
|
|
// }
|
|
// }
|
|
// delay(TimeUnit.HOURS.toMillis(1))
|
|
// subscription.dispose()
|
|
// }
|
|
//
|
|
// private fun Date.toFileName(): String = SimpleDateFormat("yyyyMMdd_HH_mm_ss", Locale.getDefault()).format(this) + ".hprof"
|
|
//} |