OSDN Git Service

Removed temporary Autofill PERF tests.
authorFelipe Leme <felipeal@google.com>
Thu, 3 May 2018 17:06:15 +0000 (10:06 -0700)
committerFelipe Leme <felipeal@google.com>
Thu, 3 May 2018 17:07:19 +0000 (10:07 -0700)
Test: mmma -j ./frameworks/base/apct-tests/perftests/core/ &&  \
  adb install -r $OUT/data/app/CorePerfTests/CorePerfTests.apk && \
  adb shell am instrument -w -e class android.view.autofill.AutofillPerfTest \
  com.android.perftests.core/android.support.test.runner.AndroidJUnitRunner

Bug: 38345816

Change-Id: Ic37b0b2b0cf4a233cdb0104c86990200ed1ea57c

apct-tests/perftests/core/src/android/view/autofill/AutofillPerfTest.java [deleted file]
apct-tests/perftests/core/src/android/view/autofill/LoginTest.java

diff --git a/apct-tests/perftests/core/src/android/view/autofill/AutofillPerfTest.java b/apct-tests/perftests/core/src/android/view/autofill/AutofillPerfTest.java
deleted file mode 100644 (file)
index 7fa0de7..0000000
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * Copyright (C) 2018 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.view.autofill;
-
-import android.app.Activity;
-import android.os.Looper;
-import android.os.Bundle;
-import android.perftests.utils.PerfStatusReporter;
-import android.util.Log;
-import android.view.View;
-import android.widget.EditText;
-import android.perftests.utils.BenchmarkState;
-import android.perftests.utils.StubActivity;
-import android.provider.Settings;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.InstrumentationRegistry;
-
-import com.android.perftests.core.R;
-
-import java.util.Locale;
-import java.util.Collection;
-import java.util.Arrays;
-
-import org.junit.Test;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-import org.junit.runner.RunWith;
-
-import static org.junit.Assert.assertTrue;
-
-// TODO(b/38345816): remove this test once we have enough runs from LoginTest
-@RunWith(Parameterized.class)
-public class AutofillPerfTest extends AbstractAutofillPerfTestCase {
-    @Parameters(name = "{0}")
-    @SuppressWarnings("rawtypes")
-    public static Collection layouts() {
-        return Arrays.asList(new Object[][] {
-                { "Simple login", R.layout.test_autofill_login}
-        });
-    }
-
-    private EditText mUsername;
-    private EditText mPassword;
-
-    public AutofillPerfTest(@SuppressWarnings("unused") String key, int layoutId) {
-        super(layoutId);
-    }
-
-    @Override
-    protected void onCreate(StubActivity activity) {
-        View root = activity.getWindow().getDecorView();
-        mUsername = root.findViewById(R.id.username);
-        mPassword = root.findViewById(R.id.password);
-    }
-
-    /**
-     * This is the baseline test for focusing the 2 views when autofill is disabled.
-     */
-    @Test
-    public void testFocus_noService() throws Throwable {
-        resetService();
-
-        focusTest(false);
-    }
-
-    /**
-     * This time the service is called, but it returns a {@code null} response so the UI behaves
-     * as if autofill was disabled.
-     */
-    @Test
-    public void testFocus_serviceDoesNotAutofill() throws Throwable {
-        MyAutofillService.newCannedResponse().reply();
-        setService();
-
-        focusTest(true);
-
-        // Sanity check
-        MyAutofillService.assertNoAsyncErrors();
-    }
-
-    /**
-     * Now the service returns autofill data, for both username and password.
-     */
-    @Test
-    public void testFocus_autofillBothFields() throws Throwable {
-        MyAutofillService.newCannedResponse()
-                .setUsername(mUsername.getAutofillId(), "user")
-                .setPassword(mPassword.getAutofillId(), "pass")
-                .reply();
-        setService();
-
-        focusTest(true);
-
-        // Sanity check
-        MyAutofillService.assertNoAsyncErrors();
-    }
-
-    /**
-     * Now the service returns autofill data, but just for username.
-     */
-    @Test
-    public void testFocus_autofillUsernameOnly() throws Throwable {
-        // Must set ignored ids so focus on password does not trigger new requests
-        MyAutofillService.newCannedResponse()
-                .setUsername(mUsername.getAutofillId(), "user")
-                .setIgnored(mPassword.getAutofillId())
-                .reply();
-        setService();
-
-        focusTest(true);
-
-        // Sanity check
-        MyAutofillService.assertNoAsyncErrors();
-    }
-
-    private void focusTest(boolean waitForService) throws Throwable {
-        // Must first focus in a field to trigger autofill and wait for service response
-        // outside the loop
-        mActivityRule.runOnUiThread(() -> mUsername.requestFocus());
-        if (waitForService) {
-            MyAutofillService.getLastFillRequest();
-        }
-        mActivityRule.runOnUiThread(() -> {
-            BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
-            while (state.keepRunning()) {
-                mUsername.requestFocus();
-                mPassword.requestFocus();
-            }
-        });
-    }
-
-    /**
-     * This is the baseline test for changing the 2 views when autofill is disabled.
-     */
-    @Test
-    public void testChange_noService() throws Throwable {
-        resetService();
-
-        changeTest(false);
-    }
-
-    /**
-     * This time the service is called, but it returns a {@code null} response so the UI behaves
-     * as if autofill was disabled.
-     */
-    @Test
-    public void testChange_serviceDoesNotAutofill() throws Throwable {
-        MyAutofillService.newCannedResponse().reply();
-        setService();
-
-        changeTest(true);
-
-        // Sanity check
-        MyAutofillService.assertNoAsyncErrors();
-    }
-
-    /**
-     * Now the service returns autofill data, for both username and password.
-     */
-    @Test
-    public void testChange_autofillBothFields() throws Throwable {
-        MyAutofillService.newCannedResponse()
-                .setUsername(mUsername.getAutofillId(), "user")
-                .setPassword(mPassword.getAutofillId(), "pass")
-                .reply();
-        setService();
-
-        changeTest(true);
-
-        // Sanity check
-        MyAutofillService.assertNoAsyncErrors();
-    }
-
-    /**
-     * Now the service returns autofill data, but just for username.
-     */
-    @Test
-    public void testChange_autofillUsernameOnly() throws Throwable {
-        // Must set ignored ids so focus on password does not trigger new requests
-        MyAutofillService.newCannedResponse()
-                .setUsername(mUsername.getAutofillId(), "user")
-                .setIgnored(mPassword.getAutofillId())
-                .reply();
-        setService();
-
-        changeTest(true);
-
-        // Sanity check
-        MyAutofillService.assertNoAsyncErrors();
-    }
-
-    private void changeTest(boolean waitForService) throws Throwable {
-        // Must first focus in a field to trigger autofill and wait for service response
-        // outside the loop
-        mActivityRule.runOnUiThread(() -> mUsername.requestFocus());
-        if (waitForService) {
-            MyAutofillService.getLastFillRequest();
-        }
-        mActivityRule.runOnUiThread(() -> {
-
-            BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
-            while (state.keepRunning()) {
-                mUsername.setText("");
-                mUsername.setText("a");
-                mPassword.setText("");
-                mPassword.setText("x");
-            }
-        });
-    }
-
-    // TODO(b/38345816): remove this test, it's used just to test the dashboard
-    @Test
-    public void stupidTestThatAlwaysPass() throws Throwable {
-        mActivityRule.runOnUiThread(() -> {
-            BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
-            while (state.keepRunning()) {
-            }
-        });
-    }
-
-    // TODO(b/38345816): remove this test, it's used just to test the dashboard
-    @Test
-    public void stupidTestThatAlwaysFail() throws Throwable {
-        mActivityRule.runOnUiThread(() -> {
-            BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
-            while (state.keepRunning()) {
-                throw new RuntimeException("TEST, Y U NO PASS?");
-            }
-        });
-    }
-
-    // TODO(b/38345816): remove this test, it's used just to test the dashboard
-    @Test
-    public void stupidTestThatAlwaysHang() throws Throwable {
-        android.os.SystemClock.sleep(60_000); // 1m
-    }
-}
index 9f209d4..7d817fa 100644 (file)
@@ -214,31 +214,4 @@ public class LoginTest extends AbstractAutofillPerfTestCase {
             }
         });
     }
-
-    // TODO(b/38345816): remove this test, it's used just to test the dashboard
-    @Test
-    public void stupidTestThatAlwaysPass() throws Throwable {
-        mActivityRule.runOnUiThread(() -> {
-            BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
-            while (state.keepRunning()) {
-            }
-        });
-    }
-
-    // TODO(b/38345816): remove this test, it's used just to test the dashboard
-    @Test
-    public void stupidTestThatAlwaysFail() throws Throwable {
-        mActivityRule.runOnUiThread(() -> {
-            BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
-            while (state.keepRunning()) {
-                throw new RuntimeException("TEST, Y U NO PASS?");
-            }
-        });
-    }
-
-    // TODO(b/38345816): remove this test, it's used just to test the dashboard
-    @Test
-    public void stupidTestThatAlwaysHang() throws Throwable {
-        android.os.SystemClock.sleep(60_000); // 1m
-    }
 }