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; | 13 import static org.junit.Assert.fail; |
14 import static org.mockito.Mockito.timeout; | 14 import static org.mockito.Mockito.timeout; |
15 import static org.mockito.Mockito.verify; | 15 import static org.mockito.Mockito.verify; |
16 import static org.mockito.Mockito.verifyNoMoreInteractions; | 16 import static org.mockito.Mockito.verifyNoMoreInteractions; |
17 | 17 |
| 18 import org.chromium.testing.local.LocalRobolectricTestRunner; |
18 import org.junit.After; | 19 import org.junit.After; |
19 import org.junit.Before; | 20 import org.junit.Before; |
20 import org.junit.Test; | 21 import org.junit.Test; |
21 import org.junit.runner.RunWith; | 22 import org.junit.runner.RunWith; |
22 import org.mockito.Mock; | 23 import org.mockito.Mock; |
23 import org.mockito.MockitoAnnotations; | 24 import org.mockito.MockitoAnnotations; |
24 import org.robolectric.RobolectricTestRunner; | |
25 import org.robolectric.annotation.Config; | 25 import org.robolectric.annotation.Config; |
26 import org.robolectric.shadows.ShadowLog; | 26 import org.robolectric.shadows.ShadowLog; |
27 | 27 |
28 import java.util.concurrent.ExecutorService; | 28 import java.util.concurrent.ExecutorService; |
29 import java.util.concurrent.Executors; | 29 import java.util.concurrent.Executors; |
30 import java.util.concurrent.TimeUnit; | 30 import java.util.concurrent.TimeUnit; |
31 | 31 |
32 @RunWith(RobolectricTestRunner.class) | 32 @RunWith(LocalRobolectricTestRunner.class) |
33 @Config(manifest = Config.NONE) | 33 @Config(manifest = Config.NONE) |
34 public class TCPChannelClientTest { | 34 public class TCPChannelClientTest { |
35 private static final int PORT = 8888; | 35 private static final int PORT = 8888; |
36 /** | 36 /** |
37 * 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 |
38 * could be made smaller if need be. | 38 * could be made smaller if need be. |
39 */ | 39 */ |
40 private static final int SERVER_WAIT = 10; | 40 private static final int SERVER_WAIT = 10; |
41 private static final int CONNECT_TIMEOUT = 100; | 41 private static final int CONNECT_TIMEOUT = 100; |
42 private static final int SEND_TIMEOUT = 100; | 42 private static final int SEND_TIMEOUT = 100; |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 * 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 |
192 */ | 192 */ |
193 public void executeAndWait(Runnable runnable) { | 193 public void executeAndWait(Runnable runnable) { |
194 try { | 194 try { |
195 executor.submit(runnable).get(); | 195 executor.submit(runnable).get(); |
196 } catch (Exception e) { | 196 } catch (Exception e) { |
197 fail(e.getMessage()); | 197 fail(e.getMessage()); |
198 } | 198 } |
199 } | 199 } |
200 } | 200 } |
OLD | NEW |