mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1207714 - Pre: Tweaks to the autopush client. r=me
MozReview-Commit-ID: INWEkLJfVDQ
This commit is contained in:
parent
c1d6f977a4
commit
aa3cf20ce7
@ -21,6 +21,10 @@ public class AutopushClientException extends Exception {
|
||||
super(e);
|
||||
}
|
||||
|
||||
public boolean isTransientError() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class AutopushClientRemoteException extends AutopushClientException {
|
||||
private static final long serialVersionUID = 2209313149952001000L;
|
||||
|
||||
@ -56,6 +60,15 @@ public class AutopushClientException extends Exception {
|
||||
public boolean isNotFound() {
|
||||
return httpStatusCode == HttpStatus.SC_NOT_FOUND;
|
||||
}
|
||||
|
||||
public boolean isGone() {
|
||||
return httpStatusCode == HttpStatus.SC_GONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTransientError() {
|
||||
return httpStatusCode >= 500;
|
||||
}
|
||||
}
|
||||
|
||||
public static class AutopushClientMalformedResponseException extends AutopushClientRemoteException {
|
||||
|
@ -35,7 +35,7 @@ import static org.mockito.Mockito.verify;
|
||||
@RunWith(TestRunner.class)
|
||||
@Ignore("Live test that requires network connection -- remove this line to run this test.")
|
||||
public class TestLiveAutopushClient {
|
||||
final String serverURL = "https://updates-autopush-dev.stage.mozaws.net/v1/gcm/829133274407";
|
||||
final String serverURL = "https://updates-autopush.stage.mozaws.net/v1/gcm/829133274407";
|
||||
|
||||
protected AutopushClient client;
|
||||
|
||||
@ -93,7 +93,7 @@ public class TestLiveAutopushClient {
|
||||
|
||||
final AutopushClientException failureException = assertFailure(reunregisterDelegate, Void.class);
|
||||
Assert.assertThat(failureException, instanceOf(AutopushClientException.AutopushClientRemoteException.class));
|
||||
Assert.assertTrue(((AutopushClientException.AutopushClientRemoteException) failureException).isNotFound());
|
||||
Assert.assertTrue(((AutopushClientException.AutopushClientRemoteException) failureException).isGone());
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -122,13 +122,13 @@ public class TestLiveAutopushClient {
|
||||
|
||||
Assert.assertNull(assertSuccess(unsubscribeDelegate, Void.class));
|
||||
|
||||
// Trying to unsubscribe a second time should give a 404.
|
||||
// Trying to unsubscribe a second time should give a 410.
|
||||
final RequestDelegate<Void> reunsubscribeDelegate = mock(RequestDelegate.class);
|
||||
client.unsubscribeChannel(registerResponse.uaid, registerResponse.secret, subscribeResponse.channelID, reunsubscribeDelegate);
|
||||
|
||||
final AutopushClientException reunsubscribeFailureException = assertFailure(reunsubscribeDelegate, Void.class);
|
||||
Assert.assertThat(reunsubscribeFailureException, instanceOf(AutopushClientException.AutopushClientRemoteException.class));
|
||||
Assert.assertTrue(((AutopushClientException.AutopushClientRemoteException) reunsubscribeFailureException).isNotFound());
|
||||
Assert.assertTrue(((AutopushClientException.AutopushClientRemoteException) reunsubscribeFailureException).isGone());
|
||||
|
||||
// Trying to unsubscribe from a non-existent channel should give a 404. Right now it gives a 401!
|
||||
final RequestDelegate<Void> badUnsubscribeDelegate = mock(RequestDelegate.class);
|
||||
|
Loading…
Reference in New Issue
Block a user