| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 import org.junit.Rule; | 31 import org.junit.Rule; |
| 32 import org.junit.Test; | 32 import org.junit.Test; |
| 33 import org.junit.runner.RunWith; | 33 import org.junit.runner.RunWith; |
| 34 | 34 |
| 35 /** | 35 /** |
| 36 * Used to start a loopback call with video input from file and video output als
o to file. | 36 * Used to start a loopback call with video input from file and video output als
o to file. |
| 37 * The test case is a building block in other testing for video quality. | 37 * The test case is a building block in other testing for video quality. |
| 38 */ | 38 */ |
| 39 @RunWith(AndroidJUnit4.class) | 39 @RunWith(AndroidJUnit4.class) |
| 40 @LargeTest | 40 @LargeTest |
| 41 public class ConnectActivityStubbedInputOutputTest { | 41 public class CallActivityStubbedInputOutputTest { |
| 42 private static final String TAG = "ConnectActivityStubbedInputOutputTest"; | 42 private static final String TAG = "CallActivityStubbedInputOutputTest"; |
| 43 | 43 |
| 44 @Rule | 44 @Rule |
| 45 public ActivityTestRule<ConnectActivity> rule = | 45 public ActivityTestRule<CallActivity> rule = new ActivityTestRule<CallActivity
>( |
| 46 new ActivityTestRule<ConnectActivity>(ConnectActivity.class) { | 46 CallActivity.class) { |
| 47 @Override | 47 @Override |
| 48 protected Intent getActivityIntent() { | 48 protected Intent getActivityIntent() { |
| 49 Context context = InstrumentationRegistry.getInstrumentation().getTarg
etContext(); | 49 Context context = InstrumentationRegistry.getContext(); |
| 50 Intent intent = new Intent("android.intent.action.VIEW", Uri.parse("ht
tps://appr.tc"), | 50 Intent intent = new Intent("android.intent.action.VIEW", Uri.parse("http:/
/localhost:9999")); |
| 51 context, ConnectActivity.class); | |
| 52 | 51 |
| 53 intent.putExtra(CallActivity.EXTRA_USE_VALUES_FROM_INTENT, true); | 52 intent.putExtra(CallActivity.EXTRA_USE_VALUES_FROM_INTENT, true); |
| 54 | 53 |
| 55 intent.putExtra(CallActivity.EXTRA_LOOPBACK, true); | 54 intent.putExtra(CallActivity.EXTRA_COLLIDERURL, "http://localhost:8089"); |
| 56 intent.putExtra(CallActivity.EXTRA_AUDIOCODEC, "OPUS"); | |
| 57 intent.putExtra(CallActivity.EXTRA_VIDEOCODEC, "VP8"); | |
| 58 intent.putExtra(CallActivity.EXTRA_CAPTURETOTEXTURE_ENABLED, false); | |
| 59 intent.putExtra(CallActivity.EXTRA_CAMERA2, false); | |
| 60 intent.putExtra(CallActivity.EXTRA_ROOMID, UUID.randomUUID().toString(
).substring(0, 8)); | |
| 61 | 55 |
| 62 intent.putExtra(CallActivity.EXTRA_VIDEO_FILE_AS_CAMERA, | 56 intent.putExtra(CallActivity.EXTRA_LOOPBACK, true); |
| 63 Environment.getExternalStorageDirectory().getAbsolutePath() | 57 intent.putExtra(CallActivity.EXTRA_AUDIOCODEC, "OPUS"); |
| 64 + "/chromium_tests_root/resources/reference_video_640x360_30fp
s.y4m"); | 58 intent.putExtra(CallActivity.EXTRA_VIDEOCODEC, "VP8"); |
| 59 intent.putExtra(CallActivity.EXTRA_CAPTURETOTEXTURE_ENABLED, false); |
| 60 intent.putExtra(CallActivity.EXTRA_CAMERA2, false); |
| 61 intent.putExtra(CallActivity.EXTRA_ROOMID, UUID.randomUUID().toString().su
bstring(0, 8)); |
| 65 | 62 |
| 66 intent.putExtra(CallActivity.EXTRA_SAVE_REMOTE_VIDEO_TO_FILE, | 63 intent.putExtra(CallActivity.EXTRA_VIDEO_FILE_AS_CAMERA, |
| 67 Environment.getExternalStorageDirectory().getAbsolutePath() + "/ou
tput.y4m"); | 64 Environment.getExternalStorageDirectory().getAbsolutePath() |
| 68 intent.putExtra(CallActivity.EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_WIDTH, 64
0); | 65 + "/chromium_tests_root/resources/reference_video_640x360_30fps.y4
m"); |
| 69 intent.putExtra(CallActivity.EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_HEIGHT, 3
60); | |
| 70 | 66 |
| 71 return intent; | 67 intent.putExtra(CallActivity.EXTRA_SAVE_REMOTE_VIDEO_TO_FILE, |
| 72 } | 68 Environment.getExternalStorageDirectory().getAbsolutePath() + "/output
.y4m"); |
| 73 }; | 69 intent.putExtra(CallActivity.EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_WIDTH, 640); |
| 70 intent.putExtra(CallActivity.EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_HEIGHT, 360); |
| 71 |
| 72 return intent; |
| 73 } |
| 74 }; |
| 74 | 75 |
| 75 @Test | 76 @Test |
| 76 public void testLoopback() throws InterruptedException { | 77 public void testLoopback() throws InterruptedException { |
| 77 // The time to write down the data during closing of the program can take a
while. | 78 // The time to write down the data during closing of the program can take a
while. |
| 78 IdlingPolicies.setMasterPolicyTimeout(240000, TimeUnit.MILLISECONDS); | 79 IdlingPolicies.setMasterPolicyTimeout(240000, TimeUnit.MILLISECONDS); |
| 79 | 80 |
| 80 // During the time we sleep it will record video. | 81 // During the time we sleep it will record video. |
| 81 Thread.sleep(10000); | 82 Thread.sleep(8000); |
| 82 | 83 |
| 83 // Click on hang-up button. | 84 // Click on hang-up button. |
| 84 onView(withId(R.id.button_call_disconnect)).perform(click()); | 85 onView(withId(R.id.button_call_disconnect)).perform(click()); |
| 85 } | 86 } |
| 86 } | 87 } |
| OLD | NEW |