mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1207714 - Pre: Expose synchronous executor to product code. r=rnewman
MozReview-Commit-ID: 3eDVh0nk7Nc
This commit is contained in:
parent
5c844cf44f
commit
c1d6f977a4
@ -23,6 +23,7 @@ import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
import org.json.simple.JSONArray;
|
||||
import org.mozilla.apache.commons.codec.binary.Base32;
|
||||
@ -562,4 +563,13 @@ public class Utils {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Executor newSynchronousExecutor() {
|
||||
return new Executor() {
|
||||
@Override
|
||||
public void execute(Runnable runnable) {
|
||||
runnable.run();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -169,14 +169,4 @@ public class WaitHelper {
|
||||
public boolean isIdle() {
|
||||
return queue.isEmpty();
|
||||
}
|
||||
|
||||
public static Executor newSynchronousExecutor() {
|
||||
return new Executor() {
|
||||
|
||||
@Override
|
||||
public void execute(Runnable runnable) {
|
||||
runnable.run();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -10,20 +10,21 @@ import org.mozilla.gecko.background.testhelpers.TestRunner;
|
||||
import org.mozilla.gecko.background.testhelpers.WaitHelper;
|
||||
import org.mozilla.gecko.push.autopush.AutopushClient;
|
||||
import org.mozilla.gecko.push.autopush.AutopushClientException;
|
||||
import org.mozilla.gecko.sync.Utils;
|
||||
|
||||
@RunWith(TestRunner.class)
|
||||
public class TestAutopushClient {
|
||||
@Test
|
||||
public void testGetSenderID() throws Exception {
|
||||
final AutopushClient client = new AutopushClient("https://updates-autopush-dev.stage.mozaws.net/v1/gcm/829133274407",
|
||||
WaitHelper.newSynchronousExecutor());
|
||||
Utils.newSynchronousExecutor());
|
||||
Assert.assertEquals("829133274407", client.getSenderIDFromServerURI());
|
||||
}
|
||||
|
||||
@Test(expected=AutopushClientException.class)
|
||||
public void testGetNoSenderID() throws Exception {
|
||||
final AutopushClient client = new AutopushClient("https://updates-autopush-dev.stage.mozaws.net/v1/gcm",
|
||||
WaitHelper.newSynchronousExecutor());
|
||||
Utils.newSynchronousExecutor());
|
||||
client.getSenderIDFromServerURI();
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public class TestLiveAutopushClient {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
BaseResource.rewriteLocalhost = false;
|
||||
client = new AutopushClient(serverURL, WaitHelper.newSynchronousExecutor());
|
||||
client = new AutopushClient(serverURL, Utils.newSynchronousExecutor());
|
||||
}
|
||||
|
||||
protected <T> T assertSuccess(RequestDelegate<T> delegate, Class<T> klass) {
|
||||
|
Loading…
Reference in New Issue
Block a user