Commit f3011886 authored by mckev@amazon.com's avatar mckev@amazon.com

Improve Android Test Size Annotation support in test_runner.py

- Add explicit support for EnormousTest
- Warn at runtime if a test size annotation isn't recognized
  (see: http://www.chromium.org/developers/testing/android-tests)
- Remove EnormousTest annotation from a test that wasn't actually using it
  (it was effectively using the SmallTest timeout value at runtime).
- Add SmallTest annotation to InstallerDelegateTest (it was the only
  set of tests that did not include these annotations).

TEST=ChromeShellTest instrumentation tests
BUG=392297

Review URL: https://codereview.chromium.org/376873008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283684 0039d316-1c4b-4281-b951-d872f2087c98
parent 47833e5d
...@@ -319,13 +319,20 @@ class TestRunner(base_test_runner.BaseTestRunner): ...@@ -319,13 +319,20 @@ class TestRunner(base_test_runner.BaseTestRunner):
"""Returns the timeout in seconds for the given |test|.""" """Returns the timeout in seconds for the given |test|."""
annotations = self.test_pkg.GetTestAnnotations(test) annotations = self.test_pkg.GetTestAnnotations(test)
if 'Manual' in annotations: if 'Manual' in annotations:
return 600 * 60 return 10 * 60 * 60
if 'External' in annotations: if 'External' in annotations:
return 10 * 60 return 10 * 60
if 'EnormousTest' in annotations:
return 10 * 60
if 'LargeTest' in annotations or _PERF_TEST_ANNOTATION in annotations: if 'LargeTest' in annotations or _PERF_TEST_ANNOTATION in annotations:
return 5 * 60 return 5 * 60
if 'MediumTest' in annotations: if 'MediumTest' in annotations:
return 3 * 60 return 3 * 60
if 'SmallTest' in annotations:
return 1 * 60
logging.warn(("Test size not found in annotations for test '{0}', using " +
"1 minute for timeout.").format(test))
return 1 * 60 return 1 * 60
def _RunTest(self, test, timeout): def _RunTest(self, test, timeout):
......
...@@ -6,8 +6,8 @@ package org.chromium.chrome.browser; ...@@ -6,8 +6,8 @@ package org.chromium.chrome.browser;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.test.suitebuilder.annotation.MediumTest; import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;
import org.chromium.base.test.util.EnormousTest;
import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Feature;
import org.chromium.chrome.shell.ChromeShellTab; import org.chromium.chrome.shell.ChromeShellTab;
import org.chromium.chrome.shell.ChromeShellTestBase; import org.chromium.chrome.shell.ChromeShellTestBase;
...@@ -78,7 +78,7 @@ public class RepostFormWarningTest extends ChromeShellTestBase { ...@@ -78,7 +78,7 @@ public class RepostFormWarningTest extends ChromeShellTestBase {
* after the "Cancel" button is clicked to verify that the load was not triggered, which blocks * after the "Cancel" button is clicked to verify that the load was not triggered, which blocks
* for CallbackHelper's default timeout upon each execution. * for CallbackHelper's default timeout upon each execution.
*/ */
@EnormousTest @SmallTest
@Feature({"Navigation"}) @Feature({"Navigation"})
public void testFormResubmissionCancel() throws Throwable { public void testFormResubmissionCancel() throws Throwable {
// Load the url posting data for the first time. // Load the url posting data for the first time.
......
...@@ -7,6 +7,7 @@ package org.chromium.chrome.browser.banners; ...@@ -7,6 +7,7 @@ package org.chromium.chrome.browser.banners;
import android.content.pm.PackageInfo; import android.content.pm.PackageInfo;
import android.os.HandlerThread; import android.os.HandlerThread;
import android.test.mock.MockPackageManager; import android.test.mock.MockPackageManager;
import android.test.suitebuilder.annotation.SmallTest;
import org.chromium.chrome.shell.ChromeShellTestBase; import org.chromium.chrome.shell.ChromeShellTestBase;
import org.chromium.content.browser.test.util.Criteria; import org.chromium.content.browser.test.util.Criteria;
...@@ -115,6 +116,7 @@ public class InstallerDelegateTest extends ChromeShellTestBase ...@@ -115,6 +116,7 @@ public class InstallerDelegateTest extends ChromeShellTestBase
* Tests what happens when the InstallerDelegate detects that the package has successfully * Tests what happens when the InstallerDelegate detects that the package has successfully
* been installed. * been installed.
*/ */
@SmallTest
public void testInstallSuccessful() throws InterruptedException { public void testInstallSuccessful() throws InterruptedException {
mTestDelegate.setTimingForTests(1, 5000); mTestDelegate.setTimingForTests(1, 5000);
startMonitoring(); startMonitoring();
...@@ -130,6 +132,7 @@ public class InstallerDelegateTest extends ChromeShellTestBase ...@@ -130,6 +132,7 @@ public class InstallerDelegateTest extends ChromeShellTestBase
/** /**
* Tests what happens when the InstallerDelegate task is canceled. * Tests what happens when the InstallerDelegate task is canceled.
*/ */
@SmallTest
public void testInstallWaitUntilCancel() throws InterruptedException { public void testInstallWaitUntilCancel() throws InterruptedException {
mTestDelegate.setTimingForTests(1, 5000); mTestDelegate.setTimingForTests(1, 5000);
startMonitoring(); startMonitoring();
...@@ -145,6 +148,7 @@ public class InstallerDelegateTest extends ChromeShellTestBase ...@@ -145,6 +148,7 @@ public class InstallerDelegateTest extends ChromeShellTestBase
/** /**
* Tests what happens when the InstallerDelegate times out. * Tests what happens when the InstallerDelegate times out.
*/ */
@SmallTest
public void testInstallTimeout() throws InterruptedException { public void testInstallTimeout() throws InterruptedException {
mTestDelegate.setTimingForTests(1, 50); mTestDelegate.setTimingForTests(1, 50);
startMonitoring(); startMonitoring();
...@@ -154,6 +158,7 @@ public class InstallerDelegateTest extends ChromeShellTestBase ...@@ -154,6 +158,7 @@ public class InstallerDelegateTest extends ChromeShellTestBase
/** /**
* Makes sure that the runnable isn't called until returning from start(). * Makes sure that the runnable isn't called until returning from start().
*/ */
@SmallTest
public void testRunnableRaceCondition() throws InterruptedException { public void testRunnableRaceCondition() throws InterruptedException {
mPackageManager.isInstalled = true; mPackageManager.isInstalled = true;
mTestDelegate.setTimingForTests(1, 5000); mTestDelegate.setTimingForTests(1, 5000);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment