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 |
11 package org.appspot.apprtc; | 11 package org.appspot.apprtc; |
12 | 12 |
13 import android.util.Log; | |
14 | |
15 import org.appspot.apprtc.util.RobolectricLooperExecutor; | |
16 import org.junit.Before; | 13 import org.junit.Before; |
17 import org.junit.Test; | 14 import org.junit.Test; |
18 import org.junit.runner.RunWith; | 15 import org.junit.runner.RunWith; |
19 import org.robolectric.RobolectricTestRunner; | 16 import org.robolectric.RobolectricTestRunner; |
20 import org.robolectric.annotation.Config; | 17 import org.robolectric.annotation.Config; |
21 import org.webrtc.IceCandidate; | 18 import org.webrtc.IceCandidate; |
22 import org.webrtc.SessionDescription; | 19 import org.webrtc.SessionDescription; |
23 | 20 |
24 import static org.junit.Assert.fail; | 21 import static org.junit.Assert.fail; |
25 import static org.mockito.Matchers.any; | 22 import static org.mockito.Matchers.any; |
(...skipping 23 matching lines...) Expand all Loading... |
49 private DirectRTCClient server; | 46 private DirectRTCClient server; |
50 | 47 |
51 AppRTCClient.SignalingEvents clientEvents; | 48 AppRTCClient.SignalingEvents clientEvents; |
52 AppRTCClient.SignalingEvents serverEvents; | 49 AppRTCClient.SignalingEvents serverEvents; |
53 | 50 |
54 @Before | 51 @Before |
55 public void setUp() { | 52 public void setUp() { |
56 clientEvents = mock(AppRTCClient.SignalingEvents.class); | 53 clientEvents = mock(AppRTCClient.SignalingEvents.class); |
57 serverEvents = mock(AppRTCClient.SignalingEvents.class); | 54 serverEvents = mock(AppRTCClient.SignalingEvents.class); |
58 | 55 |
59 client = new DirectRTCClient(clientEvents, new RobolectricLooperExecutor()); | 56 client = new DirectRTCClient(clientEvents); |
60 server = new DirectRTCClient(serverEvents, new RobolectricLooperExecutor()); | 57 server = new DirectRTCClient(serverEvents); |
61 } | 58 } |
62 | 59 |
63 @Test | 60 @Test |
64 public void testDirectRTCClient() { | 61 public void testDirectRTCClient() { |
65 server.connectToRoom(new AppRTCClient.RoomConnectionParameters(ROOM_URL, "0.
0.0.0", LOOPBACK)); | 62 server.connectToRoom(new AppRTCClient.RoomConnectionParameters(ROOM_URL, "0.
0.0.0", LOOPBACK)); |
66 try { | 63 try { |
67 Thread.sleep(SERVER_WAIT); | 64 Thread.sleep(SERVER_WAIT); |
68 } catch (InterruptedException e) { | 65 } catch (InterruptedException e) { |
69 fail(e.getMessage()); | 66 fail(e.getMessage()); |
70 } | 67 } |
(...skipping 23 matching lines...) Expand all Loading... |
94 .onRemoteIceCandidate(isNotNull(IceCandidate.class)); | 91 .onRemoteIceCandidate(isNotNull(IceCandidate.class)); |
95 | 92 |
96 client.disconnectFromRoom(); | 93 client.disconnectFromRoom(); |
97 verify(clientEvents, timeout(NETWORK_TIMEOUT)).onChannelClose(); | 94 verify(clientEvents, timeout(NETWORK_TIMEOUT)).onChannelClose(); |
98 verify(serverEvents, timeout(NETWORK_TIMEOUT)).onChannelClose(); | 95 verify(serverEvents, timeout(NETWORK_TIMEOUT)).onChannelClose(); |
99 | 96 |
100 verifyNoMoreInteractions(clientEvents); | 97 verifyNoMoreInteractions(clientEvents); |
101 verifyNoMoreInteractions(serverEvents); | 98 verifyNoMoreInteractions(serverEvents); |
102 } | 99 } |
103 } | 100 } |
OLD | NEW |