OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. | |
3 * | |
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 | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 | |
11 package org.appspot.apprtc.test; | |
12 | |
13 import java.lang.Thread; | |
14 import java.lang.InterruptedException; | |
15 import java.util.UUID; | |
16 import java.util.concurrent.CountDownLatch; | |
janssonWebRTC
2016/12/19 10:58:11
Is this used? Any other imports that are not used?
| |
17 import java.util.concurrent.TimeUnit; | |
18 | |
19 import android.content.Context; | |
20 import android.content.Intent; | |
21 import android.net.Uri; | |
22 import android.test.InstrumentationTestCase; | |
kjellander_webrtc
2016/12/19 11:26:26
sort imports
mandermo
2016/12/20 15:54:12
Done.
| |
23 import android.support.test.InstrumentationRegistry; | |
24 import android.support.test.rule.ActivityTestRule; | |
25 import android.support.test.runner.AndroidJUnit4; | |
26 import android.test.suitebuilder.annotation.SmallTest; | |
27 import android.test.suitebuilder.annotation.LargeTest; | |
28 import android.support.test.espresso.IdlingPolicies; | |
29 | |
30 import org.appspot.apprtc.CallActivity; | |
31 import org.appspot.apprtc.ConnectActivity; | |
32 | |
33 import org.appspot.apprtc.R; | |
34 | |
35 import org.junit.Rule; | |
36 import org.junit.Before; | |
37 import org.junit.Test; | |
38 import org.junit.runner.RunWith; | |
39 | |
40 // import static org.junit.framework.Assert.*; | |
janssonWebRTC
2016/12/19 10:58:11
Remove.
mandermo
2016/12/20 15:54:12
Done.
| |
41 | |
42 import static android.support.test.espresso.Espresso.onView; | |
43 import static android.support.test.espresso.action.ViewActions.click; | |
44 import static android.support.test.espresso.assertion.ViewAssertions.matches; | |
45 import static android.support.test.espresso.matcher.ViewMatchers.withId; | |
46 import static android.support.test.espresso.matcher.ViewMatchers.*; | |
47 import static android.support.test.espresso.matcher.ViewMatchers.withText; | |
48 | |
janssonWebRTC
2016/12/19 10:58:11
Maybe add an overall comment explaining what the t
mandermo
2016/12/20 15:54:12
Done.
| |
49 @RunWith(AndroidJUnit4.class) | |
50 @LargeTest | |
51 public class ConnectActivityStubbedInputOutputTest /*extends InstrumentationTest Case*/ { | |
52 private static final String TAG = "ConnectActivityStubbedInputOutputTest"; | |
53 | |
54 // third parameter is set to false which means the activity is not started aut omatically | |
55 @Rule | |
56 public ActivityTestRule<ConnectActivity> rule = new ActivityTestRule(ConnectAc tivity.class) { | |
57 @Override | |
58 protected Intent getActivityIntent() { | |
59 Context context = InstrumentationRegistry.getInstrumentation().getTargetCo ntext(); | |
60 Intent intent = new Intent("android.intent.action.VIEW", Uri.parse("https: //appr.tc"), | |
61 context, ConnectActivity.class); | |
62 | |
63 intent.putExtra(CallActivity.EXTRA_USE_VALUES_FROM_INTENT, true); | |
64 | |
65 intent.putExtra(CallActivity.EXTRA_LOOPBACK, true); | |
66 intent.putExtra(CallActivity.EXTRA_AUDIOCODEC, "OPUS"); | |
67 intent.putExtra(CallActivity.EXTRA_VIDEOCODEC, "VP8"); | |
68 intent.putExtra(CallActivity.EXTRA_CAPTURETOTEXTURE_ENABLED, false); | |
69 intent.putExtra(CallActivity.EXTRA_CAMERA2, false); | |
70 intent.putExtra(CallActivity.EXTRA_ROOMID, UUID.randomUUID().toString().su bstring(0, 8)); | |
71 | |
72 intent.putExtra( | |
73 CallActivity.EXTRA_VIDEO_FILE_AS_CAMERA, "/sdcard/reference_video_640x 360_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,
| |
74 | |
75 intent.putExtra(CallActivity.EXTRA_SAVE_REMOTE_VIDEO_TO_FILE, "/sdcard/out put.y4m"); | |
76 intent.putExtra(CallActivity.EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_WIDTH, 640); | |
77 intent.putExtra(CallActivity.EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_HEIGHT, 360); | |
78 | |
79 return intent; | |
80 } | |
81 }; | |
82 | |
83 @Test | |
84 public void testLoopback() throws InterruptedException { | |
85 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.
| |
86 Thread.sleep(10000); | |
janssonWebRTC
2016/12/19 10:58:11
Add a comment here explaining why we are sleeping
| |
87 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.
| |
88 } | |
89 } | |
OLD | NEW |