FileDocCategorySizeDatePackage
WebViewFlingTest.javaAPI DocAndroid 5.1 API4304Thu Mar 12 22:22:56 GMT 2015com.android.webview.chromium.tests.jank

WebViewFlingTest

public class WebViewFlingTest extends android.support.test.jank.JankTestBase
Jank test for Android Webview. To run 1) Install the test application (com.android.webview.chromium.shell) 2) Place a directories containing the test pages on the test device in $EXTERNAL_STORAGE/AwJankPages. Each directory should contain an index.html file as the main file of the test page. 3) Build this test and install the resulting apk file 4) Run the test using the command: adb shell am instrument -e Url URL -w \ com.android.webview.chromium.tests.jank/android.test.InstrumentationTestRunner

Fields Summary
private static final long
TEST_DELAY_TIME_MS
private static final long
PAGE_LOAD_DELAY_TIMEOUT_MS
private static final long
PAGE_LOAD_DELAY_TIME_MS
private static final int
MIN_DATA_SIZE
private static final long
DEFAULT_ANIMATION_TIME
private static final String
CHROMIUM_SHELL_APP
private static final String
CHROMIUM_SHELL_ACTIVITY
private static final String
AW_CONTAINER
private android.support.test.uiautomator.UiDevice
mDevice
private android.support.test.uiautomator.UiScrollable
mWebPageDisplay
Constructors Summary
Methods Summary
public voidbeforeLoop()

        getContainer().flingToBeginning(20);
        SystemClock.sleep(TEST_DELAY_TIME_MS);
    
private android.support.test.uiautomator.UiScrollablegetContainer()

        if (mWebPageDisplay == null) {
            mWebPageDisplay =
                    new UiScrollable(new UiSelector().resourceId(AW_CONTAINER).instance(0));
            assertTrue("Failed to get web container",
                mWebPageDisplay.waitForExists(PAGE_LOAD_DELAY_TIMEOUT_MS));
        }
        return mWebPageDisplay;
    
protected voidsetUp()
{@inheritDoc}



         
    
         
        super.setUp();

        mDevice = UiDevice.getInstance(getInstrumentation());
        mDevice.setOrientationNatural();

        // Get the URL argument
        String url = getArguments().getString("Url");
        File webpage = new File(url);
        assertNotNull("No test pages", webpage);

        // Launch the chromium shell
        Intent intent = new Intent(Intent.ACTION_DEFAULT,
                Uri.parse("file://" + webpage.getAbsolutePath()));
        intent.setClassName(CHROMIUM_SHELL_APP, CHROMIUM_SHELL_ACTIVITY);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        getInstrumentation().getContext().startActivity(intent);
        SystemClock.sleep(PAGE_LOAD_DELAY_TIME_MS);
    
protected voidtearDown()
{@inheritDoc}

        mDevice.unfreezeRotation();
        super.tearDown();
    
public voidtestBrowserPageFling()

        getContainer().flingForward();
        SystemClock.sleep(DEFAULT_ANIMATION_TIME);