Add AUPT-dependent functional helper tests.

Bug: 30308084

+ Chrome
+ Google Camera
+ Google Keyboard
+ Maps
+ Play Movies
+ Play Music
+ Recents
+ YouTube

(cherry picked from commit 7c344f403a2e32e468cf81566ad799eb0e52a0e6)

Change-Id: Ie83ad136a72ceb8dc483b689135756838f4035b4
diff --git a/tests/functional/app-helper/src/android/platform/test/helpers/tests/ChromeHelperTest.java b/tests/functional/app-helper/src/android/platform/test/helpers/tests/ChromeHelperTest.java
new file mode 100644
index 0000000..ff81746
--- /dev/null
+++ b/tests/functional/app-helper/src/android/platform/test/helpers/tests/ChromeHelperTest.java
@@ -0,0 +1,94 @@
+/*
+ * 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 android.platform.test.helpers.tests;
+
+import android.platform.test.helpers.ChromeHelperImpl;
+import android.platform.test.helpers.IStandardAppHelper;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.uiautomator.Direction;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class ChromeHelperTest extends BaseHelperTest {
+    private ChromeHelperImpl mHelper;
+
+    public ChromeHelperTest () {
+        mHelper = new ChromeHelperImpl(InstrumentationRegistry.getInstrumentation());
+    }
+
+    @Override
+    protected IStandardAppHelper getHelper() {
+        return mHelper;
+    }
+
+    @Before
+    public void before() {
+        mHelper.open();
+    }
+
+    @After
+    public void after() {
+        mHelper.exit();
+    }
+
+    @Test
+    public void testDismissInitialDialogs() {
+        mHelper.dismissInitialDialogs();
+    }
+
+    @Test
+    public void testOpenUrl() {
+        mHelper.dismissInitialDialogs();
+        mHelper.openUrl("news.google.com");
+    }
+
+    @Test
+    public void testFlingPage() {
+        mHelper.dismissInitialDialogs();
+        mHelper.openUrl("news.google.com");
+        mHelper.flingPage(Direction.DOWN);
+    }
+
+    @Test
+    @Ignore("Not critical for testing.")
+    public void testOpenMenu() {
+        mHelper.dismissInitialDialogs();
+        mHelper.openUrl("news.google.com");
+        mHelper.openMenu();
+    }
+
+    @Test
+    @Ignore("Not critical for testing.")
+    public void testMergeTabs() {
+        mHelper.dismissInitialDialogs();
+        mHelper.openUrl("news.google.com");
+        mHelper.mergeTabs();
+    }
+
+    @Test
+    @Ignore("Not critical for testing.")
+    public void testUnmergeTabs() {
+        mHelper.dismissInitialDialogs();
+        mHelper.openUrl("news.google.com");
+        mHelper.mergeTabs();
+        mHelper.unmergeTabs();
+    }
+}
diff --git a/tests/functional/app-helper/src/android/platform/test/helpers/tests/GoogleCameraHelperTest.java b/tests/functional/app-helper/src/android/platform/test/helpers/tests/GoogleCameraHelperTest.java
new file mode 100644
index 0000000..15fd033
--- /dev/null
+++ b/tests/functional/app-helper/src/android/platform/test/helpers/tests/GoogleCameraHelperTest.java
@@ -0,0 +1,117 @@
+/*
+ * 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 android.platform.test.helpers.tests;
+
+import android.platform.test.helpers.GoogleCameraHelperImpl;
+import android.platform.test.helpers.IStandardAppHelper;
+import android.support.test.InstrumentationRegistry;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class GoogleCameraHelperTest extends BaseHelperTest {
+    private GoogleCameraHelperImpl mHelper;
+
+    public GoogleCameraHelperTest () {
+        mHelper = new GoogleCameraHelperImpl(InstrumentationRegistry.getInstrumentation());
+    }
+
+    @Override
+    protected IStandardAppHelper getHelper() {
+        return mHelper;
+    }
+
+    @Before
+    public void before() {
+        mHelper.open();
+    }
+
+    @After
+    public void after() {
+        mHelper.exit();
+    }
+
+    @Test
+    public void testDismissInitialDialogs() {
+        mHelper.dismissInitialDialogs();
+    }
+
+    @Test
+    public void testGoToVideoMode() {
+        mHelper.dismissInitialDialogs();
+        mHelper.goToVideoMode();
+    }
+
+    @Test
+    public void testGoToCameraMode() {
+        mHelper.dismissInitialDialogs();
+        mHelper.goToVideoMode();
+        mHelper.goToCameraMode();
+    }
+
+    @Test
+    public void testWaitForCameraShutterEnabled() {
+        mHelper.dismissInitialDialogs();
+        mHelper.waitForCameraShutterEnabled();
+    }
+
+    @Test
+    public void testWaitForVideoShutterEnabled() {
+        mHelper.dismissInitialDialogs();
+        mHelper.goToVideoMode();
+        mHelper.waitForVideoShutterEnabled();
+    }
+
+    @Test
+    public void testCapturePhoto() {
+        mHelper.dismissInitialDialogs();
+        mHelper.waitForCameraShutterEnabled();
+        mHelper.capturePhoto();
+    }
+
+    @Test
+    public void testCaptureVideo() {
+        mHelper.dismissInitialDialogs();
+        mHelper.goToVideoMode();
+        mHelper.waitForVideoShutterEnabled();
+        mHelper.captureVideo(5000);
+    }
+
+    @Test
+    @Ignore("Not supported by all devices.")
+    public void testSetHdrMode_AUTO() {
+        mHelper.dismissInitialDialogs();
+        mHelper.setHdrMode(GoogleCameraHelperImpl.HDR_MODE_AUTO);
+    }
+
+    @Test
+    @Ignore("Not supported by all devices.")
+    public void testSetHdrMode_OFF() {
+        mHelper.dismissInitialDialogs();
+        mHelper.setHdrMode(GoogleCameraHelperImpl.HDR_MODE_OFF);
+    }
+
+    @Test
+    @Ignore("Not supported by all devices.")
+    public void testSetHdrMode_ON() {
+        mHelper.dismissInitialDialogs();
+        mHelper.setHdrMode(GoogleCameraHelperImpl.HDR_MODE_ON);
+    }
+}
diff --git a/tests/functional/app-helper/src/android/platform/test/helpers/tests/GoogleKeyboardHelperTest.java b/tests/functional/app-helper/src/android/platform/test/helpers/tests/GoogleKeyboardHelperTest.java
new file mode 100644
index 0000000..62fc374
--- /dev/null
+++ b/tests/functional/app-helper/src/android/platform/test/helpers/tests/GoogleKeyboardHelperTest.java
@@ -0,0 +1,82 @@
+/*
+ * 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 android.platform.test.helpers.tests;
+
+import android.platform.test.helpers.GoogleKeyboardHelperImpl;
+import android.platform.test.helpers.IStandardAppHelper;
+import android.support.test.InstrumentationRegistry;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import junit.framework.Assert;
+
+public class GoogleKeyboardHelperTest extends BaseHelperTest {
+    private GoogleKeyboardHelperImpl mHelper;
+
+    public GoogleKeyboardHelperTest () {
+        mHelper = new GoogleKeyboardHelperImpl(InstrumentationRegistry.getInstrumentation());
+    }
+
+    @Override
+    protected IStandardAppHelper getHelper() {
+        return mHelper;
+    }
+
+    @Before
+    public void before() {
+        mHelper.open();
+    }
+
+    @After
+    public void after() {
+        mHelper.exit();
+    }
+
+    @Test
+    public void testDismissInitialDialogs() {
+        mHelper.dismissInitialDialogs();
+    }
+
+    @Test
+    @Ignore("Not critical test functionality.")
+    public void testWaitForKeyboard_False() {
+        mHelper.dismissInitialDialogs();
+        mHelper.exit();
+        Assert.assertFalse("Method didn't return false waiting for the keyboard",
+                mHelper.waitForKeyboard(2500));
+    }
+
+    @Test
+    @Ignore("Not critical test functionality.")
+    public void testWaitForKeyboard_True() {
+        mHelper.dismissInitialDialogs();
+        Assert.assertTrue("Method didn't return true waiting for the keyboard",
+                mHelper.waitForKeyboard(2500));
+    }
+
+    @Test
+    @Ignore("Not critical test functionality.")
+    public void testTypeText() {
+        mHelper.dismissInitialDialogs();
+        mHelper.waitForKeyboard(2500);
+        mHelper.typeText("abcd efgh", 250);
+    }
+}
diff --git a/tests/functional/app-helper/src/android/platform/test/helpers/tests/MapsHelperTest.java b/tests/functional/app-helper/src/android/platform/test/helpers/tests/MapsHelperTest.java
index a622fa6..2d26888 100644
--- a/tests/functional/app-helper/src/android/platform/test/helpers/tests/MapsHelperTest.java
+++ b/tests/functional/app-helper/src/android/platform/test/helpers/tests/MapsHelperTest.java
@@ -19,11 +19,11 @@
 import android.platform.test.helpers.MapsHelperImpl;
 import android.platform.test.helpers.IStandardAppHelper;
 import android.support.test.InstrumentationRegistry;
-import android.support.test.uiautomator.Direction;
 
 import org.junit.After;
 import org.junit.Before;
 import org.junit.BeforeClass;
+import org.junit.Ignore;
 import org.junit.Test;
 
 public class MapsHelperTest extends BaseHelperTest {
@@ -60,6 +60,7 @@
     }
 
     @Test
+    @Ignore("Not supported for all devices.")
     public void testGetDirections() {
         mHelper.dismissInitialDialogs();
         mHelper.doSearch("golden gate bridge");
@@ -67,6 +68,7 @@
     }
 
     @Test
+    @Ignore("Not supported for all devices.")
     public void testStartNavigation() {
         mHelper.dismissInitialDialogs();
         mHelper.doSearch("golden gate bridge");
@@ -75,6 +77,7 @@
     }
 
     @Test
+    @Ignore("Not supported for all devices.")
     public void testStopNavigation() {
         mHelper.dismissInitialDialogs();
         mHelper.doSearch("golden gate bridge");
diff --git a/tests/functional/app-helper/src/android/platform/test/helpers/tests/PlayMoviesHelperTest.java b/tests/functional/app-helper/src/android/platform/test/helpers/tests/PlayMoviesHelperTest.java
new file mode 100644
index 0000000..f5ac42b
--- /dev/null
+++ b/tests/functional/app-helper/src/android/platform/test/helpers/tests/PlayMoviesHelperTest.java
@@ -0,0 +1,67 @@
+/*
+ * 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 android.platform.test.helpers.tests;
+
+import android.platform.test.helpers.PlayMoviesHelperImpl;
+import android.platform.test.helpers.IStandardAppHelper;
+import android.support.test.InstrumentationRegistry;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class PlayMoviesHelperTest extends BaseHelperTest {
+    private PlayMoviesHelperImpl mHelper;
+
+    public PlayMoviesHelperTest () {
+        mHelper = new PlayMoviesHelperImpl(InstrumentationRegistry.getInstrumentation());
+    }
+
+    @Override
+    protected IStandardAppHelper getHelper() {
+        return mHelper;
+    }
+
+    @Before
+    public void before() {
+        mHelper.open();
+    }
+
+    @After
+    public void after() {
+        mHelper.exit();
+    }
+
+    @Test
+    public void testDismissInitialDialogs() {
+        mHelper.dismissInitialDialogs();
+    }
+
+    @Test
+    public void testOpenMoviesTab() {
+        mHelper.dismissInitialDialogs();
+        mHelper.openMoviesTab();
+    }
+
+    @Test
+    public void testPlayMovie() {
+        mHelper.dismissInitialDialogs();
+        mHelper.openMoviesTab();
+        mHelper.playMovie("Dangerous");
+    }
+}
diff --git a/tests/functional/app-helper/src/android/platform/test/helpers/tests/PlayMusicHelperTest.java b/tests/functional/app-helper/src/android/platform/test/helpers/tests/PlayMusicHelperTest.java
new file mode 100644
index 0000000..85ceecb
--- /dev/null
+++ b/tests/functional/app-helper/src/android/platform/test/helpers/tests/PlayMusicHelperTest.java
@@ -0,0 +1,67 @@
+/*
+ * 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 android.platform.test.helpers.tests;
+
+import android.platform.test.helpers.PlayMusicHelperImpl;
+import android.platform.test.helpers.IStandardAppHelper;
+import android.support.test.InstrumentationRegistry;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class PlayMusicHelperTest extends BaseHelperTest {
+    private PlayMusicHelperImpl mHelper;
+
+    public PlayMusicHelperTest () {
+        mHelper = new PlayMusicHelperImpl(InstrumentationRegistry.getInstrumentation());
+    }
+
+    @Override
+    protected IStandardAppHelper getHelper() {
+        return mHelper;
+    }
+
+    @Before
+    public void before() {
+        mHelper.open();
+    }
+
+    @After
+    public void after() {
+        mHelper.exit();
+    }
+
+    @Test
+    public void testDismissInitialDialogs() {
+        mHelper.dismissInitialDialogs();
+    }
+
+    @Test
+    public void testGoToSongsTab() {
+        mHelper.dismissInitialDialogs();
+        mHelper.goToTab("Songs");
+    }
+
+    @Test
+    public void testShuffleAllSongs() {
+        mHelper.dismissInitialDialogs();
+        mHelper.goToTab("Songs");
+        mHelper.pressShuffleAll();
+    }
+}
diff --git a/tests/functional/app-helper/src/android/platform/test/helpers/tests/RecentsHelperTest.java b/tests/functional/app-helper/src/android/platform/test/helpers/tests/RecentsHelperTest.java
new file mode 100644
index 0000000..729eb33
--- /dev/null
+++ b/tests/functional/app-helper/src/android/platform/test/helpers/tests/RecentsHelperTest.java
@@ -0,0 +1,62 @@
+/*
+ * 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 android.platform.test.helpers.tests;
+
+import android.app.Instrumentation;
+import android.platform.test.helpers.RecentsHelperImpl;
+import android.platform.test.helpers.IStandardAppHelper;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.uiautomator.Direction;
+import android.support.test.uiautomator.UiDevice;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class RecentsHelperTest extends BaseHelperTest {
+    private RecentsHelperImpl mHelper;
+    private UiDevice mDevice;
+
+    public RecentsHelperTest () {
+        Instrumentation instr = InstrumentationRegistry.getInstrumentation();
+        mHelper = new RecentsHelperImpl(instr);
+        mDevice = UiDevice.getInstance(instr);
+    }
+
+    @Override
+    protected IStandardAppHelper getHelper() {
+        return mHelper;
+    }
+
+    @Before
+    public void before() {
+        mHelper.open();
+    }
+
+    @After
+    public void after() {
+        mHelper.exit();
+    }
+
+    @Test
+    public void testFlingRecents() {
+        mHelper.flingRecents(Direction.UP);
+        mDevice.waitForIdle();
+        mHelper.flingRecents(Direction.DOWN);
+    }
+}
diff --git a/tests/functional/app-helper/src/android/platform/test/helpers/tests/YouTubeHelperTest.java b/tests/functional/app-helper/src/android/platform/test/helpers/tests/YouTubeHelperTest.java
new file mode 100644
index 0000000..c3e24ea
--- /dev/null
+++ b/tests/functional/app-helper/src/android/platform/test/helpers/tests/YouTubeHelperTest.java
@@ -0,0 +1,67 @@
+/*
+ * 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 android.platform.test.helpers.tests;
+
+import android.platform.test.helpers.YouTubeHelperImpl;
+import android.platform.test.helpers.IStandardAppHelper;
+import android.support.test.InstrumentationRegistry;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class YouTubeHelperTest extends BaseHelperTest {
+    private YouTubeHelperImpl mHelper;
+
+    public YouTubeHelperTest () {
+        mHelper = new YouTubeHelperImpl(InstrumentationRegistry.getInstrumentation());
+    }
+
+    @Override
+    protected IStandardAppHelper getHelper() {
+        return mHelper;
+    }
+
+    @Before
+    public void before() {
+        mHelper.open();
+    }
+
+    @After
+    public void after() {
+        mHelper.exit();
+    }
+
+    @Test
+    public void testDismissInitialDialogs() {
+        mHelper.dismissInitialDialogs();
+    }
+
+    @Test
+    public void testGoToHomePage() {
+        mHelper.dismissInitialDialogs();
+        mHelper.goToHomePage();
+    }
+
+    @Test
+    public void testPlayHomePageVideo() {
+        mHelper.dismissInitialDialogs();
+        mHelper.goToHomePage();
+        mHelper.playHomePageVideo();
+    }
+}