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 static org.junit.Assert.fail; |
| 14 import static org.mockito.Mockito.timeout; |
| 15 import static org.mockito.Mockito.verify; |
| 16 import static org.mockito.Mockito.verifyNoMoreInteractions; |
13 | 17 |
14 import org.junit.After; | 18 import org.junit.After; |
15 import org.junit.Before; | 19 import org.junit.Before; |
16 import org.junit.Test; | 20 import org.junit.Test; |
17 import org.junit.runner.RunWith; | 21 import org.junit.runner.RunWith; |
18 import org.mockito.Mock; | 22 import org.mockito.Mock; |
19 import org.mockito.MockitoAnnotations; | 23 import org.mockito.MockitoAnnotations; |
20 import org.robolectric.RobolectricTestRunner; | 24 import org.robolectric.RobolectricTestRunner; |
21 import org.robolectric.annotation.Config; | 25 import org.robolectric.annotation.Config; |
22 import org.robolectric.shadows.ShadowLog; | 26 import org.robolectric.shadows.ShadowLog; |
23 | 27 |
24 import java.util.concurrent.ExecutionException; | |
25 import java.util.concurrent.ExecutorService; | 28 import java.util.concurrent.ExecutorService; |
26 import java.util.concurrent.Executors; | 29 import java.util.concurrent.Executors; |
27 import java.util.concurrent.TimeUnit; | 30 import java.util.concurrent.TimeUnit; |
28 | 31 |
29 import static org.junit.Assert.fail; | |
30 import static org.mockito.Mockito.timeout; | |
31 import static org.mockito.Mockito.verify; | |
32 import static org.mockito.Mockito.verifyNoMoreInteractions; | |
33 | |
34 @RunWith(RobolectricTestRunner.class) | 32 @RunWith(RobolectricTestRunner.class) |
35 @Config(manifest = Config.NONE) | 33 @Config(manifest = Config.NONE) |
36 public class TCPChannelClientTest { | 34 public class TCPChannelClientTest { |
37 private static final int PORT = 8888; | 35 private static final int PORT = 8888; |
38 /** | 36 /** |
39 * How long we wait before trying to connect to the server. Chosen quite arbit
rarily and | 37 * How long we wait before trying to connect to the server. Chosen quite arbit
rarily and |
40 * could be made smaller if need be. | 38 * could be made smaller if need be. |
41 */ | 39 */ |
42 private static final int SERVER_WAIT = 10; | 40 private static final int SERVER_WAIT = 10; |
43 private static final int CONNECT_TIMEOUT = 100; | 41 private static final int CONNECT_TIMEOUT = 100; |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 * Queues runnable to be run and waits for it to be executed by the executor t
hread | 191 * Queues runnable to be run and waits for it to be executed by the executor t
hread |
194 */ | 192 */ |
195 public void executeAndWait(Runnable runnable) { | 193 public void executeAndWait(Runnable runnable) { |
196 try { | 194 try { |
197 executor.submit(runnable).get(); | 195 executor.submit(runnable).get(); |
198 } catch (Exception e) { | 196 } catch (Exception e) { |
199 fail(e.getMessage()); | 197 fail(e.getMessage()); |
200 } | 198 } |
201 } | 199 } |
202 } | 200 } |
OLD | NEW |