Fix branch breakage
This test have dependencies on wearable-support library which stays in
vendor folder. Move this test under vendor/google/tools/geppetto/tests/
folder.
bug:31393715
Change-Id: I1c393c4b872e001158c6c34c21c75ec6943fb54a
diff --git a/tests/jank/ime_wear/Android.mk b/tests/jank/ime_wear/Android.mk
deleted file mode 100644
index 376bb0f..0000000
--- a/tests/jank/ime_wear/Android.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright 2016 Google Inc. All Rights Reserved.
-#
-# 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.
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := IMEJankTestsWear
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_STATIC_JAVA_LIBRARIES := ub-uiautomator ub-janktesthelper wearable-support
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
\ No newline at end of file
diff --git a/tests/jank/ime_wear/AndroidManifest.xml b/tests/jank/ime_wear/AndroidManifest.xml
deleted file mode 100644
index b60d7bc..0000000
--- a/tests/jank/ime_wear/AndroidManifest.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 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.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.wearable.ime.janktests">
-
- <application>
- <uses-library android:name="android.test.runner" />
- </application>
- <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="23" />
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
-
- <instrumentation
- android:name="android.test.InstrumentationTestRunner"
- android:targetPackage="com.android.wearable.ime.janktests"
- android:label="Wearable IME Jank Tests" />
-</manifest>
\ No newline at end of file
diff --git a/tests/jank/ime_wear/src/com/android/wearable/ime/janktests/HandwritingJankTests.java b/tests/jank/ime_wear/src/com/android/wearable/ime/janktests/HandwritingJankTests.java
deleted file mode 100644
index b2e477f..0000000
--- a/tests/jank/ime_wear/src/com/android/wearable/ime/janktests/HandwritingJankTests.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 2016 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 com.android.wearable.ime.janktests;
-
-import android.os.Bundle;
-import android.support.test.jank.JankTest;
-import android.support.test.jank.JankTestBase;
-import android.support.test.jank.WindowAnimationFrameStatsMonitor;
-import android.support.test.uiautomator.UiDevice;
-
-/**
- * Jank tests for handwriting on wear
- */
-public class HandwritingJankTests extends JankTestBase {
-
- private UiDevice mDevice;
- private IMEJankTestsHelper mHelper;
-
- /*
- * (non-Javadoc)
- * @see junit.framework.TestCase#setUp()
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- mDevice = UiDevice.getInstance(getInstrumentation());
- mHelper = IMEJankTestsHelper.getInstance(mDevice, this.getInstrumentation());
- mDevice.wakeUp();
- mHelper.activateIMEHandwriting();
- }
-
- public void launchRemoteInputActivity() {
- mHelper.goBackHome();
- mHelper.launchRemoteInputActivity();
- }
-
- public void launchInputBoxActivity() {
- mHelper.goBackHome();
- mHelper.launchInputBoxActivity();
- }
-
- // Measure handwriting jank when open from remote input
- @JankTest(beforeTest = "launchRemoteInputActivity",
- afterLoop = "pressBack",
- afterTest = "goBackHome",
- expectedFrames = IMEJankTestsHelper.WFM_EXPECTED_FRAMES)
- @WindowAnimationFrameStatsMonitor
- public void testOpenHandwritingFromRemoteInput() {
- mHelper.tapIMEButton(IMEJankTestsHelper.HANDWRITING_CODE);
- }
-
- // Measure handwriting jank when open from input box
- @JankTest(beforeTest = "launchInputBoxActivity",
- afterLoop = "pressBack",
- afterTest = "goBackHome",
- expectedFrames = IMEJankTestsHelper.WFM_EXPECTED_FRAMES)
- @WindowAnimationFrameStatsMonitor
- public void testOpenHandwritingFromInputBox() {
- mHelper.tapOnScreen(IMEJankTestsHelper.HANDWRITING_CODE);
- }
-
- public void pressBack() {
- mHelper.pressBack();
- }
-
- // Ensuring that we head back to the first screen before launching the app again
- public void goBackHome(Bundle metrics) {
- mHelper.goBackHome();
- super.afterTest(metrics);
- }
-
-}
\ No newline at end of file
diff --git a/tests/jank/ime_wear/src/com/android/wearable/ime/janktests/IMEJankTestsHelper.java b/tests/jank/ime_wear/src/com/android/wearable/ime/janktests/IMEJankTestsHelper.java
deleted file mode 100644
index f2df01e..0000000
--- a/tests/jank/ime_wear/src/com/android/wearable/ime/janktests/IMEJankTestsHelper.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright (C) 2016 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 com.android.wearable.ime.janktests;
-
-import android.app.Instrumentation;
-import android.app.RemoteInput;
-import android.content.Context;
-import android.content.Intent;
-import android.os.SystemClock;
-import android.support.test.uiautomator.By;
-import android.support.test.uiautomator.UiDevice;
-import android.support.test.uiautomator.UiObject2;
-import android.support.test.uiautomator.Until;
-import android.support.wearable.input.RemoteInputIntent;
-import android.util.Log;
-import java.io.IOException;
-import junit.framework.Assert;
-
-/**
- * Helpers for Wear IME Jank Tests
- */
-
-public class IMEJankTestsHelper {
-
- public static final int LONG_TIMEOUT = 5000;
- public static final int SHORT_TIMEOUT = 1500;
- public static final int WFM_EXPECTED_FRAMES = 10;
- public static final int GFX_EXPECTED_FRAMES = 10;
- public static final int KEYBOARD_CODE = 1;
- public static final int HANDWRITING_CODE = 2;
- public static final String KEYBOARD_PACKAGE_NAME = "com.google.android.inputmethod.latin";
- public static final String HANDWRITING_PACKAGE_NAME = "com.google.android.apps.handwriting.ime";
- private static final String LOG_TAG = IMEJankTestsHelper.class.getSimpleName();
- private static final String HOME_INDICATOR = "charging_icon";
- private static final String KEYBOARD_INDICATOR = "key_pos_del";
- private static final String HANDWRITING_INDICATOR = "sengine_container";
- private static final String IME_BUTTON_NAME = "ime_choice";
- private static final String KEY_QUICK_REPLY_TEXT = "quick_reply";
- private static final String REMOTE_INPUT_TEXT = "Quick reply";
- private static final String REMOTE_INPUT_PACKAGE_NAME = "com.google.android.wearable.app";
- private static final String KEYBOARD_ID =
- "com.google.android.inputmethod.latin/com.google.android.apps.inputmethod.wear.WearIME";
- private static final String HANDWRITING_ID = "com.google.android.apps.handwriting.ime/"
- + "com.google.android.wearable.input.handwriting.HandwriterInputMethodService";
- private static final String SET_IME_CMD = "ime set %s";
- private static final String ENABLE_IME_CMD = "ime enable %s";
- private static final String INPUT_BOX_PACKAGE_NAME =
- "com.google.android.wearable.input.latin.activity";
- private static IMEJankTestsHelper mInstance;
- private UiDevice mDevice;
- private Instrumentation mInstrumentation;
-
- private IMEJankTestsHelper(UiDevice device, Instrumentation instrumentation) {
- mDevice = device;
- mInstrumentation = instrumentation;
- }
-
- public static IMEJankTestsHelper getInstance(UiDevice device, Instrumentation instrumentation) {
- if (mInstance == null) {
- mInstance = new IMEJankTestsHelper(device, instrumentation);
- }
- return mInstance;
- }
-
- public void swipeRight(int heightOffset) {
- mDevice.swipe(50,
- mDevice.getDisplayHeight() / 2 + heightOffset, mDevice.getDisplayWidth() - 25,
- mDevice.getDisplayHeight() / 2 + heightOffset, 30); // slow speed
- SystemClock.sleep(SHORT_TIMEOUT);
- }
-
- // Helper function to go back to home screen
- public void goBackHome() {
- String launcherPackage = mDevice.getLauncherPackageName();
- UiObject2 homeScreen = mDevice.findObject(By.res(launcherPackage, HOME_INDICATOR));
- int count = 0;
- while (homeScreen == null && count < 5) {
- mDevice.pressBack();
- homeScreen = mDevice.findObject(By.res(launcherPackage, HOME_INDICATOR));
- count++;
- }
- Assert.assertNotNull("Still cannot find home screen", homeScreen);
- SystemClock.sleep(SHORT_TIMEOUT);
- }
-
- public void launchRemoteInputActivity() {
- RemoteInput[] remoteInputs = new RemoteInput[] {
- new RemoteInput.Builder(KEY_QUICK_REPLY_TEXT).setLabel(REMOTE_INPUT_TEXT).build()
- };
- Intent intent = new Intent(RemoteInputIntent.ACTION_REMOTE_INPUT);
- intent.putExtra(RemoteInputIntent.EXTRA_REMOTE_INPUTS, remoteInputs);
- mInstrumentation.getContext().startActivity(intent);
-
- // Make sure remote input activity launched
- UiObject2 replyText = mDevice
- .wait(Until.findObject(By.text(REMOTE_INPUT_TEXT)), LONG_TIMEOUT);
- Assert.assertNotNull(replyText);
- }
-
- public void launchInputBoxActivity() {
- Context context = mInstrumentation.getContext();
- Intent intent = context.getPackageManager()
- .getLaunchIntentForPackage(INPUT_BOX_PACKAGE_NAME);
- intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
- context.startActivity(intent);
- Assert.assertTrue("Input box activity not started",
- mDevice.wait(Until.hasObject(By.pkg(INPUT_BOX_PACKAGE_NAME).depth(0)),
- LONG_TIMEOUT));
- }
-
- // Wait until keyboard or handwriting ui components show up
- public void tapIMEButton(int imeType) {
- UiObject2 imeButton = waitForSysAppUiObject2(REMOTE_INPUT_PACKAGE_NAME, IME_BUTTON_NAME);
- Assert.assertNotNull(imeButton);
- imeButton.click();
- waitForIMEOpen(imeType);
- }
-
- public void activateIMEKeyboard() {
- try {
- mDevice.executeShellCommand(String.format(ENABLE_IME_CMD, KEYBOARD_ID));
- mDevice.executeShellCommand(String.format(SET_IME_CMD, KEYBOARD_ID));
- } catch (IOException e) {
- Log.e(LOG_TAG, e.toString());
- }
- Log.d(LOG_TAG, "Keyboard activated");
- }
-
- public void activateIMEHandwriting() {
- try {
- mDevice.executeShellCommand(String.format(ENABLE_IME_CMD, HANDWRITING_ID));
- mDevice.executeShellCommand(String.format(SET_IME_CMD, HANDWRITING_ID));
- } catch (IOException e) {
- Log.e(LOG_TAG, e.toString());
- }
- Log.d(LOG_TAG, "Handwriting activated");
- }
-
- public void pressBack() {
- mDevice.pressBack();
- SystemClock.sleep(SHORT_TIMEOUT);
- }
-
- public void tapOnScreen(int imeType) {
- mDevice.click(mDevice.getDisplayHeight() / 2, mDevice.getDisplayWidth() / 2);
- waitForIMEOpen(imeType);
- }
-
- public void clickSoftKey(String softKeyDescription) {
- UiObject2 softKey =
- waitForSysAppUiObject2(KEYBOARD_PACKAGE_NAME, keyPosIdByDesc(softKeyDescription));
- Assert.assertNotNull("Soft Key " + softKeyDescription + " not found in UI", softKey);
- softKey.click();
- }
-
- private String keyPosIdByDesc(String desc) {
- return String.format("key_pos_%s", desc);
- }
-
- private void waitForIMEOpen(int imeType) {
- if (imeType == KEYBOARD_CODE) {
- Assert.assertNotNull("Cannot find keyboard",
- waitForSysAppUiObject2(KEYBOARD_PACKAGE_NAME, KEYBOARD_INDICATOR));
- } else if (imeType == HANDWRITING_CODE) {
- Assert.assertNotNull("Cannot find handwriting",
- waitForSysAppUiObject2(HANDWRITING_PACKAGE_NAME, HANDWRITING_INDICATOR));
- }
- }
-
- private UiObject2 waitForSysAppUiObject2(String pkgName, String resourceId) {
- return mDevice.wait(Until.findObject(By.res(pkgName, resourceId)), LONG_TIMEOUT);
- }
-}
\ No newline at end of file
diff --git a/tests/jank/ime_wear/src/com/android/wearable/ime/janktests/KeyboardJankTests.java b/tests/jank/ime_wear/src/com/android/wearable/ime/janktests/KeyboardJankTests.java
deleted file mode 100644
index fcb1940..0000000
--- a/tests/jank/ime_wear/src/com/android/wearable/ime/janktests/KeyboardJankTests.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright (C) 2016 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 com.android.wearable.ime.janktests;
-
-import android.os.Bundle;
-import android.support.test.jank.GfxMonitor;
-import android.support.test.jank.JankTest;
-import android.support.test.jank.JankTestBase;
-import android.support.test.jank.WindowAnimationFrameStatsMonitor;
-import android.support.test.uiautomator.UiDevice;
-
-/**
- * Jank tests for keyboard on wear
- */
-public class KeyboardJankTests extends JankTestBase {
-
- private UiDevice mDevice;
- private IMEJankTestsHelper mHelper;
-
- /*
- * (non-Javadoc)
- * @see junit.framework.TestCase#setUp()
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- mDevice = UiDevice.getInstance(getInstrumentation());
- mHelper = IMEJankTestsHelper.getInstance(mDevice, this.getInstrumentation());
- mDevice.wakeUp();
- mHelper.activateIMEKeyboard();
- }
-
- public void launchRemoteInputActivity() {
- mHelper.goBackHome();
- mHelper.launchRemoteInputActivity();
- }
-
- public void launchInputBoxActivity() {
- mHelper.goBackHome();
- mHelper.launchInputBoxActivity();
- }
-
- // Measure keyboard jank when opened from remote input
- @JankTest(beforeTest = "launchRemoteInputActivity",
- afterLoop = "pressBack",
- afterTest = "goBackHome",
- expectedFrames = IMEJankTestsHelper.WFM_EXPECTED_FRAMES)
- @WindowAnimationFrameStatsMonitor
- public void testOpenKeyboardFromRemoteInput() {
- mHelper.tapIMEButton(IMEJankTestsHelper.KEYBOARD_CODE);
- }
-
- // Measure keyboard jank when opened from input box
- @JankTest(beforeTest = "launchInputBoxActivity",
- afterLoop = "pressBack",
- afterTest = "goBackHome",
- expectedFrames = IMEJankTestsHelper.WFM_EXPECTED_FRAMES)
- @WindowAnimationFrameStatsMonitor
- public void testOpenKeyboardFromInputBox() {
- mHelper.tapOnScreen(IMEJankTestsHelper.KEYBOARD_CODE);
- }
-
- // Measure keyboard jank when typing simple sequence of characters
- @JankTest(beforeLoop = "launchInputBoxActivity",
- afterLoop = "pressBack",
- afterTest = "goBackHome",
- expectedFrames = IMEJankTestsHelper.GFX_EXPECTED_FRAMES)
- @GfxMonitor(processName = IMEJankTestsHelper.KEYBOARD_PACKAGE_NAME)
- public void testKeyboardSimpleSequence() {
- mHelper.tapOnScreen(IMEJankTestsHelper.KEYBOARD_CODE);
- for (int i = 1; i <= 9; i++) {
- mHelper.clickSoftKey(String.format("1_%d", i));
- }
- }
-
- // Measure keyboard jank when typing complex sequence of characters, del and spaces
- @JankTest(beforeLoop = "launchInputBoxActivity",
- afterLoop = "pressBack",
- afterTest = "goBackHome",
- expectedFrames = IMEJankTestsHelper.GFX_EXPECTED_FRAMES)
- @GfxMonitor(processName = IMEJankTestsHelper.KEYBOARD_PACKAGE_NAME)
- public void testKeyboardComplexSequence() {
- mHelper.tapOnScreen(IMEJankTestsHelper.KEYBOARD_CODE);
- for (int i = 0; i < 50; i++) {
- mHelper.clickSoftKey(String.format("0_%d", i % 10));
- if (i % 7 == 0) {
- mHelper.clickSoftKey("space");
- }
- if (i % 15 == 7) {
- mHelper.clickSoftKey("del");
- mHelper.clickSoftKey("del");
- mHelper.clickSoftKey("del");
- }
- }
- }
-
- // Measure keyboard jank when tapping more candidates button
- @JankTest(beforeTest = "prepareToShowMoreCandidates",
- afterTest = "goBackHome",
- expectedFrames = IMEJankTestsHelper.GFX_EXPECTED_FRAMES)
- @GfxMonitor(processName = IMEJankTestsHelper.KEYBOARD_PACKAGE_NAME)
- public void testKeyboardToggleMoreCandidates() {
- for (int i = 0; i < 6; i++) {
- mHelper.clickSoftKey("show_more_candidates");
- }
- }
-
- // Measure keyboard jank when typing gesture sequence
- @JankTest(beforeLoop = "launchInputBoxActivity",
- afterLoop = "pressBack",
- afterTest = "goBackHome",
- expectedFrames = IMEJankTestsHelper.GFX_EXPECTED_FRAMES)
- @GfxMonitor(processName = IMEJankTestsHelper.KEYBOARD_PACKAGE_NAME)
- public void testKeyboardGestureInput() {
- mHelper.tapOnScreen(IMEJankTestsHelper.KEYBOARD_CODE);
- for (int i = 0; i < 2; i++) {
- // Swipe through first row on keyboard
- mHelper.swipeRight(0);
- // Swipe through second row on keyboard
- mHelper.swipeRight(mDevice.getDisplayHeight() / 8);
- // Swipe through third row on keyboard
- mHelper.swipeRight(mDevice.getDisplayHeight() / 4);
- }
- }
-
- // Make sure more candidates icon shows up
- public void prepareToShowMoreCandidates() {
- launchInputBoxActivity();
- mHelper.tapOnScreen(IMEJankTestsHelper.KEYBOARD_CODE);
- for (int i = 0; i < 5; i++) {
- mHelper.clickSoftKey(String.format("0_%d", i));
- }
- }
-
- public void pressBack() {
- mHelper.pressBack();
- }
-
- // Ensuring that we head back to the first screen before launching the app again
- public void goBackHome(Bundle metrics) {
- mHelper.goBackHome();
- super.afterTest(metrics);
- }
-
-}
\ No newline at end of file