Chromium Code Reviews

Side by Side Diff: webrtc/examples/androidjunit/src/org/appspot/apprtc/DirectRTCClientTest.java

Issue 2418413002: Enable logging to console in DirectRTCClientTest. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 static org.junit.Assert.assertFalse; 13 import static org.junit.Assert.assertFalse;
14 import static org.junit.Assert.assertTrue; 14 import static org.junit.Assert.assertTrue;
15 import static org.junit.Assert.fail; 15 import static org.junit.Assert.fail;
16 import static org.mockito.Matchers.any; 16 import static org.mockito.Matchers.any;
17 import static org.mockito.Matchers.isNotNull; 17 import static org.mockito.Matchers.isNotNull;
18 import static org.mockito.Mockito.mock; 18 import static org.mockito.Mockito.mock;
19 import static org.mockito.Mockito.timeout; 19 import static org.mockito.Mockito.timeout;
20 import static org.mockito.Mockito.verify; 20 import static org.mockito.Mockito.verify;
21 import static org.mockito.Mockito.verifyNoMoreInteractions; 21 import static org.mockito.Mockito.verifyNoMoreInteractions;
22 22
23 import org.chromium.testing.local.LocalRobolectricTestRunner; 23 import org.chromium.testing.local.LocalRobolectricTestRunner;
24 import org.junit.Before; 24 import org.junit.Before;
25 import org.junit.Test; 25 import org.junit.Test;
26 import org.junit.runner.RunWith; 26 import org.junit.runner.RunWith;
27 import org.robolectric.annotation.Config; 27 import org.robolectric.annotation.Config;
28 import org.robolectric.shadows.ShadowLog;
28 import org.webrtc.IceCandidate; 29 import org.webrtc.IceCandidate;
29 import org.webrtc.SessionDescription; 30 import org.webrtc.SessionDescription;
30 31
31 /** 32 /**
32 * Test for DirectRTCClient. Test is very simple and only tests the overall sani ty of the class 33 * Test for DirectRTCClient. Test is very simple and only tests the overall sani ty of the class
33 * behaviour. 34 * behaviour.
34 */ 35 */
35 @RunWith(LocalRobolectricTestRunner.class) 36 @RunWith(LocalRobolectricTestRunner.class)
36 @Config(manifest = Config.NONE) 37 @Config(manifest = Config.NONE)
37 public class DirectRTCClientTest { 38 public class DirectRTCClientTest {
38 private static final String ROOM_URL = ""; 39 private static final String ROOM_URL = "";
39 private static final boolean LOOPBACK = false; 40 private static final boolean LOOPBACK = false;
40 41
41 private static final String DUMMY_SDP_MID = "sdpMid"; 42 private static final String DUMMY_SDP_MID = "sdpMid";
42 private static final String DUMMY_SDP = "sdp"; 43 private static final String DUMMY_SDP = "sdp";
43 44
44 public static final int SERVER_WAIT = 100; 45 public static final int SERVER_WAIT = 100;
45 public static final int NETWORK_TIMEOUT = 1000; 46 public static final int NETWORK_TIMEOUT = 1000;
46 47
47 private DirectRTCClient client; 48 private DirectRTCClient client;
48 private DirectRTCClient server; 49 private DirectRTCClient server;
49 50
50 AppRTCClient.SignalingEvents clientEvents; 51 AppRTCClient.SignalingEvents clientEvents;
51 AppRTCClient.SignalingEvents serverEvents; 52 AppRTCClient.SignalingEvents serverEvents;
52 53
53 @Before 54 @Before
54 public void setUp() { 55 public void setUp() {
56 ShadowLog.stream = System.out;
57
55 clientEvents = mock(AppRTCClient.SignalingEvents.class); 58 clientEvents = mock(AppRTCClient.SignalingEvents.class);
56 serverEvents = mock(AppRTCClient.SignalingEvents.class); 59 serverEvents = mock(AppRTCClient.SignalingEvents.class);
57 60
58 client = new DirectRTCClient(clientEvents); 61 client = new DirectRTCClient(clientEvents);
59 server = new DirectRTCClient(serverEvents); 62 server = new DirectRTCClient(serverEvents);
60 } 63 }
61 64
62 @Test 65 @Test
63 public void testValidIpPattern() { 66 public void testValidIpPattern() {
64 // Strings that should match the pattern. 67 // Strings that should match the pattern.
(...skipping 76 matching lines...)
141 .onRemoteIceCandidate(isNotNull(IceCandidate.class)); 144 .onRemoteIceCandidate(isNotNull(IceCandidate.class));
142 145
143 client.disconnectFromRoom(); 146 client.disconnectFromRoom();
144 verify(clientEvents, timeout(NETWORK_TIMEOUT)).onChannelClose(); 147 verify(clientEvents, timeout(NETWORK_TIMEOUT)).onChannelClose();
145 verify(serverEvents, timeout(NETWORK_TIMEOUT)).onChannelClose(); 148 verify(serverEvents, timeout(NETWORK_TIMEOUT)).onChannelClose();
146 149
147 verifyNoMoreInteractions(clientEvents); 150 verifyNoMoreInteractions(clientEvents);
148 verifyNoMoreInteractions(serverEvents); 151 verifyNoMoreInteractions(serverEvents);
149 } 152 }
150 } 153 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine