OSDN Git Service

changing test to use hidden test api annotations.
authorTsu Chiang Chuang <tsu@google.com>
Fri, 5 Aug 2011 21:50:49 +0000 (14:50 -0700)
committerTsu Chiang Chuang <tsu@google.com>
Sat, 6 Aug 2011 00:58:58 +0000 (17:58 -0700)
Change-Id: If1002c80fdfdc87694890215201314e2372bbe4a

tests/stress/Android.mk
tests/stress/AndroidManifest.xml
tests/stress/src/com/android/launcher2/stress/LauncherRotationStressTest.java

index da22bb9..68289bd 100644 (file)
@@ -28,6 +28,4 @@ LOCAL_CERTIFICATE := shared
 
 LOCAL_INSTRUMENTATION_FOR := Launcher2
 
-LOCAL_SDK_VERSION := current
-
 include $(BUILD_PACKAGE)
index ce5dbe4..0df3a9d 100644 (file)
@@ -17,8 +17,6 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.android.launcher.stress.launcherrotation">
 
-    <uses-sdk android:minSdkVersion="8" />
-
     <application>
         <uses-library android:name="android.test.runner" />
     </application>
index 3d787f2..d21fd53 100644 (file)
@@ -22,7 +22,7 @@ import com.android.launcher2.Launcher;
 import android.content.pm.ActivityInfo;
 import android.os.SystemClock;
 import android.test.ActivityInstrumentationTestCase2;
-import android.test.TimedTest;
+import android.test.RepetitiveTest;
 import android.util.Log;
 
 /**
@@ -31,6 +31,7 @@ import android.util.Log;
 public class LauncherRotationStressTest extends ActivityInstrumentationTestCase2<Launcher> {
 
     private static final int NUM_ITERATIONS = 50;
+    private static final int WAIT_TIME_MS = 500;
     private static final String LOG_TAG = "LauncherRotationStressTest";
 
     public LauncherRotationStressTest() {
@@ -47,22 +48,16 @@ public class LauncherRotationStressTest extends ActivityInstrumentationTestCase2
         super.tearDown();
     }
 
-    @TimedTest(includeDetailedStats=true)
+    @RepetitiveTest(numIterations=NUM_ITERATIONS)
     public void testLauncherRotationStress() throws Exception {
         Launcher launcher = getActivity();
-        for (int i = 0; i < NUM_ITERATIONS; i++) {
-            Log.i(LOG_TAG, "Starting LauncherRotationStressTest " + (i + 1) + " of " +
-                  NUM_ITERATIONS);
-            getInstrumentation().waitForIdleSync();
-            SystemClock.sleep(500);
-            launcher.setRequestedOrientation(
-                    ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
-            getInstrumentation().waitForIdleSync();
-            SystemClock.sleep(500);
-            launcher.setRequestedOrientation(
-                    ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
-            Log.i(LOG_TAG, "Finished LauncherRotationStressTest " + (i + 1) + " of " +
-                  NUM_ITERATIONS);
-        }
+        getInstrumentation().waitForIdleSync();
+        SystemClock.sleep(WAIT_TIME_MS);
+        launcher.setRequestedOrientation(
+                ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
+        getInstrumentation().waitForIdleSync();
+        SystemClock.sleep(WAIT_TIME_MS);
+        launcher.setRequestedOrientation(
+                ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
     }
 }