summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Rosenfeld <mrosenfeld@google.com>2019-10-12 20:57:43 -0700
committerMichael Rosenfeld <mrosenfeld@google.com>2019-12-18 06:19:42 +0000
commit441fc4daccb93f7ab9177d3ddcb69a2f8e9f3262 (patch)
tree22a12fa5809f7554d5a8ae047fcdd3df881d3db9
parenta06de0f6ec522fef21e5ef8c466b250c334ba438 (diff)
downloadplatform_testing-441fc4daccb93f7ab9177d3ddcb69a2f8e9f3262.tar.gz
Add a generic microbenchmark for opening apps.
am: a7d6fbfc9c Change-Id: I2356da2359e5f14b6b97bf47b5dd7259e56746ea (cherry picked from commit 36555e4d713defc6c2bbf8f3fb21e6d63a2f877c) Bug: 142557911 Test: manual Merged-In: I6af93061866cd529b17a88ee104b47ea66990027 Merged-In: I02c9b5dca258cef11d059d9f136d9abf3390d996
-rw-r--r--tests/health/scenarios/tests/Android.bp1
-rw-r--r--tests/health/scenarios/tests/src/android/platform/test/scenario/generic/OpenAppMicrobenchmark.java37
2 files changed, 38 insertions, 0 deletions
diff --git a/tests/health/scenarios/tests/Android.bp b/tests/health/scenarios/tests/Android.bp
index 69b1ff149..9ac9a3782 100644
--- a/tests/health/scenarios/tests/Android.bp
+++ b/tests/health/scenarios/tests/Android.bp
@@ -50,6 +50,7 @@ java_library_static {
"guava",
"longevity-device-lib",
"microbenchmark-device-lib",
+ "platform-test-options",
"platform-test-rules",
],
}
diff --git a/tests/health/scenarios/tests/src/android/platform/test/scenario/generic/OpenAppMicrobenchmark.java b/tests/health/scenarios/tests/src/android/platform/test/scenario/generic/OpenAppMicrobenchmark.java
new file mode 100644
index 000000000..8e950beb2
--- /dev/null
+++ b/tests/health/scenarios/tests/src/android/platform/test/scenario/generic/OpenAppMicrobenchmark.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.platform.test.scenario.generic;
+
+import android.platform.test.microbenchmark.Microbenchmark;
+import android.platform.test.rule.CompilationFilterRule;
+import android.platform.test.rule.DropCachesRule;
+import android.platform.test.rule.KillAppsRule;
+import android.platform.test.rule.PressHomeRule;
+
+import org.junit.Rule;
+import org.junit.rules.RuleChain;
+import org.junit.runner.RunWith;
+
+@RunWith(Microbenchmark.class)
+public class OpenAppMicrobenchmark extends OpenApp {
+ // Method-level rules
+ @Rule
+ public RuleChain rules =
+ RuleChain.outerRule(new KillAppsRule(mPkgOption.get()))
+ .around(new DropCachesRule())
+ .around(new CompilationFilterRule(mPkgOption.get()))
+ .around(new PressHomeRule());
+}