Chromium Code Reviews| Index: webrtc/examples/androidtests/src/org/appspot/apprtc/test/ConnectActivityStubbedInputOutputTest.java |
| diff --git a/webrtc/examples/androidtests/src/org/appspot/apprtc/test/ConnectActivityStubbedInputOutputTest.java b/webrtc/examples/androidtests/src/org/appspot/apprtc/test/ConnectActivityStubbedInputOutputTest.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..55ec5e8906b496dcaec63cffe497dabe755fd28d |
| --- /dev/null |
| +++ b/webrtc/examples/androidtests/src/org/appspot/apprtc/test/ConnectActivityStubbedInputOutputTest.java |
| @@ -0,0 +1,89 @@ |
| +/* |
| + * Copyright 2016 The WebRTC Project Authors. All rights reserved. |
| + * |
| + * Use of this source code is governed by a BSD-style license |
| + * that can be found in the LICENSE file in the root of the source |
| + * tree. An additional intellectual property rights grant can be found |
| + * in the file PATENTS. All contributing project authors may |
| + * be found in the AUTHORS file in the root of the source tree. |
| + */ |
| + |
| +package org.appspot.apprtc.test; |
| + |
| +import java.lang.Thread; |
| +import java.lang.InterruptedException; |
| +import java.util.UUID; |
| +import java.util.concurrent.CountDownLatch; |
|
janssonWebRTC
2016/12/19 10:58:11
Is this used? Any other imports that are not used?
|
| +import java.util.concurrent.TimeUnit; |
| + |
| +import android.content.Context; |
| +import android.content.Intent; |
| +import android.net.Uri; |
| +import android.test.InstrumentationTestCase; |
|
kjellander_webrtc
2016/12/19 11:26:26
sort imports
mandermo
2016/12/20 15:54:12
Done.
|
| +import android.support.test.InstrumentationRegistry; |
| +import android.support.test.rule.ActivityTestRule; |
| +import android.support.test.runner.AndroidJUnit4; |
| +import android.test.suitebuilder.annotation.SmallTest; |
| +import android.test.suitebuilder.annotation.LargeTest; |
| +import android.support.test.espresso.IdlingPolicies; |
| + |
| +import org.appspot.apprtc.CallActivity; |
| +import org.appspot.apprtc.ConnectActivity; |
| + |
| +import org.appspot.apprtc.R; |
| + |
| +import org.junit.Rule; |
| +import org.junit.Before; |
| +import org.junit.Test; |
| +import org.junit.runner.RunWith; |
| + |
| +// import static org.junit.framework.Assert.*; |
|
janssonWebRTC
2016/12/19 10:58:11
Remove.
mandermo
2016/12/20 15:54:12
Done.
|
| + |
| +import static android.support.test.espresso.Espresso.onView; |
| +import static android.support.test.espresso.action.ViewActions.click; |
| +import static android.support.test.espresso.assertion.ViewAssertions.matches; |
| +import static android.support.test.espresso.matcher.ViewMatchers.withId; |
| +import static android.support.test.espresso.matcher.ViewMatchers.*; |
| +import static android.support.test.espresso.matcher.ViewMatchers.withText; |
| + |
|
janssonWebRTC
2016/12/19 10:58:11
Maybe add an overall comment explaining what the t
mandermo
2016/12/20 15:54:12
Done.
|
| +@RunWith(AndroidJUnit4.class) |
| +@LargeTest |
| +public class ConnectActivityStubbedInputOutputTest /*extends InstrumentationTestCase*/ { |
| + private static final String TAG = "ConnectActivityStubbedInputOutputTest"; |
| + |
| + // third parameter is set to false which means the activity is not started automatically |
| + @Rule |
| + public ActivityTestRule<ConnectActivity> rule = new ActivityTestRule(ConnectActivity.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); |
| + |
| + intent.putExtra(CallActivity.EXTRA_USE_VALUES_FROM_INTENT, true); |
| + |
| + intent.putExtra(CallActivity.EXTRA_LOOPBACK, true); |
| + intent.putExtra(CallActivity.EXTRA_AUDIOCODEC, "OPUS"); |
| + intent.putExtra(CallActivity.EXTRA_VIDEOCODEC, "VP8"); |
| + intent.putExtra(CallActivity.EXTRA_CAPTURETOTEXTURE_ENABLED, false); |
| + intent.putExtra(CallActivity.EXTRA_CAMERA2, false); |
| + intent.putExtra(CallActivity.EXTRA_ROOMID, UUID.randomUUID().toString().substring(0, 8)); |
| + |
| + intent.putExtra( |
| + CallActivity.EXTRA_VIDEO_FILE_AS_CAMERA, "/sdcard/reference_video_640x360_30fps.y4m"); |
|
kjellander_webrtc
2016/12/19 11:26:26
The data section for the GN target only lists "//
mandermo
2016/12/20 15:54:12
capturetestvideo.y4m is needed by other testcase,
|
| + |
| + intent.putExtra(CallActivity.EXTRA_SAVE_REMOTE_VIDEO_TO_FILE, "/sdcard/output.y4m"); |
| + intent.putExtra(CallActivity.EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_WIDTH, 640); |
| + intent.putExtra(CallActivity.EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_HEIGHT, 360); |
| + |
| + return intent; |
| + } |
| + }; |
| + |
| + @Test |
| + public void testLoopback() throws InterruptedException { |
| + IdlingPolicies.setMasterPolicyTimeout(240000, TimeUnit.MILLISECONDS); |
|
janssonWebRTC
2016/12/19 10:58:11
Add a comment explaining why the master test timeo
mandermo
2016/12/20 15:54:12
Done.
|
| + Thread.sleep(10000); |
|
janssonWebRTC
2016/12/19 10:58:11
Add a comment here explaining why we are sleeping
|
| + onView(withId(R.id.button_call_disconnect)).perform(click()); |
|
kjellander_webrtc
2016/12/19 11:26:25
I thought we were going to wait for a toast to be
mandermo
2016/12/20 15:54:12
In the current approach it seams to wait synchrono
kjellander_webrtc
2016/12/27 06:31:42
Acknowledged.
|
| + } |
| +} |