Add basic shadow for GLES20 with initial functionality.

PiperOrigin-RevId: 197954581
diff --git a/build.gradle b/build.gradle
index b7c0707..25ac5aa 100644
--- a/build.gradle
+++ b/build.gradle
@@ -112,4 +112,3 @@
 
 // for use of external initialization scripts...
 project.ext.allSdks = AndroidSdk.ALL_SDKS
-
diff --git a/integration_tests/androidx_test/src/test/java/org/robolectric/integration_tests/axt/ActivityTestRuleTest.java b/integration_tests/androidx_test/src/test/java/org/robolectric/integration_tests/axt/ActivityTestRuleTest.java
index 8ef02f6..c5c0172 100644
--- a/integration_tests/androidx_test/src/test/java/org/robolectric/integration_tests/axt/ActivityTestRuleTest.java
+++ b/integration_tests/androidx_test/src/test/java/org/robolectric/integration_tests/axt/ActivityTestRuleTest.java
@@ -4,7 +4,6 @@
 import static org.junit.Assert.fail;
 
 import android.app.Activity;
-import android.content.Intent;
 import android.os.Bundle;
 import androidx.test.rule.ActivityTestRule;
 import androidx.test.runner.AndroidJUnit4;
@@ -123,17 +122,6 @@
     assertThat(activity.receivedBundle).isNull();
   }
 
-  @Test public void launchActivity_intentExtras() {
-    Intent intent = new Intent();
-    intent.putExtra("Key", "Value");
-
-    TranscriptActivity activity = rule.launchActivity(intent);
-
-    Intent activityIntent = activity.getIntent();
-    assertThat(activityIntent.getExtras()).isNotNull();
-    assertThat(activityIntent.getStringExtra("Key")).isEqualTo("Value");
-  }
-
   @Test
   public void finishActivity() {
     rule.launchActivity(null);
diff --git a/integration_tests/androidx_test/src/test/java/org/robolectric/integration_tests/axt/EspressoTest.java b/integration_tests/androidx_test/src/test/java/org/robolectric/integration_tests/axt/EspressoTest.java
index cff96ce..be2900b 100644
--- a/integration_tests/androidx_test/src/test/java/org/robolectric/integration_tests/axt/EspressoTest.java
+++ b/integration_tests/androidx_test/src/test/java/org/robolectric/integration_tests/axt/EspressoTest.java
@@ -70,4 +70,23 @@
 
     assertThat(activity.buttonClicked).isTrue();
   }
+
+  /** Perform the 'traditional' mechanism of setting contents of a text view using findViewById */
+  @Test
+  @UiThreadTest
+  public void typeText() throws Exception {
+    EspressoActivity activity = activityRule.getActivity();
+    EditText editText = activity.findViewById(R.id.text);
+    editText.setText("new text");
+
+    assertThat(editText.getText().toString()).isEqualTo("new text");
+  }
+
+  /** Perform the equivalent of setText except using espresso APIs */
+  @Test
+  public void typeText_espresso() throws Exception {
+    onView(withId(R.id.text)).perform(ViewActions.typeText("new text"));
+
+    onView(withId(R.id.text)).check(matches(withText("new text")));
+  }
 }
diff --git a/integration_tests/powermock/build.gradle b/integration_tests/powermock/build.gradle
index 53a86e5..4e22171 100644
--- a/integration_tests/powermock/build.gradle
+++ b/integration_tests/powermock/build.gradle
@@ -13,8 +13,8 @@
     testCompile "junit:junit:4.12"
     testCompile "com.google.truth:truth:0.39"
 
-    testCompile "org.powermock:powermock-module-junit4:1.6.6"
-    testCompile "org.powermock:powermock-module-junit4-rule:1.6.6"
-    testCompile "org.powermock:powermock-api-mockito:1.6.6"
-    testCompile "org.powermock:powermock-classloading-xstream:1.6.6"
+    testCompile "org.powermock:powermock-module-junit4:1.6.2"
+    testCompile "org.powermock:powermock-module-junit4-rule:1.6.2"
+    testCompile "org.powermock:powermock-api-mockito:1.6.2"
+    testCompile "org.powermock:powermock-classloading-xstream:1.6.2"
 }
