summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJed Estep <jestep@google.com>2016-08-03 16:55:06 -0700
committergitbuildkicker <android-build@google.com>2016-09-08 17:20:33 -0700
commit26fdb6ef4cc9664c0343580765928b9e173f1222 (patch)
tree55bcfbd521d97b805000b5310c8b2c2137f99930
parent33aae6e67881d6baac2fa19b7b89398b92002017 (diff)
downloadplatform_testing-26fdb6ef4cc9664c0343580765928b9e173f1222.tar.gz
fake-ota based download tests for OTAs
Bug: 29414763 Change-Id: I934dbb189225ec33d1b5cc093ac07259bb1a25d0 (cherry picked from commit 15588eafbf1865036fc2d0d8224f4aab962951ca)
-rw-r--r--tests/functional/otatests/Android.mk1
-rw-r--r--tests/functional/otatests/src/com/android/functional/otatests/SystemUpdateAppTest.java68
-rw-r--r--tests/functional/otatests/src/com/android/functional/otatests/SystemUpdateTest.java16
-rw-r--r--tests/functional/otatests/src/com/android/functional/otatests/VersionCheckingTest.java16
-rw-r--r--tests/functional/otatests/src/com/android/functional/otatests/VersionInfo.java16
5 files changed, 117 insertions, 0 deletions
diff --git a/tests/functional/otatests/Android.mk b/tests/functional/otatests/Android.mk
index b73860edc..2d6a980f3 100644
--- a/tests/functional/otatests/Android.mk
+++ b/tests/functional/otatests/Android.mk
@@ -9,6 +9,7 @@ LOCAL_MODULE_TAGS := tests
LOCAL_STATIC_JAVA_LIBRARIES := \
android-support-test \
easymocklib \
+ launcher-helper-lib \
objenesis-target \
ub-uiautomator
diff --git a/tests/functional/otatests/src/com/android/functional/otatests/SystemUpdateAppTest.java b/tests/functional/otatests/src/com/android/functional/otatests/SystemUpdateAppTest.java
new file mode 100644
index 000000000..12e015836
--- /dev/null
+++ b/tests/functional/otatests/src/com/android/functional/otatests/SystemUpdateAppTest.java
@@ -0,0 +1,68 @@
+/*
+ * 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.functional.otatests;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import android.app.Instrumentation;
+import android.content.Intent;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.runner.AndroidJUnit4;
+import android.support.test.uiautomator.By;
+import android.support.test.uiautomator.UiDevice;
+import android.support.test.uiautomator.Until;
+import org.junit.After;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Tests functionality related to the System Update app.
+ *
+ * Precondition: an OTA must be available to the device.
+ */
+@RunWith(AndroidJUnit4.class)
+public class SystemUpdateAppTest {
+
+ private static final String SYSTEM_UPDATE_INTENT = "android.settings.SYSTEM_UPDATE_SETTINGS";
+ private static final String POLICY_AUTH_PACKAGE = "com.google.android.gms.policy_auth";
+ private static final long TIMEOUT_MS = 2000;
+
+ private UiDevice mDevice;
+ private Instrumentation mInstrumentation;
+
+ @BeforeClass
+ public void setUp() throws Exception {
+ mInstrumentation = InstrumentationRegistry.getInstrumentation();
+ mDevice = UiDevice.getInstance(mInstrumentation);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ mDevice.pressHome();
+ }
+
+ @Test
+ public void testUpdateIsAvailable() {
+ mInstrumentation.getContext().startActivity(new Intent(SYSTEM_UPDATE_INTENT));
+ String mainText = mDevice.wait(Until.findObject(
+ By.res(POLICY_AUTH_PACKAGE, "suw_layout_title")), TIMEOUT_MS).getText();
+ assertTrue(mainText.contains("available"));
+ assertNotNull(mDevice.findObject(By.res(POLICY_AUTH_PACKAGE, "suw_items_title")));
+ }
+}
diff --git a/tests/functional/otatests/src/com/android/functional/otatests/SystemUpdateTest.java b/tests/functional/otatests/src/com/android/functional/otatests/SystemUpdateTest.java
index 18de573e3..4d5acec06 100644
--- a/tests/functional/otatests/src/com/android/functional/otatests/SystemUpdateTest.java
+++ b/tests/functional/otatests/src/com/android/functional/otatests/SystemUpdateTest.java
@@ -1,3 +1,19 @@
+/*
+ * 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.functional.otatests;
import org.junit.Test;
diff --git a/tests/functional/otatests/src/com/android/functional/otatests/VersionCheckingTest.java b/tests/functional/otatests/src/com/android/functional/otatests/VersionCheckingTest.java
index 4f18192f8..df3df9ce6 100644
--- a/tests/functional/otatests/src/com/android/functional/otatests/VersionCheckingTest.java
+++ b/tests/functional/otatests/src/com/android/functional/otatests/VersionCheckingTest.java
@@ -1,3 +1,19 @@
+/*
+ * 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.functional.otatests;
import static org.junit.Assert.assertEquals;
diff --git a/tests/functional/otatests/src/com/android/functional/otatests/VersionInfo.java b/tests/functional/otatests/src/com/android/functional/otatests/VersionInfo.java
index 448464fbf..624c6981f 100644
--- a/tests/functional/otatests/src/com/android/functional/otatests/VersionInfo.java
+++ b/tests/functional/otatests/src/com/android/functional/otatests/VersionInfo.java
@@ -1,3 +1,19 @@
+/*
+ * 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.functional.otatests;
import java.io.BufferedReader;