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.util; | 11 package org.appspot.apprtc.util; |
12 | 12 |
| 13 import static org.mockito.Mockito.times; |
| 14 import static org.mockito.Mockito.verify; |
| 15 import static org.mockito.Mockito.verifyNoMoreInteractions; |
| 16 import static org.robolectric.Robolectric.shadowOf; |
| 17 |
13 import org.junit.After; | 18 import org.junit.After; |
14 import org.junit.Before; | 19 import org.junit.Before; |
15 import org.junit.Test; | 20 import org.junit.Test; |
16 import org.junit.runner.RunWith; | 21 import org.junit.runner.RunWith; |
17 import org.mockito.Mock; | 22 import org.mockito.Mock; |
18 import org.mockito.MockitoAnnotations; | 23 import org.mockito.MockitoAnnotations; |
19 import org.robolectric.RobolectricTestRunner; | 24 import org.robolectric.RobolectricTestRunner; |
20 import org.robolectric.annotation.Config; | 25 import org.robolectric.annotation.Config; |
21 import org.robolectric.shadows.ShadowLooper; | 26 import org.robolectric.shadows.ShadowLooper; |
22 | 27 |
23 import static org.mockito.Mockito.times; | |
24 import static org.mockito.Mockito.verify; | |
25 import static org.mockito.Mockito.verifyNoMoreInteractions; | |
26 import static org.robolectric.Robolectric.shadowOf; | |
27 | |
28 @RunWith(RobolectricTestRunner.class) | 28 @RunWith(RobolectricTestRunner.class) |
29 @Config(manifest = Config.NONE) | 29 @Config(manifest = Config.NONE) |
30 public class LooperExecutorTest { | 30 public class LooperExecutorTest { |
31 private final static int RUN_TIMES = 10; | 31 private final static int RUN_TIMES = 10; |
32 | 32 |
33 @Mock private Runnable mockRunnable; | 33 @Mock private Runnable mockRunnable; |
34 private LooperExecutor executor; | 34 private LooperExecutor executor; |
35 | 35 |
36 @Before | 36 @Before |
37 public void setUp() { | 37 public void setUp() { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 shadowLooper.idle(); | 113 shadowLooper.idle(); |
114 } | 114 } |
115 | 115 |
116 /** | 116 /** |
117 * Get ShadowLooper of the executor thread. | 117 * Get ShadowLooper of the executor thread. |
118 */ | 118 */ |
119 private ShadowLooper getShadowLooper() { | 119 private ShadowLooper getShadowLooper() { |
120 return shadowOf(executor.getHandler().getLooper()); | 120 return shadowOf(executor.getHandler().getLooper()); |
121 } | 121 } |
122 } | 122 } |
OLD | NEW |