SHARE
TWEET

Untitled

a guest Apr 22nd, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class SecondTest : JankTestBase() {
  2.  
  3.     private lateinit var device: UiDevice
  4.  
  5.     @Throws(Exception::class)
  6.     public override fun setUp() {
  7.         super.setUp()
  8.         device = UiDevice.getInstance(instrumentation)
  9.     }
  10.  
  11.     private fun launchApp(packageName: String) {
  12.         val pm = instrumentation.context.packageManager
  13.         val appIntent = pm.getLaunchIntentForPackage(packageName)
  14.         appIntent!!.flags = Intent.FLAG_ACTIVITY_NEW_TASK
  15.         instrumentation.context.startActivity(appIntent)
  16.     }
  17.  
  18.     @Throws(OperationApplicationException::class, RemoteException::class)
  19.     fun launchApp() {
  20.         launchApp(PACKAGE_NAME)
  21.         device.waitForIdle()
  22.     }
  23.  
  24.     @JankTest(
  25.         beforeTest = "launchApp",
  26.         expectedFrames = EXPECTED_FRAMES,
  27.         defaultIterationCount = 1
  28.     )
  29.     @GfxMonitor(processName = PACKAGE_NAME)
  30.     fun testSecond() {
  31.         for (i in 0 until INNER_LOOP) {
  32.             val appViews = UiScrollable(UiSelector().scrollable(true))
  33.             appViews.setAsVerticalList()
  34.             appViews.scrollTextIntoView("This is item 24")
  35.             appViews.scrollTextIntoView("This is item 1")
  36.         }
  37.         SystemClock.sleep(200)
  38.     }
  39.  
  40.     companion object {
  41.         private const val INNER_LOOP = 2
  42.         private const val EXPECTED_FRAMES = 450
  43.         private const val PACKAGE_NAME = "com.marcosholgado.performancetest"
  44.     }
  45. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top