| Index: android_webview/tools/PageCycler/src/org/chromium/webview_shell/test/PageCyclerTest.java
|
| diff --git a/android_webview/tools/PageCycler/src/org/chromium/webview_shell/test/PageCyclerTest.java b/android_webview/tools/PageCycler/src/org/chromium/webview_shell/test/PageCyclerTest.java
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..2c0c438a7d3fe4b83f9086eb28d6177761ba219b
|
| --- /dev/null
|
| +++ b/android_webview/tools/PageCycler/src/org/chromium/webview_shell/test/PageCyclerTest.java
|
| @@ -0,0 +1,104 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +package org.chromium.webview_shell.test;
|
| +
|
| +import android.test.ActivityInstrumentationTestCase2;
|
| +import android.test.suitebuilder.annotation.LargeTest;
|
| +
|
| +import org.chromium.base.test.util.Restriction;
|
| +import org.chromium.webview_shell.shell.PageCyclerTestActivity;
|
| +
|
| +import java.util.concurrent.TimeUnit;
|
| +
|
| +/**
|
| + * Tests running on bots with internet connection to load popular urls,
|
| + * making sure webview doesn't crash
|
| + */
|
| +public class PageCyclerTest
|
| + extends ActivityInstrumentationTestCase2<PageCyclerTestActivity> {
|
| +
|
| + private static final long TIMEOUT_IN_SECS = 20;
|
| +
|
| + private PageCyclerTestActivity mTestActivity;
|
| +
|
| + public PageCyclerTest() {
|
| + super(PageCyclerTestActivity.class);
|
| + }
|
| +
|
| + @Override
|
| + protected void setUp() throws Exception {
|
| + super.setUp();
|
| + mTestActivity = (PageCyclerTestActivity) getActivity();
|
| + }
|
| +
|
| + @Override
|
| + protected void tearDown() throws Exception {
|
| + mTestActivity.finish();
|
| + super.tearDown();
|
| + }
|
| +
|
| + @LargeTest
|
| + @Restriction(Restriction.RESTRICTION_TYPE_INTERNET)
|
| + public void testVisitGoogleCom() throws Throwable {
|
| + //TODO(yolandyan@): verify the page
|
| + visitUrlSync("http://google.com");
|
| + }
|
| +
|
| + @LargeTest
|
| + @Restriction(Restriction.RESTRICTION_TYPE_INTERNET)
|
| + public void testVisitFacebookCom() throws Throwable {
|
| + visitUrlSync("http://facebook.com");
|
| + }
|
| +
|
| + @LargeTest
|
| + @Restriction(Restriction.RESTRICTION_TYPE_INTERNET)
|
| + public void testVisitWikipediaOrg() throws Throwable {
|
| + visitUrlSync("http://wikipedia.org");
|
| + }
|
| +
|
| + @LargeTest
|
| + @Restriction(Restriction.RESTRICTION_TYPE_INTERNET)
|
| + public void testVisitAmazonCom() throws Throwable {
|
| + visitUrlSync("http://amazon.com");
|
| + }
|
| +
|
| + @LargeTest
|
| + @Restriction(Restriction.RESTRICTION_TYPE_INTERNET)
|
| + public void testVisitYoutubeCom() throws Throwable {
|
| + visitUrlSync("http://youtube.com");
|
| + }
|
| +
|
| + @LargeTest
|
| + @Restriction(Restriction.RESTRICTION_TYPE_INTERNET)
|
| + public void testVisitYahooCom() throws Throwable {
|
| + visitUrlSync("http://yahoo.com");
|
| + }
|
| +
|
| + @LargeTest
|
| + @Restriction(Restriction.RESTRICTION_TYPE_INTERNET)
|
| + public void testVisitEbayCom() throws Throwable {
|
| + visitUrlSync("http://ebay.com");
|
| + }
|
| +
|
| + @LargeTest
|
| + @Restriction(Restriction.RESTRICTION_TYPE_INTERNET)
|
| + public void testVisitRedditCom() throws Throwable {
|
| + visitUrlSync("http://reddit.com");
|
| + }
|
| +
|
| + private void visitUrlAsync(final String url) throws Throwable {
|
| + getInstrumentation().runOnMainSync(new Runnable() {
|
| + @Override
|
| + public void run() {
|
| + mTestActivity.loadUrl(url);
|
| + }
|
| + });
|
| + }
|
| +
|
| + private void visitUrlSync(final String url) throws Throwable {
|
| + visitUrlAsync(url);
|
| + mTestActivity.waitForPageLoad(TIMEOUT_IN_SECS, TimeUnit.SECONDS);
|
| + }
|
| +}
|
|
|