Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Unified Diff: webrtc/examples/androidtests/src/org/appspot/apprtc/test/CallActivityStubbedInputOutputTest.java

Issue 2741743002: IdlingResource for destroy() VideoFileRenderer (Closed)
Patch Set: Rename of ConnectActivityStubbedInputOutputTest Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/examples/androidtests/src/org/appspot/apprtc/test/CallActivityStubbedInputOutputTest.java
diff --git a/webrtc/examples/androidtests/src/org/appspot/apprtc/test/ConnectActivityStubbedInputOutputTest.java b/webrtc/examples/androidtests/src/org/appspot/apprtc/test/CallActivityStubbedInputOutputTest.java
similarity index 65%
rename from webrtc/examples/androidtests/src/org/appspot/apprtc/test/ConnectActivityStubbedInputOutputTest.java
rename to webrtc/examples/androidtests/src/org/appspot/apprtc/test/CallActivityStubbedInputOutputTest.java
index ebb445bc793ec6b7332521b5914e8d32cd77d016..68fe6201e3bfaa65ef0230cbb45e113ba58b9ae7 100644
--- a/webrtc/examples/androidtests/src/org/appspot/apprtc/test/ConnectActivityStubbedInputOutputTest.java
+++ b/webrtc/examples/androidtests/src/org/appspot/apprtc/test/CallActivityStubbedInputOutputTest.java
@@ -18,7 +18,10 @@ import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Environment;
+import android.support.test.espresso.contrib.CountingIdlingResource;
+import android.support.test.espresso.Espresso;
import android.support.test.espresso.IdlingPolicies;
+import android.support.test.espresso.IdlingResource;
import android.support.test.filters.LargeTest;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
@@ -28,6 +31,8 @@ import java.util.concurrent.TimeUnit;
import org.appspot.apprtc.CallActivity;
import org.appspot.apprtc.ConnectActivity;
import org.appspot.apprtc.R;
+import org.junit.After;
+import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -38,17 +43,18 @@ import org.junit.runner.RunWith;
*/
@RunWith(AndroidJUnit4.class)
@LargeTest
-public class ConnectActivityStubbedInputOutputTest {
- private static final String TAG = "ConnectActivityStubbedInputOutputTest";
+public class CallActivityStubbedInputOutputTest {
+ private static final String TAG = "CallActivityStubbedInputOutputTest";
@Rule
- public ActivityTestRule<ConnectActivity> rule =
- new ActivityTestRule<ConnectActivity>(ConnectActivity.class) {
+ public ActivityTestRule<CallActivity> rule =
+ new ActivityTestRule<CallActivity>(CallActivity.class) {
@Override
protected Intent getActivityIntent() {
- Context context = InstrumentationRegistry.getInstrumentation().getTargetContext();
- Intent intent = new Intent("android.intent.action.VIEW", Uri.parse("https://appr.tc"),
- context, ConnectActivity.class);
+ Context context =
+ InstrumentationRegistry
+ .getContext(); // InstrumentationRegistry.getInstrumentation().getTargetContext();
+ Intent intent = new Intent("android.intent.action.VIEW", Uri.parse("https://appr.tc"));
intent.putExtra(CallActivity.EXTRA_USE_VALUES_FROM_INTENT, true);
@@ -72,6 +78,36 @@ public class ConnectActivityStubbedInputOutputTest {
}
};
+ private static class BusyResource implements CallActivity.CountingResource {
+ CountingIdlingResource countingIdlingResource = new CountingIdlingResource("BusyResource");
+
+ @Override
+ public void increment() {
+ countingIdlingResource.increment();
+ }
+
+ @Override
+ public void decrement() {
+ countingIdlingResource.decrement();
+ }
+ }
+ private IdlingResource idlingResource;
+
+ @Before
+ public void registerIdlingResource() {
+ BusyResource busyR = new BusyResource();
+ idlingResource = busyR.countingIdlingResource;
+ rule.getActivity().setCountingResource(busyR);
+ Espresso.registerIdlingResources(idlingResource);
+ }
+
+ @After
+ public void unregisterIdlingResources() {
+ if (idlingResource != null) {
+ Espresso.unregisterIdlingResources(idlingResource);
+ }
+ }
+
@Test
public void testLoopback() throws InterruptedException {
// The time to write down the data during closing of the program can take a while.
@@ -80,7 +116,8 @@ public class ConnectActivityStubbedInputOutputTest {
// During the time we sleep it will record video.
Thread.sleep(10000);
+ // XXX: Not needed at the moment to finish the call.
kjellander_webrtc 2017/03/10 12:14:12 What does this mean "not at the moment"? When will
// Click on hang-up button.
- onView(withId(R.id.button_call_disconnect)).perform(click());
+ // onView(withId(R.id.button_call_disconnect)).perform(click());
}
}

Powered by Google App Engine
This is Rietveld 408576698