diff options
author | Gopinath <gelanchezhian@google.com> | 2015-09-17 21:46:46 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-09-17 21:46:46 +0000 |
commit | 79de7db6f3e5402f51d72a5db1e8501e5eb8de84 (patch) | |
tree | 7f7dab6d040ba564f2df2d3ad5ad827b7b802a8c | |
parent | a0a27122b9210f40160baeca5b10f3ede7629c44 (diff) | |
parent | fe6f813b454832df8e2551ebf5b856834ac7bbe9 (diff) | |
download | platform_testing-marshmallow-mr3-release.tar.gz |
am fe6f813b: Power jank for Systemappandroid-n-preview-1android-6.0.1_r9android-6.0.1_r81android-6.0.1_r80android-6.0.1_r8android-6.0.1_r79android-6.0.1_r78android-6.0.1_r77android-6.0.1_r74android-6.0.1_r73android-6.0.1_r72android-6.0.1_r70android-6.0.1_r7android-6.0.1_r69android-6.0.1_r66android-6.0.1_r65android-6.0.1_r61android-6.0.1_r60android-6.0.1_r59android-6.0.1_r58android-6.0.1_r57android-6.0.1_r56android-6.0.1_r52android-6.0.1_r51android-6.0.1_r50android-6.0.1_r49android-6.0.1_r48android-6.0.1_r47android-6.0.1_r46android-6.0.1_r43android-6.0.1_r42android-6.0.1_r41android-6.0.1_r40android-6.0.1_r30android-6.0.1_r3android-6.0.1_r28android-6.0.1_r27android-6.0.1_r26android-6.0.1_r20android-6.0.1_r17android-6.0.1_r13android-6.0.1_r12android-6.0.1_r11android-6.0.1_r10android-6.0.1_r1android-6.0.0_r41marshmallow-mr3-releasemarshmallow-mr2-releasemarshmallow-mr1-releasemarshmallow-mr1-devmarshmallow-dr-dev
* commit 'fe6f813b454832df8e2551ebf5b856834ac7bbe9':
Power jank for Systemapp
8 files changed, 170 insertions, 26 deletions
diff --git a/tests/jank/sysapp/Android.mk b/tests/jank/sysapp/Android.mk index 2ba588dbc..b84bc10d0 100644 --- a/tests/jank/sysapp/Android.mk +++ b/tests/jank/sysapp/Android.mk @@ -19,7 +19,7 @@ LOCAL_PACKAGE_NAME := SystemAppJankTests LOCAL_SRC_FILES := $(call all-java-files-under, src) LOCAL_MODULE_TAGS := tests -LOCAL_STATIC_JAVA_LIBRARIES := ub-uiautomator ub-janktesthelper +LOCAL_STATIC_JAVA_LIBRARIES := ub-uiautomator ub-janktesthelper timeresult-helper-lib LOCAK_SDK_VERSION := current diff --git a/tests/jank/sysapp/AndroidManifest.xml b/tests/jank/sysapp/AndroidManifest.xml index c4b2fbc7a..1f41c845c 100644 --- a/tests/jank/sysapp/AndroidManifest.xml +++ b/tests/jank/sysapp/AndroidManifest.xml @@ -17,7 +17,8 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.sysapp.janktests"> - <uses-sdk android:minSdkVersion="23" /> + <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="23" /> + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_CONTACTS" /> <application> diff --git a/tests/jank/sysapp/src/com/android/sysapp/janktests/BooksJankTests.java b/tests/jank/sysapp/src/com/android/sysapp/janktests/BooksJankTests.java index 5268e3f5f..a97e2179a 100644 --- a/tests/jank/sysapp/src/com/android/sysapp/janktests/BooksJankTests.java +++ b/tests/jank/sysapp/src/com/android/sysapp/janktests/BooksJankTests.java @@ -16,8 +16,13 @@ package com.android.sysapp.janktests; +import java.io.File; +import java.io.IOException; + import android.content.Intent; import android.content.pm.PackageManager; +import android.os.Bundle; +import android.os.Environment; import android.os.RemoteException; import android.os.SystemClock; import android.support.test.jank.GfxMonitor; @@ -31,8 +36,8 @@ import android.support.test.uiautomator.UiObjectNotFoundException; import android.support.test.uiautomator.Until; import android.widget.Button; import android.widget.ProgressBar; - import junit.framework.Assert; +import android.support.test.timeresulthelper.TimeResultLogger; /** * Jank test for Books app recommendation page fling @@ -45,6 +50,10 @@ public class BooksJankTests extends JankTestBase { private static final int EXPECTED_FRAMES = 100; private static final String PACKAGE_NAME = "com.google.android.apps.books"; private UiDevice mDevice; + private static final File TIMESTAMP_FILE = new File(Environment.getExternalStorageDirectory() + .getAbsolutePath(), "autotester.log"); + private static final File RESULTS_FILE = new File(Environment.getExternalStorageDirectory() + .getAbsolutePath(), "results.log"); @Override public void setUp() throws Exception { @@ -71,15 +80,26 @@ public class BooksJankTests extends JankTestBase { SystemClock.sleep(SHORT_TIMEOUT); } - public void launchBooks () throws UiObjectNotFoundException { + public void launchBooks () throws UiObjectNotFoundException, IOException { launchApp(PACKAGE_NAME); dismissClings(); openMyLibrary(); Assert.assertTrue("Books haven't loaded yet", getNumberOfVisibleBooks() > 3); + TimeResultLogger.writeTimeStampLogStart(String.format("%s-%s", + getClass().getSimpleName(), getName()), TIMESTAMP_FILE); + } + + public void afterTestBooksRecommendationPageFling(Bundle metrics) throws IOException { + TimeResultLogger.writeTimeStampLogEnd(String.format("%s-%s", + getClass().getSimpleName(), getName()), TIMESTAMP_FILE); + TimeResultLogger.writeResultToFile(String.format("%s-%s", + getClass().getSimpleName(), getName()), RESULTS_FILE, metrics); + super.afterTest(metrics); } // Measures jank while fling books mylibrary - @JankTest(beforeTest="launchBooks", expectedFrames=EXPECTED_FRAMES) + @JankTest(beforeTest="launchBooks", expectedFrames=EXPECTED_FRAMES, + afterTest="afterTestBooksRecommendationPageFling") @GfxMonitor(processName=PACKAGE_NAME) // Books is not a system app anymore public void doNotRun_BooksRecommendationPageFling() { diff --git a/tests/jank/sysapp/src/com/android/sysapp/janktests/CalendarJankTests.java b/tests/jank/sysapp/src/com/android/sysapp/janktests/CalendarJankTests.java index 21756b9cd..253a82a6e 100644 --- a/tests/jank/sysapp/src/com/android/sysapp/janktests/CalendarJankTests.java +++ b/tests/jank/sysapp/src/com/android/sysapp/janktests/CalendarJankTests.java @@ -16,8 +16,13 @@ package com.android.sysapp.janktests; +import java.io.File; +import java.io.IOException; + import android.content.Intent; import android.content.pm.PackageManager; +import android.os.Bundle; +import android.os.Environment; import android.os.RemoteException; import android.os.SystemClock; import android.support.test.jank.GfxMonitor; @@ -32,8 +37,8 @@ import android.support.test.uiautomator.UiObject2; import android.support.test.uiautomator.UiObjectNotFoundException; import android.support.test.uiautomator.Until; import android.view.View; - import junit.framework.Assert; +import android.support.test.timeresulthelper.TimeResultLogger; /** * Jank test for Calendar @@ -50,6 +55,10 @@ public class CalendarJankTests extends JankTestBase { private static final String PACKAGE_NAME = "com.google.android.calendar"; private static final String RES_PACKAGE_NAME = "com.android.calendar"; private UiDevice mDevice; + private static final File TIMESTAMP_FILE = new File(Environment.getExternalStorageDirectory() + .getAbsolutePath(), "autotester.log"); + private static final File RESULTS_FILE = new File(Environment.getExternalStorageDirectory() + .getAbsolutePath(), "results.log"); private BySelector mCalendarSelector = null; private Direction mScrollDirection = null; @@ -82,16 +91,27 @@ public class CalendarJankTests extends JankTestBase { SystemClock.sleep(SHORT_TIMEOUT * 10); } - public void launchCalendar () throws UiObjectNotFoundException { + public void launchCalendar() throws UiObjectNotFoundException, IOException { launchApp(PACKAGE_NAME); mDevice.waitForIdle(); dismissCling(); assertNotNull("Calendar can't be found", mDevice.wait(Until.findObject(mCalendarSelector), LONG_TIMEOUT)); + TimeResultLogger.writeTimeStampLogStart(String.format("%s-%s", + getClass().getSimpleName(), getName()), TIMESTAMP_FILE); + } + + public void afterTestCalendarItemsFling(Bundle metrics) throws IOException { + TimeResultLogger.writeTimeStampLogEnd(String.format("%s-%s", + getClass().getSimpleName(), getName()), TIMESTAMP_FILE); + TimeResultLogger.writeResultToFile(String.format("%s-%s", + getClass().getSimpleName(), getName()), RESULTS_FILE, metrics); + super.afterTest(metrics); } // Measures jank of flinging calendar items - @JankTest(beforeTest="launchCalendar", expectedFrames=EXPECTED_FRAMES) + @JankTest(beforeTest="launchCalendar", expectedFrames=EXPECTED_FRAMES, + afterTest="afterTestCalendarItemsFling") @GfxMonitor(processName=PACKAGE_NAME) public void testCalendarItemsFling() { UiObject2 calendarItems = null; @@ -104,7 +124,7 @@ public class CalendarJankTests extends JankTestBase { private void dismissCling() { UiObject2 splashScreen = null; - splashScreen = mDevice.wait(Until.findObject( + splashScreen = mDevice.wait(Until.findObject( By.pkg(PACKAGE_NAME).clazz(View.class).desc("Got it")), LONG_TIMEOUT); if (splashScreen != null) { splashScreen.clickAndWait(Until.newWindow(), SHORT_TIMEOUT); diff --git a/tests/jank/sysapp/src/com/android/sysapp/janktests/ChromeJankTests.java b/tests/jank/sysapp/src/com/android/sysapp/janktests/ChromeJankTests.java index f70cc0dee..3659dda58 100644 --- a/tests/jank/sysapp/src/com/android/sysapp/janktests/ChromeJankTests.java +++ b/tests/jank/sysapp/src/com/android/sysapp/janktests/ChromeJankTests.java @@ -16,8 +16,13 @@ package com.android.sysapp.janktests; +import java.io.File; +import java.io.IOException; + import android.content.Intent; import android.content.pm.PackageManager; +import android.os.Bundle; +import android.os.Environment; import android.os.RemoteException; import android.os.SystemClock; import android.support.test.jank.GfxMonitor; @@ -30,8 +35,8 @@ import android.support.test.uiautomator.UiDevice; import android.support.test.uiautomator.UiObject2; import android.support.test.uiautomator.UiObjectNotFoundException; import android.support.test.uiautomator.Until; - import junit.framework.Assert; +import android.support.test.timeresulthelper.TimeResultLogger; /** * Jank test for Chorme apps @@ -45,6 +50,10 @@ public class ChromeJankTests extends JankTestBase { private static final int EXPECTED_FRAMES = 100; private static final String PACKAGE_NAME = "com.android.chrome"; private UiDevice mDevice; + private static final File TIMESTAMP_FILE = new File(Environment.getExternalStorageDirectory() + .getAbsolutePath(), "autotester.log"); + private static final File RESULTS_FILE = new File(Environment.getExternalStorageDirectory() + .getAbsolutePath(), "results.log"); @Override public void setUp() throws Exception { @@ -71,13 +80,24 @@ public class ChromeJankTests extends JankTestBase { SystemClock.sleep(SHORT_TIMEOUT); } - public void launchChrome() throws UiObjectNotFoundException{ + public void launchChrome() throws UiObjectNotFoundException, IOException{ launchApp(PACKAGE_NAME); getOverflowMenu(); + TimeResultLogger.writeTimeStampLogStart(String.format("%s-%s", + getClass().getSimpleName(), getName()), TIMESTAMP_FILE); + } + + public void afterTestChromeOverflowMenuTap(Bundle metrics) throws IOException { + TimeResultLogger.writeTimeStampLogEnd(String.format("%s-%s", + getClass().getSimpleName(), getName()), TIMESTAMP_FILE); + TimeResultLogger.writeResultToFile(String.format("%s-%s", + getClass().getSimpleName(), getName()), RESULTS_FILE, metrics); + super.afterTest(metrics); } // Measures jank window render for overflow menu tap - @JankTest(beforeTest="launchChrome", expectedFrames=EXPECTED_FRAMES) + @JankTest(beforeTest="launchChrome", expectedFrames=EXPECTED_FRAMES, + afterTest="afterTestChromeOverflowMenuTap") @GfxMonitor(processName=PACKAGE_NAME) public void testChromeOverflowMenuTap() { for (int i = 0; i < INNER_LOOP; i++) { diff --git a/tests/jank/sysapp/src/com/android/sysapp/janktests/ContactsJankTests.java b/tests/jank/sysapp/src/com/android/sysapp/janktests/ContactsJankTests.java index c83de698f..1d7be9b0e 100644 --- a/tests/jank/sysapp/src/com/android/sysapp/janktests/ContactsJankTests.java +++ b/tests/jank/sysapp/src/com/android/sysapp/janktests/ContactsJankTests.java @@ -16,9 +16,14 @@ package com.android.sysapp.janktests; +import java.io.File; +import java.io.IOException; + import android.content.Intent; import android.content.pm.PackageManager; import android.database.Cursor; +import android.os.Bundle; +import android.os.Environment; import android.os.RemoteException; import android.os.SystemClock; import android.provider.ContactsContract; @@ -34,8 +39,8 @@ import android.support.test.uiautomator.UiObject2; import android.support.test.uiautomator.UiObjectNotFoundException; import android.support.test.uiautomator.Until; import android.widget.TextView; - import junit.framework.Assert; +import android.support.test.timeresulthelper.TimeResultLogger; /** * Jank test for Contacts @@ -52,6 +57,10 @@ public class ContactsJankTests extends JankTestBase { private static final String RES_PACKAGE_NAME = "com.android.contacts"; private static final String PM_PACKAGE_NAME = "com.android.packageinstaller"; private UiDevice mDevice; + private static final File TIMESTAMP_FILE = new File(Environment.getExternalStorageDirectory() + .getAbsolutePath(), "autotester.log"); + private static final File RESULTS_FILE = new File(Environment.getExternalStorageDirectory() + .getAbsolutePath(), "results.log"); @Override public void setUp() throws Exception { @@ -74,7 +83,7 @@ public class ContactsJankTests extends JankTestBase { SystemClock.sleep(SHORT_TIMEOUT); } - public void launchContacts () throws UiObjectNotFoundException { + public void launchContacts () throws UiObjectNotFoundException, IOException { launchApp(PACKAGE_NAME); mDevice.waitForIdle(); // To infer that test is ready to be executed @@ -85,10 +94,21 @@ public class ContactsJankTests extends JankTestBase { Cursor cursor = getInstrumentation().getContext().getContentResolver().query( ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, null, null, null); Assert.assertTrue("There are not enough contacts", cursor.getCount() > MIN_CONTACT_COUNT); + TimeResultLogger.writeTimeStampLogStart(String.format("%s-%s", + getClass().getSimpleName(), getName()), TIMESTAMP_FILE); + } + + public void afterTestAllContactsFling(Bundle metrics) throws IOException { + TimeResultLogger.writeTimeStampLogEnd(String.format("%s-%s", + getClass().getSimpleName(), getName()), TIMESTAMP_FILE); + TimeResultLogger.writeResultToFile(String.format("%s-%s", + getClass().getSimpleName(), getName()), RESULTS_FILE, metrics); + super.afterTest(metrics); } // Measures jank while flinging contacts list - @JankTest(beforeTest="launchContacts", expectedFrames=EXPECTED_FRAMES) + @JankTest(beforeTest="launchContacts", expectedFrames=EXPECTED_FRAMES, + afterTest="afterTestAllContactsFling") @GfxMonitor(processName=PACKAGE_NAME) public void testAllContactsFling() { UiObject2 contactList = null; @@ -101,4 +121,4 @@ public class ContactsJankTests extends JankTestBase { SystemClock.sleep(100); } } -}
\ No newline at end of file +} diff --git a/tests/jank/sysapp/src/com/android/sysapp/janktests/GMailJankTests.java b/tests/jank/sysapp/src/com/android/sysapp/janktests/GMailJankTests.java index 801ed4863..4a5e96cbb 100644 --- a/tests/jank/sysapp/src/com/android/sysapp/janktests/GMailJankTests.java +++ b/tests/jank/sysapp/src/com/android/sysapp/janktests/GMailJankTests.java @@ -16,8 +16,13 @@ package com.android.sysapp.janktests; +import java.io.File; +import java.io.IOException; + import android.content.Intent; import android.content.pm.PackageManager; +import android.os.Bundle; +import android.os.Environment; import android.os.RemoteException; import android.os.SystemClock; import android.support.test.jank.GfxMonitor; @@ -32,8 +37,8 @@ import android.support.test.uiautomator.UiObject2; import android.support.test.uiautomator.UiObjectNotFoundException; import android.support.test.uiautomator.Until; import android.widget.ImageButton; - import junit.framework.Assert; +import android.support.test.timeresulthelper.TimeResultLogger; /** * Jank test for scrolling gmail inbox mails @@ -48,6 +53,10 @@ public class GMailJankTests extends JankTestBase { private static final String PACKAGE_NAME = "com.google.android.gm"; private static final String RES_PACKAGE_NAME = "android"; private UiDevice mDevice; + private static final File TIMESTAMP_FILE = new File(Environment.getExternalStorageDirectory() + .getAbsolutePath(), "autotester.log"); + private static final File RESULTS_FILE = new File(Environment.getExternalStorageDirectory() + .getAbsolutePath(), "results.log"); @Override public void setUp() throws Exception { @@ -77,16 +86,27 @@ public class GMailJankTests extends JankTestBase { waitForEmailSync(); } - public void prepGMailInboxFling() throws UiObjectNotFoundException { + public void prepGMailInboxFling() throws UiObjectNotFoundException, IOException { launchGMail(); // Ensure test is ready to be executed UiObject2 list = mDevice.wait( Until.findObject(By.res(PACKAGE_NAME, "conversation_list_view")), SHORT_TIMEOUT); Assert.assertNotNull("Failed to locate 'conversation_list_view'", list); + TimeResultLogger.writeTimeStampLogStart(String.format("%s-%s", + getClass().getSimpleName(), getName()), TIMESTAMP_FILE); + } + + public void afterTestGMailInboxFling(Bundle metrics) throws IOException { + TimeResultLogger.writeTimeStampLogEnd(String.format("%s-%s", + getClass().getSimpleName(), getName()), TIMESTAMP_FILE); + TimeResultLogger.writeResultToFile(String.format("%s-%s", + getClass().getSimpleName(), getName()), RESULTS_FILE, metrics); + super.afterTest(metrics); } // Measures jank while scrolling gmail inbox - @JankTest(beforeTest="prepGMailInboxFling", expectedFrames=EXPECTED_FRAMES) + @JankTest(beforeTest="prepGMailInboxFling", expectedFrames=EXPECTED_FRAMES, + afterTest="afterTestGMailInboxFling") @GfxMonitor(processName=PACKAGE_NAME) public void testGMailInboxFling() { UiObject2 list = mDevice.wait( @@ -100,14 +120,25 @@ public class GMailJankTests extends JankTestBase { } } - public void prepOpenNavDrawer() throws UiObjectNotFoundException { + public void prepOpenNavDrawer() throws UiObjectNotFoundException, IOException { launchGMail(); // Ensure test is ready to be executed Assert.assertNotNull("Failed to locate Nav Drawer Openner", openNavigationDrawer()); + TimeResultLogger.writeTimeStampLogStart(String.format("%s-%s", + getClass().getSimpleName(), getName()), TIMESTAMP_FILE); + } + + public void afterTestOpenNavDrawer(Bundle metrics) throws IOException { + TimeResultLogger.writeTimeStampLogEnd(String.format("%s-%s", + getClass().getSimpleName(), getName()), TIMESTAMP_FILE); + TimeResultLogger.writeResultToFile(String.format("%s-%s", + getClass().getSimpleName(), getName()), RESULTS_FILE, metrics); + super.afterTest(metrics); } // Measures jank while opening Navigation Drawer - @JankTest(beforeTest="prepOpenNavDrawer", expectedFrames=EXPECTED_FRAMES) + @JankTest(beforeTest="prepOpenNavDrawer", expectedFrames=EXPECTED_FRAMES, + afterTest="afterTestOpenNavDrawer") @GfxMonitor(processName=PACKAGE_NAME) public void testOpenNavDrawer() { UiObject2 navDrawer = openNavigationDrawer(); @@ -119,7 +150,7 @@ public class GMailJankTests extends JankTestBase { } } - public void prepFlingNavDrawer() throws UiObjectNotFoundException{ + public void prepFlingNavDrawer() throws UiObjectNotFoundException, IOException{ launchGMail(); UiObject2 navDrawer = openNavigationDrawer(); Assert.assertNotNull("Failed to locate Nav Drawer Openner", navDrawer); @@ -127,10 +158,21 @@ public class GMailJankTests extends JankTestBase { // Ensure test is ready to be executed UiObject2 container = getNavigationDrawerContainer(); Assert.assertNotNull("Failed to locate Nav drawer container", container); + TimeResultLogger.writeTimeStampLogStart(String.format("%s-%s", + getClass().getSimpleName(), getName()), TIMESTAMP_FILE); + } + + public void afterTestFlingNavDrawer(Bundle metrics) throws IOException { + TimeResultLogger.writeTimeStampLogEnd(String.format("%s-%s", + getClass().getSimpleName(), getName()), TIMESTAMP_FILE); + TimeResultLogger.writeResultToFile(String.format("%s-%s", + getClass().getSimpleName(), getName()), RESULTS_FILE, metrics); + super.afterTest(metrics); } // Measures jank while flinging Navigation Drawer - @JankTest(beforeTest="prepFlingNavDrawer", expectedFrames=EXPECTED_FRAMES) + @JankTest(beforeTest="prepFlingNavDrawer", expectedFrames=EXPECTED_FRAMES, + afterTest="afterTestFlingNavDrawer") @GfxMonitor(processName=PACKAGE_NAME) public void testFlingNavDrawer() { UiObject2 container = getNavigationDrawerContainer(); @@ -198,4 +240,4 @@ public class GMailJankTests extends JankTestBase { } return container; } -}
\ No newline at end of file +} diff --git a/tests/jank/sysapp/src/com/android/sysapp/janktests/YouTubeJankTests.java b/tests/jank/sysapp/src/com/android/sysapp/janktests/YouTubeJankTests.java index a1a004e31..d0614d4ec 100644 --- a/tests/jank/sysapp/src/com/android/sysapp/janktests/YouTubeJankTests.java +++ b/tests/jank/sysapp/src/com/android/sysapp/janktests/YouTubeJankTests.java @@ -16,8 +16,13 @@ package com.android.sysapp.janktests; +import java.io.File; +import java.io.IOException; + import android.content.Intent; import android.content.pm.PackageManager; +import android.os.Bundle; +import android.os.Environment; import android.os.RemoteException; import android.os.SystemClock; import android.support.test.jank.GfxMonitor; @@ -30,6 +35,7 @@ import android.support.test.uiautomator.UiObject2; import android.support.test.uiautomator.UiObjectNotFoundException; import android.support.test.uiautomator.Until; import junit.framework.Assert; +import android.support.test.timeresulthelper.TimeResultLogger; /** * Jank test for YouTube recommendation window fling 3 times. @@ -41,6 +47,10 @@ public class YouTubeJankTests extends JankTestBase { private static final int INNER_LOOP = 5; private static final int EXPECTED_FRAMES = 100; private static final String PACKAGE_NAME = "com.google.android.youtube"; + private static final File TIMESTAMP_FILE = new File(Environment.getExternalStorageDirectory() + .getAbsolutePath(), "autotester.log"); + private static final File RESULTS_FILE = new File(Environment.getExternalStorageDirectory() + .getAbsolutePath(), "results.log"); private UiDevice mDevice; @@ -69,16 +79,27 @@ public class YouTubeJankTests extends JankTestBase { SystemClock.sleep(SHORT_TIMEOUT); } - public void launchYouTube () throws UiObjectNotFoundException { + public void launchYouTube () throws UiObjectNotFoundException, IOException { launchApp(PACKAGE_NAME); dismissCling(); UiObject2 uiObject = mDevice.wait( Until.findObject(By.res(PACKAGE_NAME, "pane_fragment_container")), LONG_TIMEOUT); Assert.assertNotNull("Recommendation container is null", uiObject); + TimeResultLogger.writeTimeStampLogStart(String.format("%s-%s", + getClass().getSimpleName(), getName()), TIMESTAMP_FILE); + } + + public void afterTestYouTubeRecomendation(Bundle metrics) throws IOException { + TimeResultLogger.writeTimeStampLogEnd(String.format("%s-%s", + getClass().getSimpleName(), getName()), TIMESTAMP_FILE); + TimeResultLogger.writeResultToFile(String.format("%s-%s", + getClass().getSimpleName(), getName()), RESULTS_FILE, metrics); + super.afterTest(metrics); } // Measures jank while fling YouTube recommendation - @JankTest(beforeTest="launchYouTube", expectedFrames=EXPECTED_FRAMES) + @JankTest(beforeTest="launchYouTube", expectedFrames=EXPECTED_FRAMES, + afterTest="afterTestYouTubeRecomendation") @GfxMonitor(processName=PACKAGE_NAME) public void testYouTubeRecomendationWindowFling() { UiObject2 uiObject = mDevice.wait( |