\ No newline at end of file
diff --git a/robolectric/src/main/java/org/robolectric/android/fakes/RoboMonitoringInstrumentation.java b/robolectric/src/main/java/org/robolectric/android/fakes/RoboMonitoringInstrumentation.java
index 04edc17..2584891 100644
--- a/robolectric/src/main/java/org/robolectric/android/fakes/RoboMonitoringInstrumentation.java
+++ b/robolectric/src/main/java/org/robolectric/android/fakes/RoboMonitoringInstrumentation.java
@@ -34,7 +34,7 @@
     ActivityInfo ai = intent.resolveActivityInfo(getTargetContext().getPackageManager(), 0);
     try {
       Class<? extends Activity> activityClass = Class.forName(ai.name).asSubclass(Activity.class);
-      ActivityController<? extends Activity> controller = Robolectric.buildActivity(activityClass, intent);
+      ActivityController<? extends Activity> controller = Robolectric.buildActivity(activityClass);
       Activity activity = controller.get();
       callActivityOnCreate(activity, null);
       controller.postCreate(null);
diff --git a/robolectric/src/test/java/org/robolectric/shadows/ShadowGLES20Test.java b/robolectric/src/test/java/org/robolectric/shadows/ShadowGLES20Test.java
new file mode 100644
index 0000000..a5b89e2
--- /dev/null
+++ b/robolectric/src/test/java/org/robolectric/shadows/ShadowGLES20Test.java
@@ -0,0 +1,38 @@
+package org.robolectric.shadows;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.opengl.GLES20;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
+
+/**
+ * Test for {@link GLES20}
+ */
+@RunWith(RobolectricTestRunner.class)
+public final class ShadowGLES20Test {
+
+  @Test
+  public void glGenTextures() {
+    int[] textures = new int[1];
+    GLES20.glGenTextures(1, textures, 0);
+    assertThat(textures[0]).isAtLeast(1);
+  }
+
+  @Test
+  public void glCreateShader_invalidEnum() {
+    assertThat(GLES20.glCreateShader(-99999)).isEqualTo(GLES20.GL_INVALID_ENUM);
+  }
+
+  @Test
+  public void glCreateShader_validEnum() {
+    assertThat(GLES20.glCreateShader(GLES20.GL_VERTEX_SHADER)).isAtLeast(1);
+  }
+
+  @Test
+  public void glCreateProgram() {
+    assertThat(GLES20.glCreateProgram()).isAtLeast(1);
+  }
+}
diff --git a/robolectric/src/test/java/org/robolectric/shadows/ShadowGeocoderTest.java b/robolectric/src/test/java/org/robolectric/shadows/ShadowGeocoderTest.java
index 79c08d7..a340a7d 100644
--- a/robolectric/src/test/java/org/robolectric/shadows/ShadowGeocoderTest.java
+++ b/robolectric/src/test/java/org/robolectric/shadows/ShadowGeocoderTest.java
@@ -1,7 +1,7 @@
 package org.robolectric.shadows;
 
 import static com.google.common.truth.Truth.assertThat;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.assertThrows;
 import static org.robolectric.Shadows.shadowOf;
 
 import android.location.Address;
@@ -59,24 +59,19 @@
   public void getFromLocation_throwsExceptionForInvalidLatitude() throws IOException {
     Geocoder geocoder = new Geocoder(RuntimeEnvironment.application.getApplicationContext());
 
-    try {
-      geocoder.getFromLocation(91.0, 90.0, 1);
-      fail("IllegalArgumentException not thrown");
-    } catch (IllegalArgumentException thrown) {
-      assertThat(thrown).hasMessageThat().contains(Double.toString(91.0));
-    }
+    IllegalArgumentException thrown =
+        assertThrows(IllegalArgumentException.class, () -> geocoder.getFromLocation(91.0, 90.0, 1));
+    assertThat(thrown).hasMessageThat().contains(Double.toString(91.0));
   }
 
   @Test
   public void getFromLocation_throwsExceptionForInvalidLongitude() throws IOException {
     Geocoder geocoder = new Geocoder(RuntimeEnvironment.application.getApplicationContext());
 
-    try {
-      geocoder.getFromLocation(15.0, -211.0, 1);
-      fail("IllegalArgumentException not thrown");
-    } catch (IllegalArgumentException thrown) {
-      assertThat(thrown).hasMessageThat().contains(Double.toString(-211.0));
-    }
+    IllegalArgumentException thrown =
+        assertThrows(
+            IllegalArgumentException.class, () -> geocoder.getFromLocation(15.0, -211.0, 1));
+    assertThat(thrown).hasMessageThat().contains(Double.toString(-211.0));
   }
 
   @Test
diff --git a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowGLES20.java b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowGLES20.java
new file mode 100644
index 0000000..4c5901f
--- /dev/null
+++ b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowGLES20.java
@@ -0,0 +1,35 @@
+package com.google.android.libraries.youtube.edit.shadows;
+
+import android.opengl.GLES20;
+import org.robolectric.annotation.Implementation;
+import org.robolectric.annotation.Implements;
+
+/**
+ * Fake implementation of {@link GLES20}
+ */
+@Implements(GLES20.class)
+public class ShadowGLES20 {
+  private static int textureCount = 0;
+  private static int shaderCount = 0;
+  private static int programCount = 0;
+
+  @Implementation
+  protected static void glGenTextures(int n, int[] textures, int offset) {
+    for (int i = 0; i < n; i++) {
+      textures[offset + i] = ++textureCount;
+    }
+  }
+
+  @Implementation
+  protected static int glCreateShader(int type) {
+    if (type != GLES20.GL_VERTEX_SHADER && type != GLES20.GL_FRAGMENT_SHADER) {
+      return GLES20.GL_INVALID_ENUM;
+    }
+    return ++shaderCount;
+  }
+
+  @Implementation
+  protected static int glCreateProgram() {
+    return ++programCount;
+  }
+}